2010-12-08 45 views
2

我的問題是我如何顯示所選項目的值在NSLog中的UITableView (索引或文本值) 我想測試此值以選擇正確的視圖 謝謝您的幫助如何顯示indexPath值

回答

13

NSIndexPath具有方便INT性質(部分,行)與UITableView的使用情況,您可以登錄他們如下:

NSLog(@"Section: %d, Row: %d", indexPath.section, indexPath.row); 
+0

非常感謝你弗拉基米爾先生 – user82 2010-12-08 10:06:25

2

你可以使用

NSLog (@"%@", indexPath); 

,或者如果你是通過你的indexPath到NSIndexPath變量你可以用你的變量名稱替換indexPath

NSLog (@"%@", myIndexPath); 

你的輸出應該是這樣的

2011-10-07 09:32:16.996 myCode[3439:207] <NSIndexPath 0x4e3aeb0> 2 indexes [0, 3] 
2011-10-07 09:32:16.997 myCode[3439:207] <NSIndexPath 0x4e3aeb0> 2 indexes [0, 3] 

[節,排]