我有一个UIPickerView对象,有五行供用户选择.我想返回用户在IBAction上选择的行的索引.当我的方法被调用时,我可以返回用户使用此代码选择的值的文本:
NSString * userChoice = [self pickerView:picker titleForRow:[picker selectedRowInComponent:0] forComponent:0];
我现在想要作为NSInteger返回,返回的行.以下代码杀死了程序,我不知道为什么:
NSLog(@"hello?? %@", [picker selectedRowInComponent:0]);
有什么想法吗??除了selectedRowInComponent之外还有更好的方法吗?
试试这个
NSLog(@"hello?? %d", [picker selectedRowInComponent:0]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5554 次 |
| 最近记录: |