Custom background/transparent background on UIBarButtonItem?

后端 未结 4 1724
栀梦
栀梦 2020-12-16 01:34

How is this effect achieved? Code snippets are highly welcome.

This can be seen in Notes app and other apps on the App Store.

It seem that either the buttons

4条回答
  •  再見小時候
    2020-12-16 02:15

    I don't think you can make it transparent just by setting some sort of property (but I might be wrong).

    Look at the UIBarButtonItem documentation. There are init methods that will take a custom view or an image and create a UIBarButtonItem from it. So create a view or an image with the appearance you want and use that. One thing you might want to try is to create a UIButton the way you want it to look, and then do [[UIBarButtonItem alloc] initWithCustomView:button];

    Another solution is to sent the tintColor property of your UINavigationBar to whatever color you want, and the button will take on that color.

提交回复
热议问题