I had used the below mention code for a custom left pointed back button and it was working properly..
but after a few days, it changed back to a rectangular button..
can anyone help me to get it back to its original type….
Thanks…
UIButton *backButton = [UIButton buttonWithType:101];
[backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:@"Back" forState:UIControlStateNormal];
UIBarButtonItem* newBackButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
graphSecondViewCtrl.navigationItem.leftBarButtonItem = newBackButton;
Button type 101 is not defined in the SDK, and can stop working at any OS upgrade.
I’d use a
buttonWithType:UIButtonTypeCustomand then add an image that gives you the look you need by calling setImage:forState on the custom button object.The real question is why you’d need to recreate the standard button that the navigation controller automatically gives you in the first place. Make sure you work with the tools, and not against them.
If you need to track when the view controller gets swapped in and out, you can set your view controller to be the delegate of the navigation controller like this: