美文网首页
细节上面的更改变换

细节上面的更改变换

作者: 风逝伊不离 | 来源:发表于2017-02-11 17:55 被阅读7次

    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];

    }

    }

    相关文章

      网友评论

          本文标题:细节上面的更改变换

          本文链接:https://www.haomeiwen.com/subject/tvanittx.html