日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

ios uiview 如何刷新_ios – 从另一个UIViewController刷新表

發(fā)布時間:2025/3/19 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ios uiview 如何刷新_ios – 从另一个UIViewController刷新表 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

選項1

@類2

@property (nonatomic) BOOL shouldRefresh; // in .h file

- (void)viewWillAppear:(BOOL)animated // in .m file

{

[super viewWillAppear:animated];

if (_shouldRefresh) [self.tableView reloadData];

}

@ Class1的

// Add this in any method where you want it to refresh and push to view

ClassTwoController *viewController = [[ClassTwoController alloc] init];

[viewController setShouldRefresh:YES];

[self.navigationController pushViewController:viewController animated:YES];

*更新:

選項2

@Class 2

// Add this line in viewDidLoad in same class you want the tableView to refresh

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshTableWithNotification:) name:@"RefreshTable" object:nil];

// Add this method just beneath viewDidLoad:

- (void)refreshTableWithNotification:(NSNotification *)notification

{

[self.tableView reloadData];

}

@ Class1的

// Call this when ever you want to refresh the tableView in Class2

[[NSNotificationCenter defaultCenter] postNotificationName:@"RefreshTable" object:nil userInfo:nil];

總結(jié)

以上是生活随笔為你收集整理的ios uiview 如何刷新_ios – 从另一个UIViewController刷新表的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。