单击添加按钮时,如何向 uitableview 的预定义数组添加新值?
-(IBAction)addNewBreed:(id)sender
{
UIAlertView *addAlert=[[UIAlertView alloc]initWithTitle:@"Add New Item" message:@"\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add",nil];
UITextField *addTextField=[[UITextField alloc]initWithFrame:CGRectMake(12,45,260,25)];
[addTextField becomeFirstResponder];
[addTextField setBackgroundColor:[UIColor whiteColor]];
addTextField.clearButtonMode=UITextFieldViewModeWhileEditing;
[addAlert addSubview:addTextField];
[addAlert show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"Add"])
{
//HERE WHAT CODE SHOULD I ADD,MY ARRAY NAME 'ar'
}
else
return;
}