简体   繁体   中英

Getting image from UIBarButtonSystemItem icons

I have found several posts that hit all around this but none that really address it. I have a UIToolBar setup and want to use systemicons with it. I setup the toolbar and setup my IBOutlets using the storyboard. Right now, I have two items on the toolbar and want to use the system icons for the buttons. The only way I have found to do this seems to be to programmatically create the buttons. It would seem that there should be a way from the storyboard editor to set the buttons image to one of the standard system images enumerated in the UIBarButtonItem class reference. Do I have to programmatically alloc and init the toolbar items to get a systemicon on it? Even a convertsystemitem to UIimage type of method would be ok. Something where I could do self.loadImageBarButton.image= UIBarButtonSystemItemCamera; or something like that.

You can give from storyBoard also.Select the barButtonItem which added in storyBoard .Go Attribute Inspector -> Idenifier as shown in image and select appropriate Identifier

在此输入图像描述

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