UITableView doesn't keep row selected upon return

后端 未结 7 1008
独厮守ぢ
独厮守ぢ 2020-12-17 21:05

i have several table views in my app. I am familiar with the usual behaviour of tables, that when you select a row and progress to a pushed view, it turnes blue, then when y

7条回答
  •  感动是毒
    2020-12-17 21:40

    Its a feature you can turn off.

    In the UITableViewController you can call

    [ self setClearsSelectionOnViewWillAppear:NO ];
    

    This is directly from the file "UITableViewController.h". This feature is documented there.

       @property(nonatomic) BOOL clearsSelectionOnViewWillAppear __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_2); 
    // defaults to YES. If YES, any selection is cleared in viewWillAppear:
    

提交回复
热议问题