Problem description: A list application is created. You only need to press the button to add the string to the mutable array. However, after the code is run, click the button and only the last array is successfully added. [Plain]-(IBAction) notebutton :( UIButton *) sender {NSMutableArray * mystr = [[NSMutableArray alloc] init]; NSString * name = _ noteField. text; [mystr addObject: name]; [self. tableView reloadData];} solution: this is because every time you click this button, the NSMutableArray object [plain]-(IBAction) notebutton (UIButton *) will be re-created *) sender {NSMutableArray * mystr = [[NSMutableArray alloc] init]; how can this problem be solved? You only need to put * mystr declaration in the header file and define it as an attribute or private variable. For example, [plain] @ interface yourClass: NSObject {NSMutableArray * mystr;} @ end in. initialize NSMutableArray [plain] @ implementation yourClass-(id) init {if (self = [super init]) {mystr = [[NSMutableArray alloc] initWithCapacity: 0] autorelease] ;}}@ end after completing these two steps, you can directly go to-(IBAction) notebutton :( UIButton *) sender {NSString * name = _ noteField. text; [mystr addObject: name]; [self. tableView reloadData];}