开发者

refresh uitableview on button click

开发者 https://www.devze.com 2023-02-10 21:38 出处:网络
I have 2 views in my app 1st view: tableview and button(update) 2nd 开发者_JAVA百科view: detail view

I have 2 views in my app

1st view: tableview and button(update) 2nd 开发者_JAVA百科view: detail view

I want to refresh table in 1st view when I am pressing update button.


If I understand you correctly you want to reload the data if you come back from the DetailView?

then put it in viewWillAppear: or viewDidAppear:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [tableView reloadData];
}

then connect your button in interfacebuilder or with

[yourButton addTarget:self action:@selector(reloadTableView:) forControlEvents:UIControlEventTouchUpInside];

to this method

- (IBAction)reloadTableView:(id)sender {
    [tableView reloadData];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号