简体   繁体   English

从Main.storyboard拖放到ViewController.swift时,我无法更改连接和对象

[英]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.

相关问题 在 Xcode 中初始化新项目时没有 main.storyboard 或 ViewController.swift? - No main.storyboard or ViewController.swift upon initialization of new project in Xcode? 为什么当我将 UIButton 或 UILabel 拖放到 ViewController.swift 文件时类型总是 UIView - Why is type always UIView when I drag and drop UIButton or UILabel to ViewController.swift file Xcode从viewcontroller.swift跳转到storyboard - Xcode jump from viewcontroller.swift to storyboard 从LaunchScreen看到Main.Storyboard中的viewController? - Segue from LaunchScreen to a viewController in Main.Storyboard? 无法将项目从故事板拖放到 xcode 中的视图控制器 - Can't drag and drop item from storyboard to viewcontroller in xcode Xcode 7.2 Swift - 无法在 Main.storyboard 上拖放、移动标签 - Xcode 7.2 Swift - Cannot drag, drop, move Label on Main.storyboard Xcode 6-我无法将任何东西从我的IB连接到ViewController.swift - Xcode 6 - I Can't connect anything from my IB to ViewController.swift 我找不到要添加到 main.storyboard 的组件 - I can't find the components to add to main.storyboard 如何在 Storyboard 中将 ViewController.swift 连接到 ViewController? - How to connect ViewController.swift to ViewController in Storyboard? 无法控制拖动到ViewController.swift - Cannot Control-Drag into ViewController.swift
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM