1. 導航欄按鈕添加圖片使其保持原色
UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:@selector(點擊方法)];
self.navigationItem.rightBarButtonItem = rightBarItem;
[self.navigationItem.rightBarButtonItem setImage:[[UIImage imageNamed:@"圖片"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; 圖像渲染模式總是顯示原創
2.設置Cell的背景圖片
cell.backgroundView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"圖片"]];
3.searchBar的取消顯示按鈕 ?簽訂代理
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
[searchBar resignFirstResponder];
[searBar setShowsCancelButton:NOanimated:YES];
}
-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
[searBar setShowsCancelButton:YESanimated:YES];
//修改UISearchBar右側的取消按鈕文字顏色及背景圖片
for(idsearchbuttonsin[[searchBar subviews][0] subviews])//只需在此處修改即可
if([searchbuttons isKindOfClass:[UIButton class]]) {
UIButton *cancelButton = (UIButton*)searchbuttons;
//修改文字顏色
[cancelButton setTitle:@"取消"forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
}
}