How to set the title of UIToolBar?

后端 未结 8 1246
独厮守ぢ
独厮守ぢ 2021-02-01 07:09

How can I set the title of UIToolBar such that it looks the same as the title in UINavigationBar?

I tried to use a button with plain style, it looks ok, but it will be

8条回答
  •  不要未来只要你来
    2021-02-01 07:32

    enter image description here

    1. Put the regular "Rounded Rect Button" (UIButton) on toolbar (not "Bar Button Item")! Be aware, that behind the scene, IB wrap UIButton with UIBarButtonItem. It is why you have to click on button twice to get to UIButton properties (true for Xcode 4.2).
    2. Get to UIButton properties. When you click first time, you will get "Bar button item" properties (it is what IB created automatically for you). Now click second time, you'll get to "Button" properties (also, when you selected UIButton you can't resize it and can't see resize markers).
    3. In the Button properties set type to "Custom" to remove rounded rect border around button (you may need to resize button in IB to refresh it before you can see difference).
    4. In the Button properties under "View" uncheck "User Interaction Enabled".

提交回复
热议问题