tags:

views:

28

answers:

1

I have a UIPickerView object that has five rows that a user can select. I want to return the index of the row that the user selects on IBAction. When my method is called, I can return the text of the value of what the user selected with this code: NSString * userChoice = [self pickerView:picker titleForRow:[picker selectedRowInComponent:0] forComponent:0]; I want to now return as an NSInteger, the row that is returned. The following code kills the program and I don't know why: NSLog(@"hello?? %@", [picker selectedRowInComponent:0]);

Any thoughts?? Is there a better method to use besides selectedRowInComponent?

+1  A: 

try this

NSLog(@"hello?? %d", [picker selectedRowInComponent:0]);
Aaron Saunders
That worked. Thanks. I thought that %@ can be used for any object, apparently not for NSIntegers.
ternto333
Here's a complete list of format specifiers:http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html
Kurbz
can you please accept the answer if you found it useful? thanks
Aaron Saunders