【发布时间】:2014-04-23 19:05:46
【问题描述】:
如果代码与内部定义的代码匹配,我希望应用程序继续。 因此,如果我在文本字段中输入代码,则不会发生任何事情。 你们中的任何人可能对我有一些解决方案吗?
这就是我目前在 ViewController 的 .m 文件中得到的内容
@interface mainViewController ()
@property (weak, nonatomic) IBOutlet UITextField *zahlencode;
@property (weak, nonatomic) IBOutlet UIButton *done;
@property NSMutableArray *codes;
@end
@implementation mainViewController
- (void)loadInitialData {
Code *item1 = [[Code alloc] init];
item1.Code = @"1";
[self.codes addObject:item1];
}
int a,b,c,zz;
a=1;
b=2;
c=3;
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if (sender != self.done)
return;
if (self.zahlencode.text.length > 0)
{
zz =[self.zahlencode.text intValue];
if(zz == a)
{
[self performSegueWithIdentifier:@"1"]; }
}
}
【问题讨论】:
-
prepareForSegue:sender:在performSegueWithIdentifier:之后运行。 -
但我只想判断代码是否正确。之后这也有效吗?
标签: ios objective-c storyboard segue