简体   繁体   English

故事板场景未与ViewController绑定

[英]Storyboard scene not binding with ViewController

As the question suggests, I have a storyboard scene, which isn't binding with the corresponding ViewController class. 正如问题所暗示的,我有一个情节提要场景,它没有与相应的ViewController类绑定。 I have changed the class name by selecting the file's owner and coupled all the widgets with the corresponding variables in the class. 我通过选择文件的所有者来更改类名称,并将所有小部件与类中的相应变量耦合在一起。 Even after this, the binding doesn't seem to be happening - the IBAction methods aren't firing, the UIImageViews aren't being assigned the right images and so on. 即使在此之后,绑定似乎也没有发生-IBAction方法没有触发,未为UIImageViews分配正确的图像,依此类推。 Does anyone have any idea why this might be happening? 有谁知道为什么会这样?

PS - This scene is opened from another using a modal segue. PS-使用模态序列从另一个场景打开此场景。 (If that is helpful) (如果有帮助)

I believe your only problem here is that you didn't change the class properly your scene is referring to. 我相信这里唯一的问题是您没有正确更改场景所指的课程。 Double check by: 仔细检查:

  1. Selecting your view controller scene in storyboard storyboard选择视图控制器场景

  2. In the identity inspector change the default class name to your custom view controller name 在身份检查器中,将默认类名称更改为您的custom view controller name

Also since you are presenting your scene through a modal segue, i would check you have correctly set your identifier of your storyboard segue. 另外,由于您是通过模态序列展示场景的,所以我会检查您是否已正确设置情节提要序列的标识符。 Click on your segue in storyboard then check this value under Attributes Inspector -> Storyboard Segue -> Identifier 单击情节Attributes Inspector -> Storyboard Segue -> Identifier的segue,然后在“ Attributes Inspector -> Storyboard Segue -> Identifier下检查此值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM