TAILIEUCHUNG - Phát triển ứng dụng cho iPhone và iPad - part 10

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 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.