if (self.txtusername.text.isEmpty)
{
(UIAlertView(title: "Fields cant be empty", message: "Please Enter username and password",
delegate: nil, cancelButtonTitle: "OK").show())
self.dismissViewControllerAnimated(true, completion: nil)
}
else if (range==nil)
{
(UIAlertView(title: "Invalid Email Id", message: "Type mail id like xxx@yyy.zzz", delegate: nil, cancelButtonTitle: "OK").show())
self.dismissViewControllerAnimated(true, completion: nil)
}
我在登录时使用此代码提醒用户,但警报消息弹出到我下次看到的... 我想在登录页面中发出警报,它不应该显示我的下一个屏幕如何做到这一点?
答案 0 :(得分:0)
就这样做
if(responseData != "\"Valid user\"")
{
var alertView:UIAlertView = UIAlertView()
alertView.title = "Failed"
alertView.message = responseData
alertView.delegate = self
alertView.addButtonWithTitle("OK")
alertView.show()
//self.dismissViewControllerAnimated(true, completion: nil)
//let vc = LoginController()
return;
}
可以很轻松地帮助你。
HTH,享受编码!!
答案 1 :(得分:0)
试试这段代码。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Fields cant be empty"
message:@"Please Enter username and password"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alert show];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex (NSInteger)buttonIndex**
{
if (buttonIndex == 0){
//your code...
}
else{
NSLog(@"cancel");
}
}