0
使用下面的代碼來設置一個全球性的導航後退按鈕圖像:ios7 setBackButtonBackgroundImage圖像仍被拉伸
float imageSize = 21.5; // @2x is 43px width
UIImage *barBackBtnImg = [[UIImage imageNamed:@"arrow-back-white"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, imageSize, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:barBackBtnImg
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
原圖:http://cl.ly/XJgD和 應用程式(拉伸):http://cl.ly/XKc0
任何想法爲什麼圖像仍然被拉伸?
很好的解決,謝謝! – Alex 2015-05-20 13:07:43
我不得不使用參數的直接分配,如下所示:UINavigationBar.appearance()。backIndicatorImage = UIImage(named:「btn-back」); UINavigationBar.appearance()。backIndicatorTransitionMaskImage = UIImage(named:「btn-back」); UINavigationBar.appearance()。tintColor = UIColor.blackColor(); – Jonauz 2015-10-01 13:41:25
好的解決方案。謝謝 – Kit 2015-11-04 07:57:15