Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert int to nsindexpath? [duplicate]

Tags:

I am making a basic quiz application.The choices are in the form of a table view. If the user moves to a previous question, I want to show him his previously selected choice. I have stored the choice in NSUserDefaults. How do I convert this int value to NSIndexpath and use it in my tableview?

like image 453
Adam Young Avatar asked Apr 03 '15 07:04

Adam Young


1 Answers

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)
like image 145
zisoft Avatar answered Sep 28 '22 21:09

zisoft