以编程方式枚举UIViewController的传出Segues [英] Programmatically enumerate outgoing Segues for a UIViewController

查看:104
本文介绍了以编程方式枚举UIViewController的传出Segues的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于视图控制器之间的iOS 5导航, UIViewController 类提供 [self performSegueWithIdentifier:@MySeguesender:sender] 选择器。据推测,故事板实现知道从任何视图控制器传出的segue标识符列表,即 [@MySegue,@MySegue2] 。有没有办法以编程方式访问此列表,以获取可传递给performSegueWithIdentifier的标识符?

For iOS 5 navigation between view controllers, the UIViewController Class provides [self performSegueWithIdentifier:@"MySegue" sender:sender] selector. Presumably, under the hood, the storyboard implementation knows the list of segue identifiers outgoing from any view controller, i.e. [@"MySegue", @"MySegue2"]. Is there any way to access this list programmatically, to get the identifiers that can be passed to performSegueWithIdentifier?

推荐答案

这是一个无证件行为但是

This is an undocumented behaviour but

NSArray *segueTemplates = [self valueForKey:@"storyboardSegueTemplates"] ;  

应返回一个数组,其中包含可传递给的所有可能的segue值performSegueWithIdentifier

should return an array that includes all possible segue values that can be passed to performSegueWithIdentifier.

这篇关于以编程方式枚举UIViewController的传出Segues的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆