Đang chuẩn bị liên kết để tải về tài liệu:
beginning iphone 3 development exploring the iphone sdk phần 5

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Một đối tượng mà thực hiện một nút, ví dụ, không nên chứa mã để xử lý dữ liệu khi nút đó là khai thác, và mã | 206 CHAPTER 8 Introduction to Table Views Setting the Indent Level The delegate can be used to specify that some rows should be indented. In the file Simple_TableViewController.m add the following method to your code just above the @end declaration pragma mark - pragma mark Table Delegate Methods - NSInteger tableView UITableView tableView indentationLevelForRowAtIndexPath NSIndexPath indexPath NSUInteger row indexPath row return row This method sets the indent level for each row to its row number so row 0 will have an indent level of 0 row 1 will have an indent level of 1 and so on. An indent level is simply an integer that tells the table view to move that row a little to the right. The higher the number the further to the right the row will be indented. You might use this technique for example to indicate that one row is subordinate to another row as Mail does when representing subfolders. When we run the application again you can see that each row is now drawn a little further to the right than the last one see Figure 8-13 . Handling Row Selection The table s delegate can use two methods to determine if the user has selected a particular row. One method gets called before the row gets selected and can be used to prevent the row from being selected or can even change which row gets selected. Let s implement that method and specify that the first row is not selectable. Add the following method to the end of Simple_TableViewController.m just before the @end declaration Figure 8-13. Each row of the table is drawn with an indent level higher than the row before it. - NSIndexPath tableView UITableView tableView willSelectRowAtIndexPath NSIndexPath indexPath NSUInteger row indexPath row Download at Boykma.Com CHAPTER 8 Introduction to Table Views 207 if row 0 return nil return indexPath This method gets passed indexPath which represents the item that s about to get selected. Our code looks at which row is about to be selected. If the row is the first row which is .

Đã 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.