如何添加一個新值到預定義數組的uitableview,同時單擊添加按鈕?將值添加到預定義的數組爲uitableview iphone
-(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;
}
你想在UITableView的一些具體指標添加對象? – 2012-08-11 06:19:58