I am asking for an Value like this:
[self.layer valueForKeyPath:@"transform.rotation.z"]
bit I need to pass it to a method which takes a CGFloat as parameter. What's the casting trick here?
I am asking for an Value like this:
[self.layer valueForKeyPath:@"transform.rotation.z"]
bit I need to pass it to a method which takes a CGFloat as parameter. What's the casting trick here?
Try
NSNumber* n = [self.layer valueForKeyPath:@"transform.rotation.z"];
CGFloat f = [n floatValue];
If you wanted a more concise, one line way to do that, you can do:
CGFloat f = [[self.layer valueForKeyPath:@"transform.rotation.z"] floatValue];