开发者

how to display the indexPath value

开发者 https://www.devze.com 2023-01-30 00:52 出处:网络
my question is how can i display the value of the selected item in a UITableView (index or the text value) in NSLo开发者_Python百科g

my question is how can i display the value of the selected item in a UITableView (index or the text value) in NSLo开发者_Python百科g i want to test on this value to select the right view thanks for your help


NSIndexPath has convenience int properties (section, row) for usage with UITableView, you can log them as follows:

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


you can just use

NSLog (@"%@", indexPath); 

or if you are passing your indexPath to a NSIndexPath variable you can just replace indexPath with your variable name

NSLog (@"%@", myIndexPath);

your output should look like this

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]

[Section, row]

0

精彩评论

暂无评论...
验证码 换一张
取 消