Tar*_*run 49 iphone cocoa-touch
我需要将nsindexpath var转换为NsInteger或简单地转换为int.例如:
int rowIndex = [mGoogleBaseTable selectedRow];
//mGoogleBaseTable is a NSTable type in Macdevelopement..
Run Code Online (Sandbox Code Playgroud)
&&
int rowIndex = [mGoogleBaseTable indexPathForSelectedRow];
//mGoogleBaseTable is a UITableView type in Iphone (iOS)Development.
Run Code Online (Sandbox Code Playgroud)
selectedRow返回NSInteger,但indexPathForSelectedRow返回NSIndexPath ..
请帮助我如何实现这一目标.
mvd*_*vds 128
如果
NSIndexPath *p = ... // some indexpath
Run Code Online (Sandbox Code Playgroud)
然后
NSInteger row = p.row;
NSInteger section = p.section;
Run Code Online (Sandbox Code Playgroud)
就这样!
在Swift中:
let section: Int = indexPath.section
let row: Int = indexPath.row
Run Code Online (Sandbox Code Playgroud)
小智 7
我更喜欢这样做
NSNumber *selRow = [[NSNumber alloc] initWithInteger:indexPath.row];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
57165 次 |
| 最近记录: |