xcode - Reading NSUserDefault key data into UITableView -
how can read/load data key uitableview? when run println(keydata1)
output [data1, data2, data3]
. how can add data uitableview? uiviewtable read data "var minespillere
".
this how read data:
if let testarray : anyobject? = nsuserdefaults.standarduserdefaults().objectforkey("yourkey") { var readarray : [nsstring] = testarray! as! [nsstring] println(readarray) // here want add "readarray" uitableview. }
maybe this:
var minespillere = readarray // make minespiller same readarray?
in table view's data source (which uitableviewcontroller
contains table, can class implements uitableviewdatasource
), override
numberofsectionsintableview()
(in case, should return 1
);
tableview(_, numberofrowsinsection:)
return size of nsuserdefaults
array; ,
tableview(_, cellforrowatindexpath:)
return uitableviewcell
you've configured display user defaults value.
Comments
Post a Comment