xcode 4.6中的按钮操作问题

时间:2013-08-06 12:23:33

标签: iphone objective-c

我正在使用xcode 4.6,我已将iOS部署目标设置为4.3。当我在iOS模拟器6.1中构建和运行时,我能够导航到下一个viewController。但是,当我为iOS 5.0或5.1构建和运行时,按钮点击没有任何反应。有人有解决方案吗?在我的代码中看不到任何错误。这是一个常见的问题吗?

我用过

 NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];

if([self.emailTextField.text isEqualToString:@""] && [self.phoneNumberTextField.text isEqualToString:@""])
{
    UIAlertView *view = [[UIAlertView alloc] initWithTitle:@"Can't login" message:@"Email id as well as phone number is missing. Please mention atleast one info." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [view show];
}
else if([emailTest evaluateWithObject:emailTextField.text] == NO)
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Can't login" message:@"Please enter a valid email id" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [alertView show];
}

else
{
    UIViewController *profileVc = [[ProfileViewController alloc]init];

    [self.navigationController pushViewController:profileVc animated:YES];
    //[self presentViewController:profileVc animated:YES completion:nil];
}
IBAction

中的

2 个答案:

答案 0 :(得分:0)

您必须在下图enter image description here

中取消选择Xib中的已取消选项选项

或者您可以将cancelsTouchesInView = NO设置为您的手势属性。

答案 1 :(得分:0)

如果您正在使用手势识别器,请设置此项 |

buttonGesture.cancelsTouchesInView = NO;

然后你就可以按下按钮了。

干杯