我正在自定義UINavigationBar並且必須將自定義背景圖像設置爲導航按鈕。這是這樣完成的:自定義UIButton圓角
for (UIView *view in self.navigationController.navigationBar.subviews) {
if ([[[view class] description] isEqualToString:@"UINavigationButton"]) {
UINavigationButton *button = {(UINavigationButton *)view};
[button setBackgroundImage:[UIImage imageNamed:@"bar_button.png"] forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"bar_button_black.png"] forState:UIControlStateSelected];
[button setBackgroundImage:[UIImage imageNamed:@"bar_button_black.png"] forState:UIControlStateHighlighted];
}
}
這不會被蘋果拒絕嗎? 如何讓UIButton/UIView的四角變圓?
好的。看起來沒有其他選擇。謝謝。 – Misha