开发者

Picker in UINavigationController

开发者 https://www.devze.com 2022-12-28 23:24 出处:网络
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 d

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

精彩评论

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

关注公众号