简体   繁体   中英

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

I made a Google signIn system. So, I made a view for SignIn and set its custom class to .

And I drag and drop from Main.storyboard to ViewController.swift, But I can't change Connection and object.

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

You added a View and not a Button to the ViewController. 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. 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.

Then you can start dragging from the button. Or you write the @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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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