dark grey layer appears on the top of my webview with navigation controller - uiwebview

I've a UIWebView. Everything is fine if I don't add navigation controller. But If I add, a dark grey layer on the top of my uiwebview appears. I don't understand what is wrong, I'm just adding a uiwebview and haven't written a line of code about sizing or layout.
http://i.stack.imgur.com/KRTuU.png

This is probably because your navigation bar's translucent property is set to YES. Set it to NO and the dark grey background will go away.

You can hide that navigation bar by adding this:
self.navigationController?.isNavigationBarHidden = true
to the view controller's ViewDidLoad()

Related

Attribute inspector for buttons has no background color

Sorry but looks a simple question. In the attribute inspector menu of all my buttons the background color option menu/property disappeared in Main storyboard. I cannot change the color. I can change the text color, the shadow color, the background gives only the option of images but no color?? I rebooted xcode, and the MacBook as well.
I found the issue. On the attribute inspector at the very bottom there is the view section. On the right of the View there was missing "show" word, looks like a bug and that's why I have not seen that I could expand the view. Now that I expanded it I can hide and show with this right button and the keyword show is there again.

Vaadin 8 View: No horizontal scrollbar on window resizing

I have a Vaadin 8 application with several views.
public class ViewName extends Panel implements View {
There is a VerticalLayout as main layout in the panel.
public ViewName() {
setSizeFull();
VerticalLayout mainLayout = new VerticalLayout();
setContent(mainLayout);
Then I have many different layouts (HorizontalLayout, GridLayout) or Components such as Label being added as components to the mainLayout. For the HorizontalLayouts I often do the following to use the full width of the screen:
hLayout.setWidth("100%");
I have a lot of icons, grids etc. Everything is OK as long as I don't resize the window.
When I resize the window to a small size I get a mess (icons, text etc. on top of each other) and no horizontal scrollbar. (However, the grids get horizontal scrollbars.) I have tried many things to fix this. If I add
mainLayout.setSizeFull();
or
mainLayout.setWidth("100%");
I have a mess on the big screen already. I also tried the CSS for the mainLayout as described here. I get several scrollbars but none for the window itself!
The only component that resizes correctly is a Label added to the mainLayout, e.g.:
Label title = new Label("Some text",ContentMode.HTML);
title.setWidth(100, Unit.PERCENTAGE);
mainLayout.addComponent(title);
mainLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
I also noticed that anything in a GridLayout seems to stay in place after resizing but is not vissible since I have no scrollbar. However, icons in a HorizontalLayout get on top of each other.
What is wrong? Please, I need a general instruction on which layout I should use as main layout for my view panel, how to size the components and how to get ONE horizontal scrollbar for the main window if necessary.
The problem is that you are setting the width of your mainLayout to the width of your view. This means, that your mainLayouts width will never be bigger than your views width. So no scroll bar will appear.
According to the information you posted, changing your mainLayouts width to undefined should fix the problem.
mainLayout.setWidth("-1px");

Slide UIWebView over a ImageView (like safari)

I think the title says everything about my problem.
The ImageView is not in the UIWebView.
I want that the ImageView is pushed up by the WebView.
It's actually pretty simple. If you go into your storyboard (or nib) and choose the the webView and choose a color for it's background property, anytime you scroll above the view that background color would appear. So all you need to do is load an image for that background color.
In your viewDidLoad method, place this bit of code:
self.webView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"background.png"]];
and where it says background.png
just put the image name that you loaded into your project.
Hope this helps!

How to stop view resizing after unhiding the NavigationBar

I have a view with a UITabBar and the navigation bar is initially hidden. When I press the next tab I want the nav bar to be shown, but when I do this using setNavigationBarHidden: the view gets resized, and the tabbar is pushed out of the screen. How do I setup the views to where they won't get resized? Or get resized properly?
You will have to check your autoresizingMasks. You can adjust them programmatically or via IB. Autosizing is available in the Size Inspector on the right.
You will mostly have to change the tab bar's mask to fix it to bottom and left. Rest of the subviews will have to be handled as needed.
[self.navigationController setNavigationBarHidden:NO animated:NO];
or
after that
set urview frame to exactly for 44reduce(which is navingation bar height) from height.

ScrollView as subview does not respect frame boundaries

I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not.
The subview is positioned so that it takes up about the bottom half of the screen, with a small - 20 pixels or so - margin at the bottom.
Initially it displays in the correct position but overwrites the bottom margin - even though the scrollview's frame is set to leave the margin.
When I scroll the view up by dragging it, the whole view moves upwards and obscures the top of the window. The frame stops moving when it hits the navigation bar at the top and starts scrolling like a normal scrollview. If I scroll it enough it eventually reveals the margin at the bottom of the screen.
I am at a loss to know what to do - I've tried every spring combination I can think of. I'm now looking at subview clipping.
Images below. The first shows the scrollview on initial page load, positioned correctly aside from lower margin overwrite. The scroll view has a white background.
The second image shows it scrolled up toward the top:
The third image shows it scrolled all the way up to the top - note that the lower margin has become visible.
I'm not 100% sure on this one, but worthy the shot: my guess is you're likely not setting the Bounds property correctly on your table.
To solve this issue, the easiest way would be to set myscrollview.clipsToBounds = true.
Something is definitely wrong here. I think what happens is that you are adding the same instance of scrollview as a subview on itself. So basically what you are left with, is one instance alone. Anything you add to the "subview", is basically added on the superview, since it is the same object.
For example, this is what I think you are doing in the view controller:
//...
private UIScrollView myScrollView;
public override void ViewDidLoad()
{
this.myScrollView = new UIScrollView();
this.View = this.myScrollView;
this.View.AddSubview(this.mySrcollView); // same instance
this.myScrollView.AddSubview(aUIButton); // "aUIButton" will be added in View also, since it is the same object
}
If this is the case, it is wrong. I suggest not changing the controller's view at all. If you want to have a controller that has a fullscreen UIScrollView, just create it and add it as a subview, making sure the AutoSizesSubviews property to true.
That's my understanding at least.

Resources