How do I bring the subview over the scroll view on iOS? - ios

In iOS development, I want to add a subview in a viewbased application. I am having scrollview above that am having views containing labels and I used Interface Builder to design these views.
How do I bring the subview over the scroll view?

The way I do do this in IB is set the View Mode in the document window to Outline View (2nd button). Then I drag the view from the library on top of the scroll view and it will be inserted as a subview of the scrollview.
If you get a disclosure triangle next to your scrollview it will have had the new view inserted as a subview.

If you mean in the xib, drag the scroll view in first then drag your other subviews onto the scroll view.
If you mean programmatically, this should work:
[scrollView addSubview: mySubview];

Related

Rounded button above the UISCROLLVIEW

I have been working in a project which has a uiscroll view where the uiscroll view size is set programatically with height 225 and width is self. I have created two uiimageView where it displays two images and I have animated it by moving using a page view controller. Finally the image moves atomically like a slide show with page view controller. I have removed the navigation controller do I need to keep a back button for navigation when I place a unbutton above uiscrollview it was stating like scrollview ambitious scrolling content. I need to place a rounded back button above scroll view. I have attached the image of my storyboard. When I tried to place a button it is not visible in stimulator header scroll view is the UISCROLLVIEW where the animated image is placed

UILongPress Drag into a UIView within a ScrollView

I have a scrollView called sidebar. When I drag my finger on the screen close to the edge of my phone the sidebar pops op. Within the sidebar are UIViews that are subviews of sidebar. Additionally, each view is associated with a viewController. So each view is a subview and the corresponding controller is a childViewController of the subview. How do I recognize when my UILongPress has entered one of the views in my scrollView

Hide Bottom Bar When Pushed through Autolayout

I have a UITabBarController with one UINavigationController holding a UIViewController as root view controller.
when tapping one of the button in the UIViewController, I push a regular chat window UIViewController (with TableView + Input View) end hiding the bottom tab bar. (using the "Hide bottom bar when pushed" flag)
In storyboard I added a regular UIView subclass to VC that look like a bottom bar, and I use Auto Layout to pin it to the bottom of the VC view.
The problem
when I push VC it takes a second for this view to pin to the bottom, it looks like auto layout pin it to the bottom as if the tab bar is not hidden and after a sec it recognise that the tab bar is hidden and moves it to the real bottom of the view.
For clear info check this screen shot
Now I will let you the know the constraints of the table view..
Now I am showing the constraints of the InputView
I am also adding my View hierarchy...
I had a similar issue in my project. I solved it by selecting the view I wanted anchored to the bottom (in your case, the input view), held Command, and selected its superview (both views should be highlighted now).
Then I selected the align button at the bottom of IB:
And added a Bottom Edges constraint.
What I had done initially is used the pin menu to pin the view to its superview, but it appears that will pin it to the bottom layout by default, which causes that weird movement during the transition.
EDIT:
After seeing the latest screenshot, the problem could lie in one of the superviews. I'm assuming that chatWindow is a UIView, and your Scroll View is horizontal only. Here's what your should check:
chatWindow is pinned to the scrollView's bottom similar to what I've outlined above.
scrollView is pinned to its superview as I've outlined above.
Moving the inputView outside of the scrollView to the root superview. Then one by one move it down the hierarchy towards its current location.

UIToolBar under navigationBar without toolbar moving on scroll

I'm trying to add a toolBar under the navigationBar in a UITableViewController. This can easily be done by StoryBoard Builder, but when i scroll down or up it will scroll. My question is then how i can add a Toolbar under navigationBar without the toolBar moving on tableView Scroll?
illustration
Don't use a table view controller. Use a simple view controller which has an explicit outlet to a table view which is a sub view. Then you can also have a sub view which is the toolbar above the table view (and anything else you might need above or below the table in future).
Alternatively you can set the tableHeaderView (and tableFooterView) of the table view itself.

Why is a UIToolBar's height not being taken into account by bottomLayoutGuide and automaticallyAdjustsScrollViewInsets in iOS7 (with autolayout)

I haven't been to find anything about this, and it may be that there is no easy solution.
I have a scroll view (in this instance a UITableView) which is the first subview of my UIViewController's view (which is not itself a scroll view). This view controller is in a UINavigationController, and I have also added a UIToolBar as second subview of the view controller's view. Both the table view and the toolbar are positioned and sized in the view controller's view using autolayout (with the table view filling the view, and the toolbar being pinned to the bottomLayoutGuide of the view controller).
As I understood it, navigation bars and toolbars (which are pinned to the bottom of views) should influence the topLayoutGuide and bottomLayoutGuide of the view controller, and by this influence the contentInset of contained scroll views.
The navigation bar is being taken into account (by the topLayoutGuide and automaticallyAdjustsScrollViewInsets) so that my table view content scrolls underneath it, but is visible below it, but my UIToolBar is not - either by bottomLayoutGuide or automaticallyAdjustsScrollViewInsets. This behaviour is the same even if I position my toolbar with a frame (not using constraints).
Am I right in thinking that a UIToolBar pinned to the bottom of the view controller's view should be taken into account by the layout guides? If so, does anyone have any ideas as to why it is not?
If not, is there anywhere (amy method) where I can manually add the tollbar frame to the bottomLayoutGuide so that it is automatically propagated by automaticallyAdjustsScrollViewInsets? And if not, in what method is it best to manually set the table view's content insets?
If you added one yourself it would just be a subview and would not affect the layout guides. Use the built in UIToolbar by setting the UINavigationBar .toobarHidden = false property. Then set the UIViewController.toolbarItems = ...
This toolbar will be your bottom layout guide

Resources