UIAlertView clickedButtonAtIndex with presentModalViewController

Posted by Vivas on Stack Overflow See other posts from Stack Overflow or by Vivas
Published on 2010-03-13T23:03:43Z Indexed on 2010/03/14 6:15 UTC
Read the original article Hit count: 387

Hi,

I am trying to call a view via presentModalViewController from a UIAlertView button. The code is below, the NSlog is displayed in the console so I know that code execution is indeed reaching that point. Also, there are no errors or anything displayed:

- (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];

}

* Edit: The method above belongs to a UIViewController. Below is the interface file:

@interface testingViewController : UIViewController  <UIAlertViewDelegate,  UITextFieldDelegate>
{
UITextField *textField;
UITextField *passTextField;
}
@property (nonatomic, retain) UITextField *textField;
@property (nonatomic, retain) UITextField *passTextField;
@property (readonly) NSString *enteredText;
@property (readonly) NSString *enteredPassword;

@end

Any help is appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uialertview