• 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];
    }
  • 相关阅读:
    通过具名 slot (插槽)来显示Dialog 的标题
    elementUI 中,table表格如何实现当某一行被点击时会触发该事件(row-click)
    switch循环
    CSS动画
    for循环
    Display
    修改页面标题前的图标
    from表单
    CSS3文字效果
    CSS颜色渐变
  • 原文地址:https://www.cnblogs.com/code-Officer/p/6255034.html
Copyright © 2020-2023  润新知