- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个searchController,它有一个searchResultsController。当我在搜索栏中搜索时,结果 Controller 会显示搜索结果,但是当我点击其中一个单元格时,它不会显示详细 View Controller 。为了让它显示出来,我必须点击搜索栏旁边的取消按钮,当 searchResultsController 消失时,详细信息 View 就会出现。我知道正在从 subview 的父 View 上调用执行segue 函数。 searchResultsController 的 tableview 的委托(delegate)都指向 searchController。
为什么在我点击取消按钮之前 View 不会改变?
下面是一些代码:
搜索 Controller 类:
// parent view controller
- (void) showContact:(Contact*)contact
{
NSLog(@"Did tap contact id:[%@]",contact.id);
[self performSegueWithIdentifier:@"contactPressed" sender:contact];
}
- (void)contactsSearchTableDelegate:(ContactsSearchTableDelegate *)delegate
didTapContact:(Contact *)contact
{
[self showContact:contact];
}
委托(delegate)类:
// delegate, searchController and searchResultsController both point here
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.delegate contactsSearchTableDelegate:self didTapContact:[self contactAtIndexPath:indexPath]];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
最佳答案
搜索结果 Controller 是一个presented View Controller 。它的 View 覆盖了屏幕并替换了我们开始使用的 View Controller 的 View 。因此,该 View Controller 的 View 不在 View 层次结构中,我们不能离开它。因此,您的代码需要执行您现在手动执行的操作:它需要从取消搜索开始,从而关闭呈现的 View Controller ,以便我们回到第一个 View Controller 并可以从那里继续。
关于ios - 从子级调用父 View 上的 PerformSegueWithIdentifier 不会更改 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40411581/
我的主视图 Controller 位于导航 Controller 中,它符合 EditViewControllerDelegate 协议(protocol)。这是我需要以模态方式呈现的两个 View
所以我在解决以下问题时遇到了一些棘手的问题。我可以使用 performSegueWithIdentifier使用如下代码在 View Controller 之间跳转: [self performSeg
我在 iOS7 中遇到问题,我用 performSegueWithIdentifier 调用 segue (我有这样的代码,几乎可以在其他任何地方使用),然后我将 segue 记录到 prepareF
我有一个带有按钮的 View Controller ,可以通过 STTwitter 启动 Twitter 登录页面。 . shouldPerformSegueWithIdentifier函数返回 NO
-(void)loginPerform { NSLog(@"start to perform segue!"); [self performSegueWithIdentifier:@"
我只是想问一下如何执行seguewithidentifier并打开一个新 View , 当信标位于应用程序范围内时。 请帮助我并提供示例和文档。谢谢。 最佳答案 您应该查看的教程: Ray Wende
因此,我尝试在窗口加载后立即执行转场,而无需单击按钮或执行任何操作。 Segue 是从 View Controller 链接的,但不是从窗口 Controller 链接的,因为我一次只能从 Windo
我有 6 个不同的表,当选择其中一个表中的行时(在 RegionFirstTable 中,哪个表很重要),我希望它们执行 Segue。 regionsFirstTable 的代码工作正常,但至于其他部
我只是构建了一个类来正确管理我的数据库和 JSON 请求。问题是,现在我该如何执行 segue ? 这是我的代码在我看来: - (IBAction)loginClick:(id)sender {
当我点击一个按钮时,我会运行这段代码: [self performSegueWithIdentifier:@"services" sender:self]; NSLog(@"ButtonClicked
我想通过 performSegueWithIdentifier(self.segueName, sender: products) 传递类型为 [Product] 的名为 products 的数组 我
您好,我正在尝试根据用户的选择推送到不同的 View 。我有一个 TableView ,其中有 4 个其他 View Controller 通过 Storyboard中的推送 segues 链接到它。
我有这样一个问题,当我点击按钮时,performSegueWithIdentifier() 会延迟工作,大约五秒钟,但是当我返回并再次点击按钮时,它会立即工作,没有任何延迟。 我想知道是否有 perf
我正在尝试使用 segue,这是我的代码: if let status_code = response.response?.statusCode { if status_code == 200
我已经阅读了很多关于这个问题的不同帖子,但似乎没有一个解决方案适合我。 我启动了一个新的应用程序,并将初始的 ViewController 放在导航 Controller 中。我创建了第二个 View
我正在 XCode 6 上使用框架 PARSE 设置注册/登录页面。 当我尝试执行一个 segue(它拼写正确)时,悬停,应用程序崩溃,即使 segue 在 if 语句中也是如此。 代码如下: imp
简单的测试显示了 performSegueWithIdentifier 之后的方法可以执行,但是做这个假设是否安全? Apple 文档未提及此主题。 例如,下面代码块中的print 语句在测试中执行。
我有一个项目,其中有一个 Storyboard。 Storyboard包含几个 View Controller 。我将简化它并省略不必要的细节。在 Navigation Controller 中,有几
我有这段代码可以使用信标更新距离。 func updateDistance(distance: CLProximity) { UIView.animateWithDuration(0.8) {
我的应用遇到了这种奇怪的情况。我在主线程上调用 performSegueWithIdentifier : dispatch_async(dispatch_get_main_queue()){
我是一名优秀的程序员,十分优秀!