【发布时间】:2018-10-10 11:15:48
【问题描述】:
我正在尝试创建一个小应用程序,其中用户需要在正确的引脚上输入引脚,它会说正确的引脚,否则错误,但我不确定我的逻辑是否正确。我在最新的Mac 版本上使用Xcode10。
- (IBAction)validatePin:(id)sender {
[ViewController checkPin:self.textPin.text.integerValue];
}
+(BOOL)checkPin:(NSInteger)pin {
if (pin == 1408)
{
//[UIAlertController alertControllerWithTitle:@"Pin" message:@"Success" preferredStyle:UIAlertControllerStyleAlert];
[[UIAlertView alloc] initWithTitle:@"Alert Title"
message:@"are you sure?"
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
return YES;
}
[UIAlertController alertControllerWithTitle:@"Pin" message:@"Fail" preferredStyle:UIAlertControllerStyleAlert];
return NO;}
我已经尝试了UIAlertView 和UIAlertController 方法,但我没有得到对应用程序的响应。有人可以在ObjC 中更正此代码吗?
谢谢
【问题讨论】:
标签: ios objective-c xcode10