开发者

Picker in UINavigationController

i use a UIPickerView in my root view of UINavigationController . And i used one button, when i pressed it, pass the data(shows in picker) to the next level view of navigation controller. How should i do this? Thank you!

And can you tell me the right way 开发者_如何学编程to manage data or share data among multi-viewControllers. Thanks.


Make the UINavigationController is the delegate of the UIPickerView. And save the data when scroll the picker in this method:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;{  ...NSString * passedString = [myArray objectAtIndex:row];...}

After that when the button was pressed, pass the "passedString" into next viewController.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜