Xcode 设置leftBarButtonItem垂直位置
我试着给左边的巴布托尼姆留一个上边距,但它不起作用。我可以向右移动,但不能向下移动Xcode 设置leftBarButtonItem垂直位置,xcode,swift,Xcode,Swift,我试着给左边的巴布托尼姆留一个上边距,但它不起作用。我可以向右移动,但不能向下移动 self.navigationItem.leftBarButtonItem?.setTitlePositionAdjustment(UIOffsetMake(10, 20), forBarMetrics: UIBarMetrics.Default) 水平参数10起作用,它将标题向右移动。 但是垂直参数20没有任何作用,无论我将其更改为什么数字 全部代码: let attributes = [NSFontAttr
self.navigationItem.leftBarButtonItem?.setTitlePositionAdjustment(UIOffsetMake(10, 20), forBarMetrics: UIBarMetrics.Default)
水平参数10
起作用,它将标题向右移动。
但是垂直参数20
没有任何作用,无论我将其更改为什么数字
全部代码:
let attributes = [NSFontAttributeName: UIFont.ioniconOfSize(24)] as Dictionary!
let newBackButton = UIBarButtonItem(title: String.ioniconWithName(Ionicon.ChevronLeft), style: UIBarButtonItemStyle.Plain, target: self, action: "back:")
self.navigationItem.leftBarButtonItem = newBackButton;
self.navigationItem.leftBarButtonItem?.setTitleTextAttributes(attributes, forState: .Normal)
self.navigationItem.leftBarButtonItem?.setBackgroundVerticalPositionAdjustment(5, forBarMetrics: UIBarMetrics.Default)
尝试:
OP想要的是迅速,而不是客观,C。还是同样的问题。也许我应该提到我正在使用一种自定义字体。
self.navigationItem.leftBarButtonItem?.setBackgroundVerticalPositionAdjustment(5, forBarMetrics: UIBarMetrics.Default)