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

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.

Related

Table view header, storyboard, Xcode 11?

In XCode 11,
new storyboard,
add a UIViewController (sic: NOT a table view controller),
hit the + symbol top right,
drag a table view into the view controller.
Perhaps add four constraints so it is simply full-screen.
Table view attributes inspector, perhaps set Prototype Cells to not-zero, say 2.
How do you now add a header view to the table view?
(The header view should (obviously) be able to handle dynamic height content.)
The easy way of to achieve adding HeaderView to UITableView is.
Plus + button from Top Bar and Select an UIView
Then in hierarchy add the exact bottom of the UITableView.
See the image.
Your UIView element must be like that in the hierarchy.
Then the UIView calculations for dynamic view upon to you.
(You can create an IBOutlet of the this UIView and do some calculation in your UIViewController. )

Need assistance showing custom UIView when UITableView is dried down

I am trying to achieve whatsapp style drag tableview to show custom view, here is the screenshot
but I am clueless how to show custom UIView on top of UITableView when UITableView is dragged down
You can place your UIView behind the table view, and have its height grow as you drag down. Where you read the scroll offset for your table views scroll delegate.

Adding a fixed-position view on top of a view

I have a UITableViewController inside a UINavigationController. I'm adding a "modal" subview to the tableView, which is a custom UIView when one of the rows is selected.
(It’s modal in spirit, not in the UIKit sense, since Apple doesn’t support modal views on iPhone, I’m adding it with a [self.view addSubview:customView] in my table view’s controller.)
I would like it to appear at the bottom of the screen and stay put there. I can get it to draw at the bottom, but once I scroll the table view, the view moves with it. Here are some illustrations:
Initial position (good):
Position after scrolling (bad):
I'm getting the bottom position by subtracting the height of all the chrome (navigation bar and status bar) as well as the height of the custom view from [UIScreen mainScreen].bounds.
How can I get the custom view to stay put? Should I constantly be adjusting its frame when the table view is being scrolled?
Your best and most flexible option is to switch to using a view controller with the table view as a subview so that you can change its frame and add sibling views. Then, when you want to add a modal you can run an animation to move the table view out of the way and slide the modal view in.
UITableViewController.view is an instance of UITableView. Means you added your custom view into a scroll view and that is why it scrolls. You can try to put your custom view into the tableFooterView property of the UITableView, which is the old school solution.
Personally I would create a container UIViewController and have UITableViewController be a sub viewController of it. Another sub viewController UIViewController or just a simple UIView could represent the footer.

UIView overlaps UISegmentedControl

In my app, I want to add a UISegmentControl on top of a UIView.They are siblings of a parent UIView.I pull a UIView to the canvas from object library first, and then pull a UISegmentControl second,but unluckily the first added UIView overlaps the UISegmentControl. What I want is that UISegmentControl is on top of the UIView. I mean UISegmentControl z-index is higher than the UIView.
The following is the screenshot.
One potential solution would be to programmatically send either the UIView to the back or the UISegmentedControl to the front in viewWillAppear(animated:) using parentView.bringSubviewToFront(segmentedControl) or parentView.sendSubviewToBack(otherView). It doesn't solve the issue of the incorrect appearance in your storyboard but it ought to fix the issue once the app is running.
1) First reduce the width and height of the overlapping view to understand its location in view hierarchy. Share your view hierarchy here so we can see in detail.
2) Delete everything from storyboard. Add UIView and then add any subviews. These 2 controls should be children of UIView in view hierarchy.

UIView not appearing on xib

I am trying to make a UIView appear as a rounded box on terms and conditions screen as seen here
When I add an UIView to the xib IB the UIView doesn't show up. But if I add a UIButton to the view then I see the view. How can I make the UIView always visible to a specified frame size?
The problem was that I didn't connect the view to the controller.

Resources