2017-09-26 76 views
-1

我在導航控制器創建2右鍵項目。 因爲我更新到iOS 11,圖標的內容插入已發生變化,我真的不知道爲什麼...斯威夫特 - 按鈕項目iOS的11

這此的iOS 10(左)和iOS 11(右)的區別:

enter image description here

你有,我怎麼可能會改變,任何想法?

這一塊我的代碼:

editButton.imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -30) 

這是很好的這條線在iOS的10 ...

+0

請說明如何創建欄按鈕項目。 – matt

回答

0
editButton.translatesAutoresizingMaskIntoConstraints = NO; 

iOS的11此項設置爲YES默認情況下,嘗試設置這個屬性,並調整按鈕:

[editButton setContentEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -30)]; 
+1

似乎translatesAutoresizingMaskIntoConstraints是不工作的UIBarButtonItem上:/(類型值「的UIBarButtonItem」沒有成員「translatesAutoresizingMaskIntoConstraints」) – KevinB