Tuesday 15 March 2011

ios - Getting string value of indexPath.row -


What is the difference between these two methods to get string value of indexed path.

  Override Function TableView (TableView: UITableView, CellForUroutAndExpath IndexPath: NSIndexpath) - & gt; UITableViewCell {var newString: String = String (indexPath.row) var newString2: string = indexPath.row.description}}  

description property is used to represent any NSObject or the content of any class / structure / enum printable protocol and though Int ( indexPath.row is in the case of int ) it is just string Lets change the string To change the int , should never be used . It is possible that things like Swift description will be returned in future versions of "int: [value"]. Instead you should use the string (indexPath.row) .


No comments:

Post a Comment