0
當我添加一個新行時,它當前添加一個新行,並將當前日期作爲標題。以下是我的代碼。我該如何改變「NSDate date」,以便用戶可以輸入他們想要的任何標題?如何用可寫標題替換日期?
(void)insertNewObject:(id)sender
{
if (!_objects) {
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:[NSDate date] atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
看起來你已經生成在Xcode默認MasterViewController項目。我會建議尋找在UITableView的教程或者是iOS上讀一本書發展,也許有人可以推薦一個。 –