Hasib Samad
Hasib Samad

Reputation: 1081

Resetting the appearance of UIBarButtonItems and UINavigationBar

Let us say I used some code to change the appearance property of the UINavigationBar including the UIBarButtonItems in my app. Is there any simple way to reset the appearance for some specific views to the default iOS style?

Upvotes: 0

Views: 852

Answers (1)

RachelD
RachelD

Reputation: 4089

A couple of options I can think of.

  1. Save the initial state in variables (background, font etc) to use later during the reset.
  2. Destroy and recreate the view. If this is done during a transition (page switch etc) it may not be noticeable to the user.
  3. Keep the original view hidden behind the new view and destroy the new view when you want to reset it. (This may be memory expensive.)

I think your best bet may be to create a custom object (extend the original NavBar etc), save its original appearance variables (color, font etc) and add a reset option to be called by the controller.

Upvotes: 1

Related Questions