zoukankan      html  css  js  c++  java
  • navigationController 的返回按钮自定义

    1: navigationController 的返回按钮自定义

    SecondViewController *secondVC = [SecondViewController new];
        
        
        //更改UINavigationController的返回按钮
        UIBarButtonItem *backButton = [[UIBarButtonItem alloc]init];
        backButton.title = @"返回";
        [self.navigationItem setBackBarButtonItem:backButton];
        
        
        [self.navigationController pushViewController:secondVC animated:YES];

    2,  方法1在有的navigationBar hidden 的页面不好使,但是还有一种方法如下:

    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        
        self.view.backgroundColor = [UIColor grayColor];
        
    //    UIBarButtonItem * backButton = [[UIBarButtonItem alloc] init];
    ////    backButton.image = [UIImage imageNamed:@"nav_back_n"];
    //    backButton.title = @"hh";
    //    [self.navigationItem setBackBarButtonItem:backButton];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back_n"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
    }
    - (void) backAction{
    
        [self.navigationController popViewControllerAnimated:YES];
    }
  • 相关阅读:
    并发编程(线程)
    并发编程(进程)
    并发编程(操作系统的介绍)
    模块与包
    网络编程
    Django项目的创建与管理和pycharm与Github的秘密
    python解释器配置和python常用快捷键
    代码的调试.运行
    57. 三数之和
    1347. 尾随零
  • 原文地址:https://www.cnblogs.com/code-Officer/p/6255034.html
Copyright © 2011-2022 走看看