Reputation: 29326
destination.wordsPerMinute = [NSNumber numberWithInt:(int)[self.wpmSlider.value]];
I'm accessing the view controller I'm segueing to's wordsPerMinute property (an NSNumber) and setting it equal to an NSNumber converted from an int, which was a float cast as an int.
Upvotes: 1
Views: 101
Reputation: 19249
With new compilers (XCode 4.5+):
destination.wordsPerMinute = @((int)self.wpmSlider.value);
Otherwise:
destination.wordsPerMinute = [NSNumber numberWithInt:self.wpmSlider.value];
Upvotes: 1
Reputation: 46563
You can use (in new compilers)
destination.wordsPerMinute = @(self.wpmSlider.value);// [NSNumber numberWithInt:(int)[self.wpmSlider.value]];
If you want to convert it into integer value then :
destination.wordsPerMinute = @((int)self.wpmSlider.value);
Upvotes: 1
Reputation: 100751
Remove the [] brackets around self.wpmSlider.value
The compiler expects a method name as identifier here (like numberWIthInt: in the outer method call)
Upvotes: 1
Reputation: 11444
You don't need the brackets around [self.wpmSlider.value]
.
Or use
[self.wpmSlider value]
Upvotes: 4