mardi 5 mai 2015

Position changed when changing the anchorpoint of the (sprite) node

I am adding the main node and the child nodes to it. All nodes should be rotating from a variable anchorpoint.

So when I change the anchorpoint of the main node, the distance between the child nodes and the main nodes is being changed(the distance between the childnodes remain the same).

Why is this happening and how can it be solved?

Mach-0 Linker error when trying to run watchKit app on Simulator

When I try to build and run my app with a watchKit extension, here is the error screen that I see. If you would like to see a larger image, simply right click and hit open in new Tab. enter image description here

Can't get holidays from Google calendar

I am create calendar by get events from Google Calendar. I can get and sync events i created on app or on google calendar (the same account). But i cant get list holidays from Google Calendar, it always notifice error.

NSErrorFailingURLKey=http://ift.tt/1Jiz6se, NSLocalizedDescription=Request failed: unauthorized (401)

Compiler error after adding a new Configuration in project

I encountered an issue after setting up a new value for Configuration when building (after reading the following post: Different App Icons for your iOS Beta, Dev, and Release builds). The error message is as follows:

ld: file not found: /Users/.../Library/Developer/Xcode/DerivedData/SomeAppName-.../Build/Products/Debug-iphoneos/http://ift.tt/1dLIb2W

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm not sure how to fix it, checked and double checked with the article and I did follow everything as explained.

CGRectMake 4 Lines with horizontal displacement for each line?

I have a method:

-(void) generateButtons {
int positionsLeftInRow = BUTTONS_PER_ROW;
int j = 0;

for (int i = 0; i < [self.Model.buttons count]; i++) {
    NSInteger value = ((Model *)self.Model.buttons[i]).value;

    ButtonView *cv = [[ButtonView alloc] initWithFrame:CGRectMake((i % BUTTONS_PER_ROW) * 121 + (i % BUTTONS_PER_ROW) * 40 + 205, j * 122 + j * 40 + 320, 125, 125) andPosition:i andValue:value];

    if (!((Model *)self.Model.buttons[i]).outOfPlay) {
        [self.boardView addSubview:cv];


        if ([self.Model.usedButtons containsObject: self.Model.buttons[i]]) {

            [self.usedButtons addObject: cv];

            [cv flip];

        }
    }

    if (--positionsLeftInRow == 0) {
        j++;
        positionsLeftInRow = BUTTONS_PER_ROW;
    }
}

}

So, my question is, how to make a horizontal displacement for each line, that the second line is displaced from 1st and 3rd for example.

Can't quite get my CGAffineTransform animation correct

I am trying to rotate a view around a semi-circle and I have the positioning and rotation of the view correct, however when I try the animation, everything gets screwed up.

Here is my code for the initial placement of the pointer:

CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
transform = CGAffineTransformRotate(transform, radians);
self.pointerView.transform = transform;

I figured the code for the animation would be pretty much the same thing, but with an animation block, but the view to animate starts way off to the right where it is supposed to be and animates to the correct position. Not sure what I am doing wrong. Here is the animation code:

[UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionCurveEaseIn animations:^{
           CGAffineTransform atransform = CGAffineTransformMakeTranslation(x, y);
            self.pointerView.transform = CGAffineTransformRotate(atransform, radians);
        } completion:NULL];

Create API Class to handle JSON Data Swift

I'm extremely new to handling JSON Data in Swift, and almost just as new to Swift. In a Playground I wrote a whole bunch of code that parsed JSON Data out.

However I realized I don't want to copy and paste this code into every view controller that uses only some of the data. I want to create a custom class that handles the json data.

Here is a bit of my code:

var status: String!
var message: String!
var code: Int!
var dataArray: [NSDictionary]!
var responseCode: String!


var url: NSURL!
var session: NSURLSession!



url = NSURL(string: "http://ift.tt/1zyLZhE")

session = NSURLSession.sharedSession()


let task = session.dataTaskWithURL(url!, completionHandler: { data, response, error -> Void in
if (error != nil) {
    // println(error)

} else {
    let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary




    status = jsonResult["status"] as! String
    message = jsonResult["message"] as! String
    code = jsonResult["code"] as! Int
    dataArray = jsonResult["data"] as! [NSDictionary]


}

})
task.resume()

I then attempted to create a class like this:

class JsonClass {

var status: String!
var message: String!
var code: Int!
var dataArray: [NSDictionary]!
var responseCode: String!


var url: NSURL!
var session: NSURLSession!


init() {
 url = NSURL(string: "http://ift.tt/1zyLZhE")

session = NSURLSession.sharedSession()


let task = session.dataTaskWithURL(url!, completionHandler: { data, response, error -> Void in
if (error != nil) {
    // println(error)

} else {
    let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary




    status = jsonResult["status"] as! String
    message = jsonResult["message"] as! String
    code = jsonResult["code"] as! Int
    dataArray = jsonResult["data"] as! [NSDictionary]


}

})
task.resume()


}

I thought that within a new class I would be able to do something like this:

let jsonAPI = JsonClass()
println(jsonAPI.status)
println(jsonAPI.message)

etc...

However, any attempt to access an instance of the JsonClass results in every JsonClass property having a value of nil.

What are my next steps to accessing this data using instances of this class?