1
我有这样的代码:比较并转到另一个视图控制器
- (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我不能让ViewController3 < label2.text
当我从部件选择1的Picker视图中,我的一个标签显示名称,另一个label1显示一个数字,Picker视图的组件2发生同样的事情,现在可以,但是当我应该触摸按钮时,我需要去viewcontroller 1或viewcontroller 2取决于:label1.text < label2.text
请帮助我。
通常我创建了一个新的2个NSString的至极是1等于label1.text和另一个与label2.text,当我比较这些nsstrings,我也没有成功。 :(我也创建了应用程序代理中的NSNumbers,这与我的标签相同,并试图比较nsnumber,也是nu成功。 – 2012-08-17 17:55:14
@iOSBeginer请看看更新。 – dasblinkenlight 2012-08-17 17:55:56
oo .. man ..非常感谢,我这篇文章非常有用,很有用,谢谢你,很高兴。 – 2012-08-17 18:00:37