Dharmesh Dhorajiya
Dharmesh Dhorajiya

Reputation: 3984

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"

enter image description here

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

enter image description here

What is the issue there? I could not understand.

Upvotes: 2

Views: 234

Answers (3)

Shridhar Mali
Shridhar Mali

Reputation: 189

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];
}

My Information

enter image description here

Upvotes: 2

Max
Max

Reputation: 5932

@Dharmesh, please look at the code here code sample this shows after you change the mode to landscapeback button remains same.

Upvotes: 0

rounak
rounak

Reputation: 9387

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

Upvotes: 2

Related Questions