エラーメッセージ:
「int」から「NSIndexPath *」へのキャストは、ARC では許可されていません
コード:
NSInteger CurrentIndex;
[self tableView:(UITableView *)horizontalTableView1 didSelectRowAtIndexPath:(NSIndexPath *)int_CurrentIndex];
このエラーを修正するにはどうすればよいですか?
エラーメッセージ:
「int」から「NSIndexPath *」へのキャストは、ARC では許可されていません
コード:
NSInteger CurrentIndex;
[self tableView:(UITableView *)horizontalTableView1 didSelectRowAtIndexPath:(NSIndexPath *)int_CurrentIndex];
このエラーを修正するにはどうすればよいですか?
You can't cast an int variable to an NSIndexPath directly. But you can make an NSIndexPath from an int variable.
You need a section index and row index to make an NSIndexPath. If your UITableView has only one section then:
Objective-C
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
Swift
let indexPath: NSIndexPath = NSIndexPath(forRow: rowIndex, inSection: 0)
Swift 4
let indexPath = IndexPath(row: rowIndex, section: 0)