Adding a Subview on top of a Table View Controller in a specific location of the screen - ios

I have a TableViewController and would like to have a button over top of it in the bottom right corner, about 50x50 for size. I think the best way to do it is to load the button as a subview over the main TableViewController. But I can't figure out a way to do it.
How do I properly configure the xib file, the swift file to go with the xib, and then how to I create and locate the subview in my TableViewController.swift?

The best approach is probably to create a ViewController with your button and a TableView as subviews.

Related

How to put a UIView in a UITableView and It will be pinned on the bottom

I am trying to build a UITableView Controller, which will be my app's ABOUT information session.
At the bottom of the view, it will be reserved as circle menu. So I need a UIView with height of 200 there, when I drag a UIView to the controller, it always sit as a table cell.
As you can see, the red area always sit under the last table cell group, how to pin it on the bottom of the View Controller.
Thanks in advance.
You can't add a UIView at the bottom of the UITableViewController. If that is a hard requirement you have to switch to UIViewController. And then you can use UITableView and other UIView's as well.
If you are using a navigation controller with UITableViewController then you can use UIToolBar which sticks at the bottom of view controller but have some limitations too. See this
Get UIView controller and put tableview instead of UITableViewController. From side inspector drop UIView out of tqbleview. And in inspector menu for UIView set auto resizing mask for UIView according.

Why are my views inside the storyboard tableViewHeader visually misplaced?

When adding a tableview header in storyboard, by dragging a view onto the header area, subviews inside this header view seem to be visually misplaced. Is there a logical reason for this?
Reproducing the problem (Xcode 8):
Open storyboard
Drag a UITableViewController onto the canvas
Drag a UIView onto the tableview header area
Add any view as a subview on the header view:
This issue is only visible in storyboard though. At runtime, the views are aligned as expected.
Easy fix: Dont drag in there, drag it on the above like this, since you treat it as a view property to the view controller, not to it's view, when you drag into the view, it will treat your header view as a subview to the content view, that's not what you need
This issue is also applies to xib. When you drag views which the Simulated Metrics size is freedform onto tableView, system will treat the first subview as tableHeaderView, the second subview as tableFooterView automatically.

UITableViewController, Storyboards and UIKeyboard

I am trying to create a UI just like Facebook's comment screen on mobile.
I got a UITableViewController on my storyboard. I need to insert a view docked to the bottom of the screen to place a text field. Since the tableview is taking the full screen, I can't do it on storyboard and I think I need to do it programmatically but how? Should I modify the constraints that stretch the tableview to the edges and insert the views or what?
Thanks.
You can always add table view to normal UIViewController and below it add another view.

Scrolling up UICollectionView don't move a UIView above it

I am working in a profile ViewController. This profile has a main image in a UIView subclass and a CollectionView gallery with some images. I would like to be able to scroll up the UICollectionView and move the UIView too, and if I scroll down, I want to watch again the UIView when the collectionView first item is showed again.
I have tried to do this adding the collectionView and the UIView to a ScrollView, but the UIView only scroll up if I touch it.
In this picture you can see my problem
Thank you in advance
You need to make the view at the top a Header View of the collection view.
Essentially it needs to be an actual part of the collection view if you want this action. (That's the easiest way anyway).
So the collection view will take up the whole screen but it will have a header view. Then when you scroll the collection view the header will move out of view and then come back in when you scroll down again.

iOS iPhone mapview with slide-up scrollview - How to set up?

I am struggling with how to set up the following view arrangement. Not sure what viewcontrollers I should use. Should I use a container view (I'm only supporting iOS6+)?
I have a screen that contains a mapview (and view controller) that is working great. I want to add a view to this screen that slides up from the bottom to partially cover the mapview. This subview will be a scrollview and will have a small handle that is visible even when closed that a user can drag up to open or down to close. When this drawer view is open, the user can "page" left and right through a list of objects and the map will update accordingly.
I don't need any help with the map view or scroll view individually, only how the generate this screen with the multiple views.
Everything I have done thus far is via Interface Builder.
Thanks!
You could create a empty xib (UIViewController) and add this Xib file as subview of the main view. Next add a gesture recognizer to the main view (https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html), on the right gesture slide the subview up (http://www.raywenderlich.com/2454/uiview-tutorial-for-ios-how-to-use-uiview-animation).

Resources