The navigation controller can display itself in several different styles. The default style is the standard gray appearance. Currently, three different styles are supported.
Fengge |
Description |
Uibarstyledefault |
Default style; gray background, white text |
Uibarstyleblack |
Black background, white text |
Uibarstyleblackopaque |
Black background, white text
|
Uibarstyleblacktranslucent |
Transparent black background, white text |
The style is set through the barstyle attribute. This attribute belongs to the navigation controller rather than the View Controller. Therefore, this attribute can be consistent during back-and-forth switching between views:
Self. navigationcontroller. navigationbar. barstyle = uibarstyleblacktranslucent;
The original IOS documents are as follows:
Uibarstyle
Defines the stylistic appearance of different types of views.
Typedef Enum {
Uibarstyledefault = 0,
Uibarstyleblack = 1,
Uibarstyleblackopaque = 1, // deprecated
Uibarstyleblacktranslucent = 2, // deprecated
} Uibarstyle;
Constants
Uibarstyledefault
Use the default style normally associated with the given view. For example, search bars and tool bars typically use a blue gradient background.
Available in IOS 2.0 and later.
Declared in uiinterface. h.
Uibarstyleblack
Use an opaque black style.
Available in IOS 3.0 and later.
Declared in uiinterface. h.
Uibarstyleblackopaque
Deprecated. Use uibarstyleblack instead.
Available in IOS 2.0 and later.
Declared in uiinterface. h.
Uibarstyleblacktranslucent
Deprecated. Use uibarstyleblack and set the translucent property to yes instead.
Available in IOS 2.0 and later.
Declared in uiinterface. h.