Change the font of a UIBarButtonItem

前端 未结 16 1131
春和景丽
春和景丽 2020-12-07 09:18

\"UIToolbar

I have a UIBarButtonItem in my UIToolbar titled

16条回答
  •  半阙折子戏
    2020-12-07 09:45

    Assuming you want to support iOS4 and earlier, your best bet is to create a bar button using the initWithCustomView: method and supply your own view which could be something like a UIButton where you can easily customise the font.

    You can also drag a UIButton onto a toolbar or navigation bar in Interface Builder if you want to create the button with drag-and-drop instead of programmatically.

    Unfortunately this means creating the button background image yourself. There's no way to customise the font of a standard UIBarButtonItem prior to iOS5.

提交回复
热议问题