khung ứng dụng như chúng tôi muốn bảng để chiếm toàn bộ khu vực có sẵn cho các ứng dụng. Các phong cách được sử dụng UITableViewStylePlain. Phong cách của bảng phải được xác định trong giai đoạn khởi tạo và không thể được thay đổi sau này. | Table View 251 the application frame as we want the table to occupy the whole area available to the application. The style used is UiTabieViewStyiePiain. The style of the table must be specified during the initialization phase and cannot be changed later. If you bypass this initialization method and use the UlView s initWithFrame initializer the UITableViewStylePlain style will be used by default. To make your code readable you should always explicitly specify the table s style even if it s the default. The other table style that is available to you is UiTabieViewStyieGrouped. You learn about the other style in Section . After that we populate the array theSimpsons with the names that will be displayed inside the table. Next the data source of the table view is set to the application delegate instance. The UiTabieView s property for the data source is datasource and is declared as @property nonatomic assign id UITabieViewDataSource datasource Notice that this property uses assign rather than retain. Finally the table view is added to the main window and the main window is made key and visible. Listing The application delegate definition for a simple table view application. import Foundation import UIKit import implementation TVAppDeiegate - void appiicationDidFinishLaunching UIAppiication appiication window UlWindow aiioc initWithFrame UIScreen mainScreen bounds myTabie UITabieView aiioc initWithFrame UIScreen mainScreen .appiicationFrame styie UITabieViewstyiePiain theSimpsons NSArray arrayWithObjects Homer Jay Simpson Marjorie Marge Simpson @ Barthoiomew Bart J. Simpson @ Lisa Marie Simpson Margaret Maggie Simpson Abraham J. Simpson Santa s Littie Heiper Ned Fianders Apu Nahasapeemapetiion Ciancy Wiggum Charies Montgomery Burns nii retain self window addSubview myTabie window makeKeyAndVisibie 252 iPhone SDK 3 Programming - NSInteger tableView UITableView tableView .