[英]I can't change connection and object when drag and drop from Main.storyboard to ViewController.swift
enter image description here 在此处输入图片说明
I can't change connection and object when drag and drop from Main.storyboard to ViewController.swift 从Main.storyboard拖放到ViewController.swift时,我无法更改连接和对象
I made a Google signIn system. 我制作了一个Google登录系统。 So, I made a view for SignIn and set its custom class to .
因此,我查看了SignIn并将其自定义类设置为。
And I drag and drop from Main.storyboard to ViewController.swift, But I can't change Connection and object. 我从Main.storyboard拖放到ViewController.swift,但是我无法更改Connection和对象。
Connection is fixed by 'Action' and Object is fixed by 'Exit'. 连接由“动作”固定,而对象由“退出”固定。 I can't change.
我不能改变
Not only this time(this signin Button) but also every button or view. 不仅是这次(此登录按钮),还包括每个按钮或视图。
how can i solve this problem? 我怎么解决这个问题?
I saw this reference and follow. 我看到了这个参考并遵循。 https://firebase.google.com/docs/auth/ios/google-signin
https://firebase.google.com/docs/auth/ios/google-signin
You added a View
and not a Button
to the ViewController. 您向ViewController添加了一个
View
而不是一个Button
。 Fix that in the storyboard and try it again. 在情节提要中修复该问题,然后重试。 (Search for 'Button' in the bottom right)
(在右下角搜索“按钮”)
Oh, and what I just saw: You obviously didn't set the class of the whole View to GIDSignInButton
, but only of the additional view you added. 哦,我刚才看到的是:您显然没有将整个View的类都设置为
GIDSignInButton
,而只是将您添加的其他视图设置了。 Select the white bar above the View you want to add the button to and then on the right go to the Identity Inspector (Or via Cmd + Alt + 3
) and add GIDSignInButton
there again. 选择要向其添加按钮的视图上方的白条,然后在右侧转到Identity Inspector(或通过
Cmd + Alt + 3
), GIDSignInButton
再次在其中添加GIDSignInButton
。
Then you can start dragging from the button. 然后,您可以从按钮开始拖动。 Or you write the
@IBOutlet var buttonOutlet: UIButton!
或者您编写
@IBOutlet var buttonOutlet: UIButton!
and 和
@IBAction func buttonPressed(_ sender: AnyObject) {
print("Button was pressed")
}
manually and connect if afterwards... 手动连接,然后连接...
First of all your have to make sure you are dragging to the same view controller class as in your storyboard. 首先,必须确保要拖动到与情节提要中相同的视图控制器类。 To do that you have to choose correct view controller class in storyboard in utility section.
为此,您必须在“实用程序”部分的情节提要中选择正确的视图控制器类。 In utility section identity inspector choose correct view controller class
在实用程序部分中,身份检查器选择正确的视图控制器类
Than you'll be able to drag to your view controller with no problem.
比起您,您可以毫无问题地将其拖到视图控制器中。
Let me know if it worked. 让我知道它是否有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.