我想从UIAlertView按钮调用一个通过presentModalViewController的视图。代码如下,NSlog显示在控制台中,所以我知道代码执行确实达到了这一点。此外,没有错误或任何显示:UIAlertView clickedButtonAtIndex with presentModalViewController
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex != [alertView cancelButtonIndex])
{
NSLog(@" The username is: %@ AND the password is: %@ ",textField.text,passTextField.text);
// do some logic in here later
CompanyViewController *companyViewController = [[[CompanyViewController alloc] initWithNibName:@"CompanyViewController" bundle:nil] autorelease];
[self presentModalViewController:companyViewController animated:YES];
}
[textField resignFirstResponder];
[passTextField resignFirstResponder];
}
*****编辑:上面的方法属于一个UIViewController。以下是接口文件:
@interface testingViewController : UIViewController <UITextFieldDelegate>
{
UITextField *textField;
UITextField *passTextField;
}
@property (nonatomic, retain) UITextField *textField;
@property (nonatomic, retain) UITextField *passTextField;
@property (readonly) NSString *enteredText;
@property (readonly) NSString *enteredPassword;
@end
任何帮助表示赞赏。
请问这种方法属于视图或视图控制器? – 2010-03-13 23:17:21
是您的名为CompanyViewController.nib或CompanyView.nib的nib吗? (我用'initWithNibName'自己犯了几次错误)。 – 2010-03-14 06:17:21
嗨。我只加倍检查了我的项目 - 笔尖是CompanyViewController.nib。谢谢你的评论。 – CraigH 2010-03-14 06:36:58