简体   繁体   中英

Issue with back button title in UINavigationBar

I have 2 UIViewController . I have just done a simple task.

Move from first view controller to second view controller.

First View Controller's Name : "My Information"

Issue is when I reach to the 2nd View Controller then I found back button title as "Back"

在此处输入图片说明

When I turn the simulator to landscape view then back button title is as "My Information"

在此处输入图片说明

What is the issue there? I could not understand.

This is probably because the title is too long. Try setting it to a shorter string, or set your own custom back button.

In "My Information" view controller add below code.

1) In viewWillAppear:(BOOL)animated

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
     self.navigationItem.backBarButtonItem =
    [[UIBarButtonItem alloc] initWithTitle:@"Back"
                                     style: UIBarButtonItemStylePlain
                                    target:nil
                                    action:nil];
}

我的信息

在此处输入图片说明

@Dharmesh,请在此处查看代码示例,示例在将模式更改为landscapeback按钮后保持不变。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM