Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

ios - How to consolidating the translucency of the navigation bar between iPhone 5S and 5?

I have difficulty consolidating the UINavigationBar's barTintColor between iPhone 5 and 5S. Both of my phones are on iOS 7. In the following screenshot, the top is 5S and the bottom is 5. iPhone 5S shows an extremely translucent effect while iPhone 5 shows a much more subtle effect. Only very dark objects are visible behind the navigation bar for iPhone 5.

[[UINavigationBar appearanceWhenContainedIn:[UINavigationController class], nil]
    setBarTintColor:[UIColor 
        colorWithRed:46.0 / 255.0 
        green:160.0 / 255.0 
        blue:152.0 / 255.0 
        alpha:0.8
    ]
];

enter image description here

I would prefer that both phones look like the iPhone 5. If I were to increase the alpha of the barTintColor to 1.0, iPhone 5's navigation bar would become completely opaque. This is the expected result. Although iPhone 5S's bar would become less translucent, the effect is still too strong. How would I decrease the translucency even more, without making it completely opaque?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As discussed in the comments, you are seeing different behaviors because one of the devices is using an outdate iOS 7 version. Apple made changes in version 7.0.3 to the way bar tint color is processed, and now the alpha value is taken into account. You should focus on the newer version of iOS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...