zoukankan      html  css  js  c++  java
  • ios 修改导航条返回按钮

    ios 修改导航条返回按钮

    方式一:使用系统的;可以更改系统的文字;以及通过设置导航条的颜色来达到预期的效果

        UIBarButtonItem *backBtns = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];
        self.navigationItem.backBarButtonItem = backBtns;
        [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];

    方式二:

    通过UIBarButtonItem的创建一个custom, 通过创建一个uibutton来处理!

    上述效果可以用一个UIButton 里面,同时设置一照片和文字来处理

        //topNav
        UIBarButtonItem *callItems = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"indexCALL"] style:UIBarButtonItemStylePlain target:self action:@selector(tapCallBtnAction)];
        callItems.tintColor = [UIColor whiteColor];
        self.navigationItem.rightBarButtonItem = callItems;
        
        
        locBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        locBtn.frame = CGRectMake(0, 0, 50, 44);
        [locBtn setTitle:@"返回" forState:UIControlStateNormal];
        locBtn.titleLabel.textAlignment = NSTextAlignmentLeft;
        [locBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [locBtn addTarget:self action:@selector(tapLocationBtnAction) forControlEvents:UIControlEventTouchUpInside];
        locBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:locBtn];
        [locBtn setImage:[UIImage imageNamed:@"indexArrow"] forState:UIControlStateNormal];
        [locBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 30, 0, 0)];
        [locBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -40, 0, 0)];
  • 相关阅读:
    The Ubuntu version detected is too old (< 10.04). Please refer to VMware KB article 2147454 to learn how to obtain and install VMware Tools on this system
    Metasploit渗透测试指南:修订版 勘误
    栈溢出基础
    修改peda颜色
    linux 修改文件夹颜色 终端颜色
    fadetop bing wallpaper
    odoo 去除动作菜单的删除按钮
    crontab详解
    odoo 创建初始数据库 切换当前数据库
    24 单链表的遍历与优化
  • 原文地址:https://www.cnblogs.com/cocoajin/p/5626666.html
Copyright © 2011-2022 走看看