iOS - UIPageControl cuts bottom off - ios

I'm creating a UIViewControl with this this website. I finished it, but when I load my image, the bottom of my image gets cut off. I'm sure the dimensions of the image are correct, besides the UIImageView is stretched throughout whole screen.
Since the whole code is on the site, I won't be adding anything here, except for one line I changed.
I changed
self.pageViewController.view.frame =
CGRectMake(0, 0, self.view.frame.size.width,
self.view.frame.size.height - 30);
to
self.pageViewController.view.frame =
CGRectMake(0, 0, self.view.frame.size.width,
self.view.frame.size.height);
The gap got smaller but is still there. It looks like this
Thank you.

Have you taken into account the height of the status bar at the top of the phone?
I think that in iOS 7 the status bar overlaps the content by default, you might have to slide the content down a bit.

Related

How to put button on the bottom of PageViewController?

As shown on the image, I have ContentViewController, PageViewController and WelcomeController. And you can see, that I have buttons on my WelcomeController, in the bottom.
With the code: http://pastebin.com/Kf70RQWM
I put PageView with the ContentView into my WelcomeController, but it covers whole my screen. I did try using this:
self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.width, self.view.frame.size.height - 50)
to have 50px space for my buttons, but in that case I get the next:
black background instead of my buttons.
Question: how can I put my buttons to those black space?
You forgot to setup autolayout. Please check the pull request here, https://github.com/orkhanalizade/messenger/pull/1.

Blurry translucent effect of UINavigationBar/UIVisualEffectView while scrolling on a WKWebView?

I'd like to achieve the same effect as in Safari where the navigation bar changes slightly in color to reflect the web page that passes through while scrolling.
The 6 years old method that used to work with UIWebView is to simply include these two lines of code:
webView.scrollView.contentInset = UIEdgeInsetsMake(44.0, 0.0, 0.0, 0.0);
webView.scrollView.scrollIndicatorInsets = _webView.scrollView.contentInset;
Since WKWebView the edge insets work much like content offset. It displays correctly initially but when you scroll the web page moves underneath the UINavigationBar/UIVisualEffectView making in it impossible to reach the top bar of websites that adjust accordingly, like at apple.com
Is there any other way?
The answers below are 6 years old and obsolete.
You need to move the web view under the navigation bar, and then set the web view's contentInset, like so:
navBar.frame = CGRectMake(0, 0, self.view.bounds.size.width, 44);
webView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
webView.scrollView.contentInset = UIEdgeInsetsMake(44, 0, 0, 0);
webView.scrollView.scrollIndicatorInsets = webView.scrollView.contentInset;
Go to you app setting in xcode and in Status Bar Style click the drop down and select "Light".
These should apply in all your app

Programmatically setting content to fill screen between tab bar and nav controller

I have a UIwebview that I want to fill the screen between the navigation bar at the top and the tab bar at the bottom. My web view is being defined programmatically and I was initializing it with a frame as below.
I have been able to get the desired behavior by hard coding in some values, but I have seen that this does not work across all devices. Specifically, it seems that different OS's might consider (0,0) as different points on the screen (the top left corner of the screen for some, and the top left most corner under the nav bar for others).
My question is, how do I set the web view position and size to fill the screen across all devices? And can anyone explain why this doesn't behave as I think it ought to?
//iphone 5s running iOS 8
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight+20)];
//iphone 5 running iOS 7
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, screenWidth, screenHeight-93)];
//what i thought would work for all, but doesnt fill the height of the screen...
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];

ios7 status bar overlaps toolbar when using container view

I´v read the posts regarding this issue but found nothing to work, I think it must be since I am using a toolbar and have the View Controller embedded in a container view. The status bar always overlaps. No matter if I try to replace the toolbar or set different settings in IB. It also seems that since it´s inside a container view, setting the inferred option does not work. I even tried putting two toolbars on top, but only this one shows.
The status bar in iOS 7 is transparent, so if you want to have a look similar to that of iOS6, create a view of 20 pixels and add it inside your "container" view...
UIView *statusBarView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 320, 20)];
statusBarView.backgroundColor = [UIColor blackColor];
[containerViewController.view addSubview:statusBarView];
Then set the frame of your "contained" ViewController accordingly
containedViewController.frame = CGRectMake(0, 20, 320, itsCurrentHeight - 20);
This way the status bar should not overlap with your content anymore

How come a UIViewController's view coordinate system starts after the navbar, but its height includes the navbar?

I noticed that with a NavigationController on an iPhone, the height is 460. So it includes the whole screen except the status bar.
However, when I add something at coordinate 0, it shows up after the NavigationBar, although the size of the navigation bar is included in the height (meaning the entire frame of this view sticks off the screen).
Did I make a mistake? If not, why is it structured this way?
NSLog(#"Frame: %#", [NSValue valueWithCGRect: self.view.frame]); // prints {(0, 20), (320, 460)}
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame: CGRectMake(0, self.navigationController.navigationBar.frame.size.height, self.view.frame.width, 50)];
[self.view addSubview: scrollView]; // showing up 44px *after* the nav bar
I already answered your other similar question, but here is one for this.
In viewDidLoad you will see the views height as 460 because at that point it hasn't resized to account for the Nav Bar.
But If you printed the same frame out in say viewWillAppear you will see that now the frames height has adjusted for the Nav Bar.
So if you want to add something in viewDidLoad, you need to add it based on the views frame, add whichever resizing mask will do the job you want, and see it adjust correctly once the view appears.

Resources