Navigationbar title and back button name are same?

前端 未结 5 924
傲寒
傲寒 2020-12-17 03:50

I created one title for navigationbar in my storyboard project ,but when I moved to next viewcontroller the back button shows the same name as my previous navigationbar(Main

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 04:34

    Let's say you are pushing your viewcontroller A -> B

    In viewcontroller A try adding this code in viewDidLoad method

    UIBarButtonItem *btn_Back = [[UIBarButtonItem alloc] initWithTitle:@"Back"
     style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem=btn_Back;
    

    So you will see your "Back" button in viewcontroller B

提交回复
热议问题