I have implemented code for alert view with textfield here when i click on ok button the textfield entered value is storing in string formate as (str) and i am adding that value to the array in order to i am loading array to the table view but here problem is every time table view consists one item but i want store multiple items entering items from alert and save it as array item for this how to implement code for saving multiple array items through the alertview any one help me to solve this problem in iphone.
myAlert = [[UIAlertView alloc] initWithTitle:@"Enter year"
message:@"alert message"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Ok", nil];
[myAlert addTextFieldWithValue:@"" label:@"entervalue"];
alertTextField=[myAlert textFieldAtIndex:0];
alertTextField.keyboardType=UIKeyboardTypeAlphabet;
alertTextField.clearsOnBeginEditing=YES;
alertTextField.clearButtonMode=UITextFieldViewModeWhileEditing;
alertTextField.keyboardAppearance=UIKeyboardAppearanceAlert;
[myAlert show];
[myAlert release];
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"Ok"]) {
str = alertTextField.text;
[savedarray addObject:str];
}
}
Hope, this will help you..