麻花豆传媒剧国,亚洲国产精品无码,欧州黄片视频免费观看,外国性生活一区二区

問答

ios7導航欄隱藏之后導航欄下的按鈕怎么布局

提問者:rnvojw2013-09-28 00:00

最佳答案

在iOS7下,默認導航欄背景,顏色是這樣的,接下來我們就進行自定義,如果你僅僅是更改一下背景和顏色,代碼會很簡單,不需要很復雜的自定義View來替代leftBarItem更改導航欄的背景和文字Color方法一:[objc] view plaincopy//set NavigationBar 背景顏色&title 顏色 [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:20/255.0 green:155/255.0 blue:213/255.0 alpha:1.0]]; [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,nil]]; 效果如下:我們把背景改成了藍色,title文字改成了白色,是不是很簡單呢?NavigationBar極其push過去的子頁面也會是你修改后的背景顏色方法二:[objc] view plaincopy//設置NavigationBar背景顏色 [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]]; //@{}代表Dictionary [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}]; 效果如下:在導航欄使用背景圖片:如果您的應用程序使用了自定義圖像作為欄的背景,你需要提供一個“更大”的圖片,使其延伸了狀態欄的后面。導航欄的高度現在是從44點(88像素)更改為64點(128像素)。仍然可以使用了setBackgroundImage:方法來指定自定義圖像的導航欄。下面是代碼行設置背景圖片:[objc] view plaincopy[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] forBarMetrics:UIBarMetricsDefault]; 效果圖和上面的一樣,我就不貼出來了。改變導航欄標題的字體就像iOS 6,我們可以通過使用導航欄的“titleTextAttributes”屬性來自定義的文本樣式。可以指定字體,文字顏色,文字陰影顏色,文字陰影在文本標題偏移屬性字典,使用下面的文本屬性鍵:UITextAttributeFont - 字體UITextAttributeTextColor - 文字顏色UITextAttributeTextShadowColor - 文字陰影顏色UITextAttributeTextShadowOffset - 偏移用于文本陰影[objc] view plaincopyNSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; shadow.shadowOffset = CGSizeMake(0, 1); [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil nil]]; 使用圖片作為導航欄標題不想標題欄是光禿禿的文字?可以通過使用代碼行中的圖像或標志取代它:簡單地改變titleview用來自定義,(適用于較低版本)[objc] view plaincopyself.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"appcoda-logo.png"]]; 效果如下,我隨便用了個圖片,別介意:添加多個欄按鈕項目您希望添加導航欄的一側不止一個欄按鈕項目,無論是leftBarButtonItems和rightBarButtonItems 您在導航欄左側/右側指定自定義欄按鈕項目。比如你想添加一個攝像頭和一個共享按鈕右側的吧。您可以使用下面的代碼:[objc] view plaincopyUIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action: nil nil]; UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action: nil nil]; NSArray *itemsArr = @[shareItem,cameraItem]; self.navigationItem.rightBarButtonItems = itemsArr; 自定義后退按鈕的文字和顏色通常情況下,我們使用UINavigationController時,push到的子頁面,左上角會是系統自動取值上一層父頁面的title名稱,默認情況是這樣,那么我們該如何修改它呢?

回答者:wangdon80232016-01-27 00:00

相關問題

  • ios 7以后導航欄顏色都默認為白色了么

    你好親,希望可以幫到你。 不用管是什么顏色的只要可以使用就可以了呀。 純手打,如果對親有用,希望采納,謝謝你的支持是對我最大的幫助。祝愿親好運。

    提問者:kmx176372016-09-10

  • 什么軟件能改變蘋果手機導航欄顏色

    沒有這個軟件,必須越獄,越獄之后使用 iBeauty 手動替換界面元素 為 你想要的顏色的圖片 可以達到這個效果。 aBar插件與另一款美化插件ColorBadges這兩款越獄后的插件也可以做到。

    提問者:cl0800762016-02-20

  • ios怎樣修改導航欄標題字體樣式和顏色

    這個要用自定義的view 才能設置:方法如下//設置標題// self.title = @"title1";//修改title 會改變navigationItem。title ,但反之不會,一般設置title用

    提問者:vi.wa2015-01-29

  • IOS:導航欄顏色為什么透明度為0還有顏色

    iOS的導航欄顏色iOS設置狀態欄和導航欄顏色ios 導航欄透明及顏色動態變化----------------------biu~biu~biu~~~在下問答機器人小D,這是我依靠自己的聰明才智給出的答案,如果不正確,你

    提問者:JNMK1250002016-06-02

  • 如何在 iOS 7 獲得導航欄上的模糊和半透明效果

    半透明在我的 UINavigationController 的子類,我使導航欄半透明:- (id)initWithRootViewController:(UIViewController *)rootViewContro

    提問者:jiepai07342016-09-08

  • ios中怎樣設置導航條背景色透明度

    要設置透明度只需要修改A值。下面這行代碼意思是修改導航欄的背景顏色,//背景色修改[self.navigationController.navigationBar setBackgroundImage:[UIImage

    提問者:yanshen16882015-01-28

車友關注

最新標簽

按字母分類:
ABCDEFGHIJKLMNOPQRSTWXYZ0-9