Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 14', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Displaying Master Detail Data with the UISplitViewController 99 Changes to the RootViewController Now you need to move on to the RootViewController. Here you will add an NSMutableArray to hold the collection of surveys. You cannot simply use an NSArray because you will need to be able to add surveys to the collection on-the-fly. Remember NSArray is immutable meaning that once you have created it you cannot modify it. In the RootViewController header file add an instance variable called surveyDataArray of type NSMutableArray NSMutableArray surveyDataArray Add a property for your new surveyDataArray property nonatomic retain NSMutableArray surveyDataArray Switch over to the RootViewController implementation file and modify the synthesize statement to synthesize your new surveyDataArray property synthesize detailViewController surveyDataArray Modify the viewDidUnload and dealloc methods to clean up your new property O- void viewDidUnload Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. download on For example nil nil - void dealloc detailViewController release surveyDataArray release super dealloc Finally modify the viewDidLoad method to create and initialize the NSMutableArray 0- void viewDidLoad super viewDidLoad iownloadon NO CGSizeMake NSMutableArray array NSMutableArray alloc init array array release 100 I CHAPTER 4 IPAD INTERFACE ELEMENTS Modify the TableView Methods The next step is to modify the Table View datasource methods to use the surveyData array as the UITableView s datasource. First you will need to update the tableView numberOfRowsinSection method to return the number of items in the array like this J Available for download on NSInteger tableView UITableView aTableView numberOfRowsInSection NSInteger section Return the .