1
votes

I have had this issue for some time but never really resolved it. I have a rightBarButtonItem That sits in the navBar, and when I push or pop a view onto/off the navigation stack in an animated fashion it dose not seem to animate like the back button dose.

Instead of animating left or right like the back button it fades in and out but stays in the same position.

Is this how it is supposed to work? or is it doing something abnormal? I have decalred the following code in viewWillAppear:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"All" style: UIBarButtonItemStyleBordered target:nil action:@selector(selectAllSubs:)];

1

1 Answers

2
votes

Please provide more information from your question. I don't get really what you want to do.

For rightbarbutton ,

you should write on ViewDidLoad:

If you wrote on the viewWillAppear: , it will re init again when view is appear. So, use on viewDidiLoad is much better than viewWillAppear.

If you wrote on ViewDidLoad , it will init in before viewWillAppear.

If you wrote on ViewWillAppear, it will show after push view appear.

You should write

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"All" style: UIBarButtonItemStyleBordered target:self action:@selector(selectAllSubs:)];
}

If you didn't add target , your action selector can't call.