Navigation bar and UIWebview - iphone

I am having some slight issue and trying to fix it but can't find the easiest answer towards it. I have a navigation bar, which is taking top pixels away, and hence the webview content last 44 px if I am not wrong goes under the bounce and hides the content. Hence the problem is that I have a submit button, and since it needs to be clicked, it goes under the bounce condition and doesn't let me select the button. Any quick solution to this problem will be appreciate.
Thanks

Make sure your UIWebView has the autoresizingMask set to be flexible in height and width. You can do that in interface builder or in code.

You can set the bottom content insets to 44. But it seems your view is not put correctly (web view size does not take navigation bar into account, web view is not resized properly, etc.) I would fix that instead of patching with the insets fix.

Related

How to get the visible view size in iOS13 when presenting a view controller

In iOS13, the default way when presenting a view controller was changed to the "sheets/cards" view. As I’m not using auto layout (why not, is not really important and relevant), I rely on getting position of elements based on the frame of the view.
Now, the problem with the new method is, that the view frame doesn’t really reflect the actual content size visible on the screen anymore. E.g. if I have positioned a UIButton at the bottom on the view controller based on the view.frame bottom coordinate, it will be now cut off, as the view is actually moved down in the amount of the nice "sheets/cards" visual indication at the top. The same problem is even more evident in an iPad, where centring another view in the view controllers view will be offset, due to the fact that the default presentation style is now a "sheet" in the middle of the screen.
I’ve currently changed everything to force the full screen version, but it would be nice to use the new fancy design.
Anybody has any idea how to get the actual visible rect/coordinates in the new style without changing things to auto layout?
Here are how they look. The "flower" is centered in the view and the X button should not be so close to the bottom or missing completely in the iPad version.
Finally figured it out. As I was setting the positions of items in viewDidLoad, the frame was not calculated correctly, thus resulting things being laid out incorrectly. When resetting the frame and positions in viewDidLoadSubviews, the positions were placed correctly.

How to make tableview's content displayed under a transparent navigation bar?

How to make tableview's content displayed under a transparent navigation bar?
Like this:In "Photos" app, albums displayed under navigation bar.
Special thanks
If you use _rootNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; then set correct tableview frame thats it. If you are in xib dont forget to simulate the translucent navigation bar.
One way I have found to accomplish this is by shifting your tableview's superview up to have the origin at {0, 0}. However after researching more several people have said altering the superview (UIViewControllerWrapperView) is a bad idea. However I also have not found any information on why just changing the frame would create problems. I am shifting the superview right now and haven't found any problems related to it yet.
Might be you can set it like this:
[navigationBar setAlpha:0.5f];
For making the navigation bar transparent alone, you can check this post, How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
Also check this How to set the transparency color for Toolbar and Navigation bar using MonoTouch?
I am not sure whether you can add the table view behind the navigation bar. You might have to add it as a subview of self.parentViewController.view.
Another way to do this is by hiding navigation bar and using a transparent tool bar in place of that. This can be added on top of the current view. The only problem is with the back button. You might have to use custom button for that.

nested NavigationController causing uiview resize

I have nested a navigation controller inside another and now its causing the uiview inside the nested navigationcontroller to resized weirdly.
Here are a few screen shots to show you whats going on.
This is with both navigation bars showing, as you can see the bottom extends further than the physical screen can allow.
this one only shows the sub navbar with the main nav bar hidden.. as you can see there is this weird space above the subbar that looks like the height of a status bar. i'm not sure what it is.
Lastly this shows only the mainnavbar being shown and the subbar being hidden..
the last view is what I would like to use, However.. if you look at the bottom of the view its only got a portion of the A's displaying.. however if you look to the view in InterfaceBuilder on the left you will see that interface there should be more letters there but strangely the view is not resizing to fit in the bound of the physical view...
I am wondering hopefully with the detail supplied if you can tell me how to get the view to resize correctly and fit everything in properly.. any help would be greatly appreciated.
I think you set the autoresizeMask property = UIViewAutoresizingFlexibleBottomMargin for these UILabel objects, you'll get the last UILabel aligned to the bottom of your UIView.

Why do my UIImageviews get resized/dimmed when using UINavigation/UITabbar controller

I have an app with a primary view that has a UITabBarController with 5 tabs. Each tab is a UINavigationController.
In interface builder, I'm customizing the background of each page by dragging a UIImageView and setting it fullscreen. The image I'm setting to the view is 640x960. I am setting it to be Aspect Fill.
However, what I've noticed is that it is not where I would expect it to be. When navigating between by tabs, the image seems to be shifted down from where it should be.
Also, when pushing a new view to the navigation controller, the background of this new view isn't offset in the same way as the tabbar one, and it is also slightly dimmed.
How can I set my UIImageViews on each page to be aspect correct and fill the screen 1:1? Also, how does one disable the dimming when pushing a view to the navigation controller?
Thanks for any tips, and apologies if this is covered in another thread, I couldn't find an answer searching the site.
Assuming that you are using the IB to setup your views, you should select navbar/tabbar options to reflect what will be on the actual page. That should place your image correctly. I would also recommend that you make both a low res and hi res version of your background images -- 320x480 and 640x960. Of course, your size may need to be adjusted (reduced) for the navbar and/or tabbar which will leave less than 960 px of vertical height -- probably more like 920px if you are in portrait mode. Then you add #2x to the base name of the hi res version, this would account for older iPhone screens.
Once you have the image placed correctly, resizing should be unnecessary. You can have the image automatically resize width and height using the little arrows on the layout page -- that's a bit hard to describe. It can also be done in code -- if you still need that I can provide a sample.
Maybe you need to set all AutoresizingMask in order to resize the UIImageView properly on each view. And to main aspect ratio u should use either AspectFill or AspectFit on the contentMode.

Animate the resizing of a UIWebView

I'm having a really hard time trying to animate the resizing of a UIWebView, and just don't know where else to go.
Here's what I want to accomplish: I have two views, one above the other (imagine two squares, one on the top of the other). The top view is a UIWebView, and the bottom one will be referred to as a general UIView (I'm not having any problems with the bottom one). I adjust the two views every time new content is loaded just fine. I also have a button that should hide the bottom view or show it, depending on its previous state.
That's where the problem kicks in. When the bottom view is hidden, pressing the button will enlarge its frame and reduce the UIWebView frame. That's fine. But if the bottom view is being shown and the button is pressed, the UIWebView frame will become larger, and there are some issues with it:
If the UIWebView is scrolled all the way to the bottom, it "jumps" up a little bit before coming down (becoming larger);
If the UIWebView is scrolled all the way to the top, it comes down as expected, as long as there is enough content to be scrolled behind the bottom view.
In general, what I've learned is that if the content yet behind the bottom view is LARGER than the amount of resizing happening, no jumping happens. Otherwise, it does.
I've done a lot of research, asked a previous question and so I'm assuming this is a consequence of lazy loading the UIWebView. This "jump" happens so that it is automatically resized (showing all the content, even if some of it is offscreen) and then moves down. Otherwise, it would be expanding and loading new content at the same time, requiring a lot more processor power.
I've experimented with frames, bounds and centers, and so far have got nowhere. Is my assumption correct? Is there no simple way to resize way to resize the UIWebView so that it goes only down (when becoming larger) and keeps the bottom scroll?
In theory, I think the right way would be to make the UIWebView larger to the top, keeping its current bottom position, and then animate bringing it down. This way, the top content would already be loaded. But I haven't had any success with it.
If anyone has any experience with this, please share. And thanks a lot.
If scrolled to the bottom of a tall enough web page, try animating the web view downwards without changing it's size, then change the web views height so that the top goes back to where it should be. You can temporarily fill the space left as the web view moves down with some sort of pattern.