As a novice in iOS development, unfortunately, luckily, I caught up with iOS 11. Unfortunately, the previous version of the properties are not skilled, mostly not familiar with, and issued a new version, and the relevant properties, for the big boys, think very simple, very normal things, only to mention a sentence, and some even did not mention, leading us these just contact with iOS newcomers, really do not know where to start. Fortunately, the new features and save a lot of code, and some of the functions of a few lines, making me this novice always think my code is wrong, is not reliable.
The first new feature I contacted was the Preferslargetitles attribute, which is bool.
Self. Navigationcontroller. Navigationbar. Preferslargetitles = YES;//This sentence indicates whether to display a large title
Self. Navigationitem. Title = @ "Settings";//Set caption
Self. Navigationitem. Largetitledisplaymode = uinavigationitemlargetitledisplaymodeautomatic;//This is the way the title is displayed, which will be described in detail below
When Preferslargetitles is set to Yes, a large caption is displayed, as shown in:
No big headlines when no is displayed
And Largetitledisplaymode is in conjunction with the Preferslargetitles property, as long as the preferslargetitles is yes when the effective, Largetitledisplaymode has three modes:
Uinavigationitemlargetitledisplaymodenever is always showing a small title
Uinavigationitemlargetitledisplaymodealways: Always show big headlines
Uinavigationitemlargetitledisplaymodeautomatic: Automatically displays a large title or a small title. In my words: The initial is a big headline, and when you swipe to make a big title hide it displays a small caption.
and change the big title color, is to use largetitletextattributes this attribute (before turning a lot of posts, not that can not be changed to mean with setlargetitletextattributes this attribute, do not say how to use, Hey, Feel compelled to die small white). Here are the properties that I set for the big title.
[self. Navigationcontroller. Navigationbar setlargetitletextattributes: [Nsdictionary dictionarywithobjectsandkeys: [Uicolor whitecolor], nsforegroundcolorattributename, [ Uifont systemfontofsize:18.0f],nsfontattributename,Nil]];
The first time I wrote this kind of thing, I felt a little confused about what I read.
Article reference: HTTP://WWW.JIANSHU.COM/P/D4A17C32ABDF
New features of IOS11--preferslargetitles properties