Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 设置leftBarButtonItem垂直位置_Xcode_Swift - Fatal编程技术网

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)