I have a UITableViewController with 3 static cells. The second one is a container view.
This container view is a UIViewController form with some UITextField's.
When I touch any of UITextField's it does not scroll to the right position, above the keyboard and in the visible area. Every textfields goes out of the screen.
I'm used to implement forms with UITableViewController and it always works good, but it's the first time I implement it with a form inside a container view. Any solutions?
Related
I have a table view controller which contains a view and below that, 2 container views. Each container view containing individual tableviews with some data (see diagram).
A segment control is used to switch between which of the container views are visible.
The content within the container views extend beyond the height of the main screen.
Currently the parent tableview controller is scrolling independently to the table views within the container views which is expected.
How can I sync the container views and parent tableview to scroll together?
Current hierarchy is shown in the diagram below:
Current view controller hierarchy
Usually having this kind of UX/UI is not a good idea. I personally hate this UX.
But to answer your question, you could observe for the contentOffset property of both child tableViews using KVO and update the parent tableView's contentOffset accordingly by doing the appropriate calculations.
Btw, you could use a regular UIViewController and UIScrollView as a containerView instead of the UITableViewController
The ideal approach for me is having a SINGLE tableView, and loading all the content dynamically. F.e. you could have the segment control (and all static data) in the tableViewHeaderView, and depending on which tab is selected you could update the content of the tableView accordingly by switching the array of the first tab's datasource to the second tab's, and vice-versa.
Even if the UI of the cells differs for both tabs, you could dequeue two different cells depending on the selected tab.
I have two container views controlled by a segment controller. When the selected index changes, one view is set hidden and the other one is set visible.
One view contains a tableview, and the other one is a Google Maps view. I tried to remove the Google Maps view completely to see if the scrolling in the tableview would be better, and that fixed the laggy scrolling. So I know that it is the hidden mapView that makes the tableview scroll slowly.
My question is: How can I keep both container views and still have smooth scrolling when the tableView is visible? Setting the container view with the mapView to hidden does not work.
If anyone else has this problem, try to follow this blog and add the views by code instead of using container views in IB. It fixed the problem, and the tableview now scrolls like a pro!
cocoacasts.com/managing-view-controllers-with-container-view-controllers/
My buttons and textviews are displaying properly inside the container view but they are not responding to clicks/taps. The container view's height is set to the regular portrait size (780). The container view is placed in a scroll view
The view controllers you get out of the container are independent controllers. Don't forget to set delegate there.
I have a static UITableViewController embedded within a UIContainerView. All created using Storyboards.
I'm setting the positioning of the container view using autolayout, whereby it is always touching the top, left and right of the uiviewcontroller it is within and always 50px from the bottom due to a UIButton being there.
The UITableViewController has a larger content size than the height of the container view, so one would expect you to be able to scroll the tableview from the container view.
But for some reason I cannot get it to work, when you initially load the UIViewController the scroll indicator appears and then hides and it won't let you scroll the tableview. How would I solve this?
(It has previously worked for me, I just can't remember what I did.)
I'm trying to add my custom ContainerView to an usual ViewController using StoryBoard (iOS7).
I only have a TableView Controller on this view. If I move the ContainerView inside the TableView it is displayed (but moved with the table items), but if I place it directly on view it is not displayed any more! Any ideas?
There appears to be a bug in Xcode/iOS where if the container view is the first child of self.view in storyboard, it doesn't show. For example when I have:
my container doesn't show.
But if I move the label above the container view in the outline:
Then my container view and the label will show.
UPDATE: Upon further investigation it appears the container view does still show if it is the first child, just much lower than you would expect it to appear. Placing another element above the container view allows the container to appear in the position you would expect (the position shown in storyboard).