iphone調色 - iphone鍵盤黑色




更改UIBarButtonSystemItemCancel的顏色 (2)

你可以使用圖像作為按鈕圖像

UIImage *buttonImage = [UIImage imageNamed:@"image.png"];

//create the button and assign the image
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];


//create a UIBarButtonItem with the button as a custom view
//UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];

[button addTarget:self action:@selector(clickActionItem:) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button ];




self.navigationItem.rightBarButtonItem = rightBarButtonItem;

如果我使用UIBarButtonSystemItemCancel,它的顏色設置為導航欄的顏色。 但是,在照片應用程序中,“取消”按鈕顯示為藍色背景。 我怎樣才能設置UIBarButtonSystemItemCancel有一個藍色的背景?


將NavigationController.navigationBar.barStyle設置為UIBarStyleBlackTranslucent

theNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

按鈕默認是藍色的。







uinavigationitem