IOS 11 navigation bar changes

Source: Internet
Author: User
First, Preferslargetitles properties

IOS11 Uinavigationbar Newly added Preferslargetitles property 1, Preferslargetitles

When set to YES, the navigation bar would use a larger Out-of-line title view while requested by the current navigation Item. To specify when the large Out-of-line title view appears, Uinavigationitem.largetitledisplaymode. Defaults to NO.
@property (nonatomic, ReadWrite, assign) BOOL preferslargetitles ui_appearance_selector api_available (iOS (11.0)) Api_ Unavailable (tvOS);

Large headings, default to False, when set to True, navigation bar displays a large caption, the caption appears on the left, and if the page has a ScrollView control or parent control for this, when the page is slid up, the title is smaller until it appears as before, The title position also changes. When this property is set to No, the height of the navigation bar is (except for iphone x); When this property is set to No, the height of navigation bar is (excluding iphone x); 2. Largetitledisplaymode

When Uinavigationbar.preferslargetitles=yes, this property controls the larger Out-of-line title is displayed. If Preferslargetitles=no, this property has NO effect. The default value is Automatic.
@property (nonatomic, ReadWrite, assign) Uinavigationitemlargetitledisplaymode Largetitledisplaymode API_AVAILABLE ( iOS (11.0)) api_unavailable (tvOS);

This property contains four values

typedef ns_enum (Nsinteger, Uinavigationitemlargetitledisplaymode) {///Automatically use th E large Out-of-line title based on the "the" previous item in the navigation bar. An item with largetitledisplaymode=automatic'll show or hide the large title based on the request of the previous Naviga tion item. If the pushed is set to Automatic, then it'll show the large title if the navigation bar has PREFERSLARGETITL
    Es=yes.
    Uinavigationitemlargetitledisplaymodeautomatic,///Always use a larger title as this item is top most.
    Uinavigationitemlargetitledisplaymodealways,///Never use a larger title as this item is top most. Uinavigationitemlargetitledisplaymodenever,} ns_swift_name (Uinavigationitem.largetitledisplaymode); 

Largetitledisplaymode is in conjunction with the Preferslargetitles property, as long as the preferslargetitles is yes when it takes effect, Largetitledisplaymode has three modes: Uinavigationitemlargetitledisplaymodeautomatic: Automatically displays a large title or a small title. In my words: The initial is a large title, when sliding so that the large title hidden display small title. Uinavigationitemlargetitledisplaymodealways: Always display a large title. Uinavigationitemlargetitledisplaymodenever: Always show small headings. 3, Largetitletextattributes

/* You may specify the font, text color, and shadow properties for the large title in the text attributes dictionary, usin G The keys found in NSAttributedString.h.
 * *
@property (nullable, nonatomic, copy) Nsdictionary<nsattributedstringkey, id> *largetitletextattributes Ui_appearance_selector api_available (iOS (11.0)) api_unavailable (tvOS);

Set caption Properties (color, font size)

[Self.navigationController.navigationBar setlargetitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [Uicolor Whitecolor], Nsforegroundcolorattributename,[uifont Systemfontofsize:18.0f],nsfontattributename,nil]];
second, the navigation bar view position Change 1, IOS 11 ago


Navigationbarbutton is added directly after Navigationbar 2, IOS 11


The Titleview is added directly to the _uinavigationbarcontentview, Uibarbuttonitem to the _uibuttonbarstackview, and _uibuttonbarstackview is added to the _uinavigationbarcontentview above, and finally add to Uinavigationbar above. Third, Uisearchcontroller

The Uisearchcontroller control is introduced by iOS 8 o'clock and is often used in conjunction with UITableView's Tableheaderview, in iOS 11 Uisearchcontroller has added two properties to Navigationitem.

A view controller that'll be shown inside the a navigation controller can assign a Uisearchcontroller to the property To display the search controller's search bar in its containing navigation controller ' s navigation bar.
@property (Nonatomic, retain, nullable) Uisearchcontroller *searchcontroller api_available (iOS (11.0)) api_unavailable (tvOS);
If This is true (the default), the Searchcontroller ' s search bar would hide as the user scrolls in the top view Controller ' s scroll view. If false, the search bar would remain visible and pinned underneath the navigation bar.
@property (nonatomic) BOOL hidessearchbarwhenscrolling api_available (iOS (11.0)) api_unavailable (tvOS);

How to transform using:
Uisearchcontroller *SEARCHC = [[Uisearchcontroller Alloc]initwithsearchresultscontroller:nil];

if (@available (IOS 11.0, *)) {Self.navigationItem.searchController = SEARCHC;
self.navigationItem.hidesSearchBarWhenScrolling = NO; else {self.tableView.tableHeaderView = Searchc.searchbar;} 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.