I can't get my UITableView to reload data in swift

JwL

I'm using a UITableView to list a number of settings with the state of that setting displayed in the cell title. When the cell is selected it segues to another view where I change the setting. I use a navigation control to go back to the UITableView however I'm unable to update the table

class OptionTable: UITableViewController{

var table : [[String:AnyObject]] = []
var data = NSMutableDictionary()

func dataFilePath() -> String {
    let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
    let documentsDirectory = paths[0] as NSString
    return documentsDirectory.stringByAppendingPathComponent("data.plist") as String
}

override func viewDidLoad() {
    super.viewDidLoad()
    data = NSMutableDictionary(contentsOfFile: self.dataFilePath())!
    table = data["table"] as [[String:AnyObject]] 
}
override func viewWillAppear(animated: Bool) {

    self.tableView.reloadData()

}

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return table.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var rowTable : Dictionary = table[indexPath.row]
        cell.textLabel?.text = rowTable["Title"] as? String

        return cell
    }
}

The data is getting saved in the plist its just not being reloaded when I open the UITableView back up. The table does get reloaded when I go back another page then forwards again to the UITableView.

Why is self.tableView.reloadData() not working??? Any help would be greatly appreciated.

Rob

You may be saving the to the plist, but viewDidAppear is not loading it before refreshing the tableView.

Move the loading of the plist into viewDidAppear.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

I can't get an answer out of my C++ program

분류에서Dev

I can't get my Wacom Intuos to work in Ubuntu at all

분류에서Dev

Why can't I convert DynamicJson to my class if I don't write {get; set;}

분류에서Dev

How i can get the td data getting from css to attach to my current row ,and use for my logic

분류에서Dev

how can i get my local DB data to fill my txt box using LINQ?

분류에서Dev

Can I get data from my MSSql server and upload it to app engine via some python scripts?

분류에서Dev

How I can get back at the beginning of my code, when statement isn't meet?

분류에서Dev

R: I can't convert all my data.frame columns in factors using do.call

분류에서Dev

Can't get Google Maps to initialize Swift

분류에서Dev

I can't update my rails form

분류에서Dev

I can't display my table (codeigniter)

분류에서Dev

I can't exit my local network

분류에서Dev

My Intent.Extras is always null when I click a notification. How can I get the Intent data?

분류에서Dev

How can I set a UITableView's cell text to database cell's content in Swift?

분류에서Dev

can i save data of an my app user in a file not data base

분류에서Dev

RAILS 3: How can I reload a partial?

분류에서Dev

Xcode Swift change data uitableview on sidemenu

분류에서Dev

Can't get Fibrous to work and sync my code

분류에서Dev

Can't get javascript working (beginner) - please check my code

분류에서Dev

Can't get my second network card to work on ubuntu server

분류에서Dev

I can fetch my entities that I save only on the first launch. If I relaunch the app, I can't fetch my entities

분류에서Dev

How can I get my external IP address in a shell script?

분류에서Dev

How can I get the text in the bottom left of my buttons?

분류에서Dev

How can i get my query execution time in logging

분류에서Dev

How can I get javascript to write dates in my input boxes?

분류에서Dev

How can I get my SSDs write speeds to perform normally?

분류에서Dev

Python: How can I read csv and clean my data in a loop

분류에서Dev

How can i transpose my json data horizontally using ruby

분류에서Dev

Can I transfer private data of my Android application to inspect?

Related 관련 기사

  1. 1

    I can't get an answer out of my C++ program

  2. 2

    I can't get my Wacom Intuos to work in Ubuntu at all

  3. 3

    Why can't I convert DynamicJson to my class if I don't write {get; set;}

  4. 4

    How i can get the td data getting from css to attach to my current row ,and use for my logic

  5. 5

    how can i get my local DB data to fill my txt box using LINQ?

  6. 6

    Can I get data from my MSSql server and upload it to app engine via some python scripts?

  7. 7

    How I can get back at the beginning of my code, when statement isn't meet?

  8. 8

    R: I can't convert all my data.frame columns in factors using do.call

  9. 9

    Can't get Google Maps to initialize Swift

  10. 10

    I can't update my rails form

  11. 11

    I can't display my table (codeigniter)

  12. 12

    I can't exit my local network

  13. 13

    My Intent.Extras is always null when I click a notification. How can I get the Intent data?

  14. 14

    How can I set a UITableView's cell text to database cell's content in Swift?

  15. 15

    can i save data of an my app user in a file not data base

  16. 16

    RAILS 3: How can I reload a partial?

  17. 17

    Xcode Swift change data uitableview on sidemenu

  18. 18

    Can't get Fibrous to work and sync my code

  19. 19

    Can't get javascript working (beginner) - please check my code

  20. 20

    Can't get my second network card to work on ubuntu server

  21. 21

    I can fetch my entities that I save only on the first launch. If I relaunch the app, I can't fetch my entities

  22. 22

    How can I get my external IP address in a shell script?

  23. 23

    How can I get the text in the bottom left of my buttons?

  24. 24

    How can i get my query execution time in logging

  25. 25

    How can I get javascript to write dates in my input boxes?

  26. 26

    How can I get my SSDs write speeds to perform normally?

  27. 27

    Python: How can I read csv and clean my data in a loop

  28. 28

    How can i transpose my json data horizontally using ruby

  29. 29

    Can I transfer private data of my Android application to inspect?

뜨겁다태그

보관