Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 10', 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ả | Customizing the TableView 59 c UITableViewCellStyleValue2 d UlTableViewCellStyleSubtitle FIGURE 3-1 TableView Cell Styles On the line where you initialize the cell change the code to use UITableViewCellStyleValue1 cell UITableViewCell alloc initWithStyle UITableViewCellStyleValue1 reuseIdentifier CellIdentifier autorelease The table now displays the part name and the manufacturer as shown in Figure 3-1 b . 60 I CHAPTER 3 DISPLAYING YOUR DATA THE UITABLEVIEW Changing the default to UITableViewCellStyleValue2 results in a table that looks like Figure 3-1 c . Changing the default to UITableViewCellStyleSubtitle results in a table that looks like Figure 3-1 d . Now you add some images to the catalog items. You can obtain the images used in the example from the book s web site. Add the images to your application by right-clicking on the Resources folder in the left-hand pane of Xcode and select Add Existing Files. Next you should add code to the tableView cellForRowAtIndexPath method that will look for the image in the application bundle using the image name from the database. ONSString filePath NSBundle mainBundle pathForResource ofType @ png dowrdoadmi UIImage image UIImage imageWithContentsOfFile filePath image Finally you can add an accessory to each cell. The accessory is the little arrow on the right side of a cell that tells the user that selecting the cell will take him or her to another screen. To add the accessory you need to add a line of code to the tableView cellForRowAtIndexPath method to configure the cell s accessoryType UITableViewCellAccessoryDisclosureIndicator There are a few different accessory types that you can use UITableViewCellAccessoryDisclosureIndicator is the gray arrow that you have added. This control doesn t respond to touches and is used to indicate that selecting this cell will bring the user to a detail screen or the next screen in a navigation .