Ios 刷新视图控制器?
我的故事板项目中有两个ViewController。单击ViewcontrollerOne中的tableview行后,它将通过向viewcontrollerTwo中的标签传递值和settext来显示该行的内容。但是,当我尝试第三个viewcontroller时,单击按钮“是第三个viewcontroller”,我会发送具有不同值的相同arrayname,但它不会显示在viewcontrollerTwo的标签中 为什么??如何在viewdidload或移动到viewcontrollerTwo时刷新viewcontroller 目前,我将此代码添加到viewcontrollerTwo的Ios 刷新视图控制器?,ios,xcode,uiviewcontroller,refresh,uilabel,Ios,Xcode,Uiviewcontroller,Refresh,Uilabel,我的故事板项目中有两个ViewController。单击ViewcontrollerOne中的tableview行后,它将通过向viewcontrollerTwo中的标签传递值和settext来显示该行的内容。但是,当我尝试第三个viewcontroller时,单击按钮“是第三个viewcontroller”,我会发送具有不同值的相同arrayname,但它不会显示在viewcontrollerTwo的标签中 为什么??如何在viewdidload或移动到viewcontrollerTwo时刷新
viewDidLoad:
方法中
[self.view setNeedsDisplay]
您可以将视图控制器放入
应用程序IDBECOMEACTIVE
[yourcontroller reloadInputViews];
但是,为什么不在使用相同的tableview时重新加载tableview呢 您始终可以使用NSNotificationCenter更新父视图控制器 在父视图控制器上,放置以下内容:
//since child view controller calls turnItOff, notification center calls function "turnButtonCountinuesOff"
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(turnButtonCountinuesOff) name:@"turnItOff" object:nil];
//connect to parent UI view controller calls notification turnItOff.
[[NSNotificationCenter defaultCenter] postNotificationName:@"turnItOff" object:nil];
TurnButtonCountNuesOff是父视图控制器的功能
在您的子视图控制器上,放置以下内容:
//since child view controller calls turnItOff, notification center calls function "turnButtonCountinuesOff"
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(turnButtonCountinuesOff) name:@"turnItOff" object:nil];
//connect to parent UI view controller calls notification turnItOff.
[[NSNotificationCenter defaultCenter] postNotificationName:@"turnItOff" object:nil];
希望有帮助。您需要发布代码。如果您愿意,也可以调用[yourcustomcontroller.tableView reloadData];