Tuesday, 20 August 2013

alertview with textfield gets crashed in iOS

alertview with textfield gets crashed in iOS

Am in need of using uialertview with textfield so as to pass the entered
text to a webservice integration, while the application is being running
the alertview with textfield is displayed and can enter the text in
textfield, but while clicking the submit button, the respective class is
crashed but the back button and entire application is working good.
Code which I used for the alertview with textfield,
{
//alertview with textfield
UIAlertView *message = [[UIAlertView alloc]
initWithTitle:@"Enter your changes"
message:nil
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Submit Changes", nil];
[message setAlertViewStyle:UIAlertViewStylePlainTextInput];
[message show];
}
- (void)alertView:(UIAlertView *)alertView
willDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1)
{
text = [[alertView textFieldAtIndex:0] text];
NSLog(@"passed value %@",text);
}
}

No comments:

Post a Comment