IOS-導航欄風格


導航控制器可以用幾種不同的風格來顯示自身。默認風格就是標准的灰色外觀。目前支持三種不同的風格。

風    格

描    述

UIBarStyleDefault

默認風格;灰色背景,白色文字

UIBarStyleBlack

純黑色背景,白色文字

UIBarStyleBlackOpaque

純黑色背景,白色文字       

UIBarStyleBlackTranslucent

透明黑色背景,白色文字

 

風格是通過barStyle屬性來設置的。這個屬性屬於導航控制器,而不是視圖控制器,因此在各個視圖之間來回切換時,此屬性可以保持一致:

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

 

IOS中原文檔如下:

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.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM