我有这个代码:
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
NSDictionary *data = [list1 objectAtIndex:row];
NSNumber *strt = [data objectForKey:@"ab1"];
NSNumber *strt2 = [data objectForKey:@"ab1"];
forlb1 = [NSString stringWithFormat:@"%d", strt.intValue];
forlb2 = [NSString stringWithFormat:@"%d", strt2.intValue];
NSDictionary *xt = [list1 objectAtIndex:row];
NSString *name = [xt objectForKey:@"name"];
NSDictionary *xx = [list1 objectAtIndex:row];
NSString *name2 = [xx objectForKey:@"name"];
switch (component)
{
case 0:
show1 = name;
label1.text = forlb1;
break;
case 1:
show2 = name2;
label2.text = forlb2;
break;
}
}
- (IBAction)goView:(id)sender
{
if (label1.text < labe2.tex)
{
ViewController1 *first = [[ViewController1 alloc]init];
first.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:first animated:YES];
}
else
{
ViewController3 *third = [[ViewController3 alloc]init];
third.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:third animated:YES];
}
}
我的问题是:如果我的 label1.text < label2.text 我无法获得 ViewController3
当我从 Picker 视图的组件 1 中选择时,我的一个标签显示名称,另一个标签显示一个数字,同样的事情发生在 Picker 视图的组件 2 上,现在没问题,但是当我应该触摸按钮时,我需要去viewcontroller 1或viewcontroller 2,取决于:label1.text < label2.text
请帮帮我。