如何在主 - 详细信息应用程序中从详细信息视图中打开主视图

时间:2014-03-28 04:55:18

标签: ios objective-c ipad cocoa-touch master-detail

我正在使用xcode中的master-detail iPad应用程序。

我的详细视图中有一个按钮和文本框。当用户点击button时,它会调用MasterDetailViewController

中的方法
- (IBAction)refreshButtonClicked:(id)sender {
[self.parent searchRSSWithURL:self.textBoxOutlet.text];
}

self.parentMasterDetailViewController。)此方法创建一个数组,用于填充MasterDetailViewController中的表视图,并且成功完成。

我想要做的是在点击按钮时自动打开主视图,以便可以看到tableview,我不知道如何处理。

1 个答案:

答案 0 :(得分:1)

如果您使用的是UINavigationController,那么

- (IBAction)refreshButtonClicked:(id)sender 
  {
    [self.parent searchRSSWithURL:self.textBoxOutlet.text];
    [self.navigationController popViewControllerAnimated:YES];
  }

其他明智的

- (IBAction)refreshButtonClicked:(id)sender 
  {
     [self.parent searchRSSWithURL:self.textBoxOutlet.text];
     [self dismissModalViewControllerAnimated:YES]; // OR [self dismissViewControllerAnimated:YES completion:nil];
  }
相关问题