How to convert int to nsindexpath? [duplicate] How to convert int to nsindexpath? [duplicate] swift swift

How to convert int to nsindexpath? [duplicate]


See the NSINdexPath UIKit Additions

In your case you can use (Swift):

let indexPath = NSIndexPath(forRow: 0, inSection: 0)

Swift 3.0:

let indexPath = IndexPath(row: 0, section: 0)


Duplicate of This post

I copied the recieved answer here

For an int index:

NSIndexPath *path = [NSIndexPath indexPathWithIndex:index];

Creates Index of the item in node 0 to point to as per the reference.

To use the indexPath in a UITableView, the more appropriate method is

NSIndexPath *path = [NSIndexPath indexPathForRow:yourInt inSection:section];


You can get indexpath using below code

NSIndexPath *index = [NSIndexPath indexPathForRow:YOURINTSTORED inSection:0];