简体   繁体   中英

UIBarButtonItem style ignored?

I've been struggling with some weird bar button item behavior for some time now. For some reason the bold style disappears when the "OK" button is klicked on a alert. I've had this behavior when doing other stuff like presenting a modal view controller and dismissing it as well. Why is the bar button item changing its font weight from bold to regular?

My code:

class ViewController: UIViewController {

    @IBAction func buttonAction(sender: AnyObject) {

        let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: .Alert)
        let cancelAction = UIAlertAction(title: "OK", style: .Cancel, handler: nil)
        alertController.addAction(cancelAction)
        presentViewController(alertController, animated: true, completion: nil)

    }

}

My settings:

在此处输入图片说明

The weird behavior (before) 在此处输入图片说明 After: 在此处输入图片说明

The System Item Done button expects to be using the Done style. Combining System Item Done with the Bordered style makes no sense.

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