[英]UITableView Rows selection with UIPicker Option
I have a tableview
with 5 rows, when I select a row it opens a UIPickerView
in the next page to select options,the same things happen with 5 rows.Now I want ,The Pickervalue, It should be reflected on particular Row(right side) whichever I selected 我有一个包含5行的
tableview
,当我选择一行时,它会在下一页打开一个UIPickerView
来选择选项,同样的事情发生在5行上。 )无论我选择了哪个
and I have a button on the same page to perform on the selected rows values(UIPicker values).How to give options in Button.to select the Rows values which is been taken from UIPicker
我在同一页面上有一个按钮来对选定的行值(UIPicker值)执行。如何在Button.to中给出选项以选择从
UIPicker
获取的行数
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row==0){
Picker1 *logInController = [[Picker1 alloc] init];
[[self navigationController] pushViewController:logInController animated:YES];
}
if(indexPath.row==1){
Picker2 *logInController = [[Picker2 alloc] init];
[[self navigationController] pushViewController:logInController animated:YES];
}
}
like above I have opened the UIPIcker
and select the options. 像上面一样,我已经打开了
UIPIcker
并选择了选项。
IN PICKER1.m 在PICKER1.m
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
// update label text to show selected option
NSString* string=[NSString stringWithFormat:@"you are selected %@",[list objectAtIndex:row]];
label.text=string;
}
- (void)viewDidLoad
{
[super viewDidLoad];
list =[[NSMutableArray alloc]init];
[list addObject:@"GPS"];
[list addObject:@"NONE"];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.