如何从MainStoryboard为UIViewController分配标识符? [英] How to assign an identifier to a UIViewController from the MainStoryboard?

查看:197
本文介绍了如何从MainStoryboard为UIViewController分配标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我以前使用initWithNibName分配和初始化视图控制器之前,其中Nib名称的参数只是xib/nib文件的名称.

Before I used to allocate and initialize a view controller using initWithNibName, where the parameter for the Nib name is simply the name of the xib/nib file.

但是,现在Xcode/IB与Storyboard一起使用的方式,我不确定用各自的xib/nib初始化视图控制器类需要做什么.

However, with the way Xcode/IB works with Storyboards now, I'm not sure what I need to do to initialize a view controller class with it's respective xib/nib.

在我的情节提要中,我创建了一个视图控制器,并从另一个视图控制器中引用了它,并将其指定为Popover类型.

In my storyboard i have created the view controller and referenced it (from another view controller) and specified it as a Popover type.

有什么想法可以实现吗?

Any ideas how this is accomplished?

谢谢.

*更新*

Apple文档说

要在情节提要中标识特定的视图控制器或设置, 使用Interface Builder为它分配一个唯一的标识符字符串 识别它.

To identify a specific view controller or segue inside a storyboard, use Interface Builder to assign it an identifier string that uniquely identifies it.

但是我不知道如何通过IB分配唯一的ID.该怎么做?

But I can't figure out how to assign a unique id via IB. How to do this?

推荐答案

XCode 4.4 and earlier: Identifier; 
XCode 4.5: Storyboard ID 

故事板-不包含带有标识符的视图控制器

这篇关于如何从MainStoryboard为UIViewController分配标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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