can't customize navigationbar frame in iOS 10? - ios

I customized the navigation bar frame(y position) so it shows on the bottom in iOS 9.x with code like:
self.navigationController.navigationBar.frame = CGRectMake(0, 320-32, oldRect.size.width, oldRect.size.height);
but it stops working in iOS 10. got something like the screenshot.the top part is covered too. Any idea how to fix this?

Related

How to remove Tab Bar top border (shadow) in > iOS 10 and Swift 4 with a background image?

I've been trying to remove the top border (shadow) line from Tab Bar in Swift 4 for > iOS 10. I'm also using a custom background image. I've just given up after searching for solutions, since none of them work.
The solution which came closest was this post.
The solution given everywhere works if there is no background or for < iOS 10. For iOS > 10 and using a custom background image none of solutions work.
I even tried using a transparent shadow image, but it required setting cliptobounds to true which doesn't show custom background image.
So at the end of all these solution I'm stuck. Couldn't find any working solution.
I'm setting these custom values in AppDelegate so that it works for all Tab Bars.
I just created a sample project using tab bar template from Xcode and write three lines of code
self.tabBar.layer.borderWidth = 0
self.tabBar.clipsToBounds = true
self.tabBar.backgroundColor = .blue
And tab bar top border is no longer visible. I've tested this on Simulator iphone 6 with ios 11.2

How to get rid of the status bar background on the UIWebView?

Since iOS 11, when the UIWebView is full screen, a fake background appears on the status bar with the same color of the UIWebView background.
Anyone knows how to get rid of it?
Even adding the IUWebView to a storyboard and make it full screen will make the status bar background to appear
I've been trying to edit the size and some other properties of the UIWebView and none of them worked, but it's definitely something from the UIWebView.
Also tried to see all the subviews and it's sizes and didn't see anything strange.
Attached a screenshot, see the grey "statusbar", it disappears when scrolling, and doesn't appear if the UIWebView is not over that part of the screen.
I want it as on the second screenshot, only remove the fake background, not the status bar.
This happens because of UIScrollView new behavior to adjust the content inset to include safe area insets like the status bar.
To fix it, just set it to UIScrollViewContentInsetAdjustmentNever
[self.webView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
Since iOS 11 Beta 4 you can add this to your viewport and will also remove the fake statusbar
viewport-fit=cover
To do this entirely in HTML/CSS, viewport-fit=cover in the Viewport meta tag is the correct way to handle this.
But you'll also want to adjust your padding dynamically to handle the differently sized status bar on iPhone X with its notched camera/speaker.
Luckily, Apple exposed some CSS constants for the safe area insets, so you can take advantage of those in your CSS:
i.e., padding-top: constant(safe-area-inset-top);
I wrote a bit more about this scenario and the new features for iOS 11 and iPhone X: https://ayogo.com/blog/ios11-viewport/
Swift version:
webView.scrollView.contentInsetAdjustmentBehavior = .never

Aviary SDK frame issue

I have updated the Aviary SDK for iOS 7 compatibility . Previously everything working good but in the iOS 7 I am having the following frame issue . Cancel button and Done buttons are cutting down at the edges and there is some gap from status bar and Aviary present modal view . Any ideas or help would be grateful .
I have found a solution for changing colour for "done" and "apply" button in "AFPhotoEditorController".
select & open "AviarySDKResources.bundle" from your project
open "AviarySDKColors.plist"
open "accentColor"
change value for key "hex" to what you want.
To fix frame dimensions I used
- (void)setPhotoEditorCustomizationOptions
{
[AFPhotoEditorCustomization setUsingIOS6SDK:YES];
}
In IOS 7 they are using Border less navigation bar buttons with text highlight effect,No options to adjust the bar buttons,For Aviary suggesting bar buttons with example IOS 7 screens Layout in the style guide and you can achieve this effects by adjusting bar button color and opacity in Aviary SDK tool.

Views converted to ios7 flow under navigation/bottom bars in ios6

I have an app that uses stroryboards, a navigation controller and autolayout that runs fine under io6 and I would like to enable to run under both ios6 and ios7.
I have converted the app using xcode5 and it now runs fine under ios7, but when I run it under ios 6 the navigation bar and bottom bar are now transparent (they were not originally) and the view flows under them - hiding some of the controls. This persists even if I convert the ios7 app not to flow under these bars (by setting Extend Edges / Under Top Bars and Under Bottom Bars OFF).
I have worked around it by allowing ios7 to flow the view under the bars (what Apple wants us to do anyway) and then adding the following code to the viewDidLoad method of the fist view controller to force ios6 not to use transparent bars.
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
self.navigationController.toolbar.barStyle = UIBarStyleBlackOpaque;
}
This seems to be working, but I don't understand why I need to do this and I am concerned that I am missing something fundamental.
Edit: The other concern I have with this 'solution' is that the Preview in xcode5 under ios6 doesn't accurately reflect the layout as it runs under a simulator under ios 6 (I don;t have a real ios6 device handy to test it at the moment). The new preview feature in xcode5 appears to assume that the ios 6 will not flow the view under the top and bottom bars and thus squashes the controls together to fit into the available space.
Ali
Try this regardless of the OS version (it solved me a similar issue recently):
self.navigationController.navigationBar.translucent = NO;
self.navigationController.toolbar.translucent = NO;
I am not sure if this will help you, but there is another option to your situation: try using the __IPHONE_6_1 macro. I have an example:
if(__IPHONE_7_0) {
NSLog(#"Hello");
}
so you could just do
if(__IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_6_1) {
self.navigationController.navigationBar.translucent = NO;
self.navigationController.toolbar.translucent = NO;
}
hope this helps you

Back button is not visible in iOS 7

I have some weird trouble about iOS 7. I have an UINavigationBar in my app and it works perfect for iOS 6;
-- IOS 6 --
However, when i try to run it on iOS 7, my back button disappeared. It's there, still working and clickable but not visible;
-- IOS 7 --
How can I fix this problem ?
Setting BackButtonBackgroundImage via UIAppearance currently has some odd behavior in iOS 7. This is probably related to the updated design, which replaces the rect-style button with a backIndicatorImage (an arrow).
This leaves 3 options for customizing the back button's appearance:
Change the color of the backIndicatorImage by setting the tintColor property on UINavigationBar (or one of its superclasses).
Set the new backIndicatorImage property on UINavigationBar to a custom image. (don't forget to set the backIndicatorTransitionMaskImage as well or it won't work)
Create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem. (See the answer mentioned above by Mashhadi)
By the way, if you have to keep support ios 6 version like me, use that;
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
{
// My iOS 6 back button background
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:39.0f/255.0f green:184.0f/255.0f blue:199.0f/255.0f alpha:1.0];
}
else
{
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
I used Wes Dearborn's answer and implemented a nice way of supporting both iOS5+'s back button and iOS7's backIndicatorImage:
Back button strangely disappearing in UINavigationController but keeps working

Resources