简体   繁体   中英

UINavigationController title not aligned with UIBarButton

I have a title for my UINavigationBar, set by calling self.title = "self.title" in my custom UINavigationController and BarButtonItem is installed in the storyboard. Does anyone know what the cause of this misalignment might be and how I would go about fixing it? The title font size is set by calling:

self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 35),NSAttributedString.Key.foregroundColor: UIColor.white]

self.title与右侧的UIBarButtonItem不对齐

Check this method of UINavigationBar

func setTitleVerticalPositionAdjustment(_ adjustment: CGFloat, 
                                for barMetrics: UIBarMetrics)

Apple Doc

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