简体   繁体   中英

Interface Builder Does Not Recognize Toolbar Buttons

I created 4 UIButton's that are Custom and Plain in IB.

I added a background image to them and then placed them onto my UIToolbar.

I created IBActions and hooked up all of the buttons

I did not create @property for the buttons, but 3/4 of them appear on my toolbar when I run the app in my the simulator. There is a blank space for the missing toolbar item, but when I click on the blank space, it calls my IBAction.

Why isnt my 4th button appearing? If I need to declare an @property for them, will it be a UIToolbarButtonItem or a UIButton?

Note: IB Is showing the buttons as a "Custom Button" instead of a Bar Button Item. I want a custom button because I don't want the image on the button to become inverted.

All that matters is that they have an IBOutlet , and are declared correctly for the ui element you are trying to connect to. A @property isn't essential (but is good practice). You can have the IBOutlet on either the declaration, the @property , or both.

Buttons in a toolbar are UIBarButtonItems; buttons on a plain view are UIButtons. They are different things. You seem confused on this issue, so please double check your code.

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