简体   繁体   中英

How to Change the font style and size UIBarButtonItem?

I have have currently created a toolbar with a size button with pop-up along with a date picker when the corresponding text field is interacted with.

Screenshot:

在此处输入图片说明

I want to be able to change the font style and size of the button.

Code Snippets:

UIToolBar Creation:

/*** ToolBar setup DatePicker ***/
    let toolBar = UIToolbar(frame: CGRectMake(0, self.view.frame.size.height/6, self.view.frame.size.width, 40.0))
    toolBar.layer.position = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height-20.0)
    toolBar.barStyle = UIBarStyle.Default
    toolBar.tintColor = UIColor.init(red: 0, green: 122/255, blue: 1, alpha: 1.0)
    toolBar.backgroundColor = UIColor.grayColor()

UIBarButton Declaration:

let okBarBtn = UIBarButtonItem(title: "Done", style: UIBarButtonItemStyle.Done, target: self, action: "donePressed:")

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