I have a problem with an old project (Objective-C and No Auto layout).
I am trying to update some logic but I have a problem with a controller.
The structure of the controller is the same as the image attached
I have the problem that when I scroll up the tableView, the scrollView covers the button container view.
How can I solve this issue? I need that the scrollview does not cover that bar.
did you try to have another viewContainer where you put on the tableView and the Line Color?
Basically you need to have something like that:
View
viewContainer (Table View Container)
tableView
Line Color
viewContainer (Button View Container)
button
Related
I have created a view and the content is larger than the screen. How do I add this view as a subview of a scrollview? For some reason I can't do this in Document Outline. It will only let me add the scrollview as a subview of the existing view.
Select your view in Interfacebuilder and then use the menu command Editor:Embed In:Scroll View
Recently I'm testing to do a very complicated view in xcode using nothing but scrollview and programatically added imgviews. Like this
What I did is, I put a UIView called contentview in a scrollview and I then add a lots of ImageViews in the contentview. The real thing is much much complicated than the illustration so I can't use tableview. Sorry for the poor illustration but I think you will get the idea.
Everything is fine until I tried to add the last constraint in code, which marked red in the picture. When I did it, it breaks the entire chain of constraint.
In another word, this is working
V:|-[view1(30)]-[view2(30)]-[view3(30)]
This is not
V:|-[view1(30)]-[view2(30)]-[view3(30)]-|
And btw, what is the proper way to do it anyway? I tried to add imageviews directly into the scrollview itself but I can't make the view to use autolayout like this
H:|-[view]-| The superview here is a scrollview
The result, this view will be very narrow in width. I guess scrollview doesn't have a width value or sth? that's my guessing. That's why I added a contentview as a holder for all the imageviews.
Try this, it will work. - http://natashatherobot.com/ios-autolayout-scrollview/
To summarize -
Add scroll view to main view.
Add a UIView (lets call it content view) to scroll view.
Now add all your views to the above UIView.
For each of them set the constraints so as the separation on all sides is 0. And finally add equal height and equal width constraints between the content view and the main view.
Ok, finally I did my own work.
The key to make scrollview and contentview and everythin else inside work automatically using nothing but autolayout is this.
1, Manually add scrollview to self.view, and a contentview to scrollview. Set both scrollview and contentview to setTranslatesAutoresizingMaskIntoConstraints(false)
2, set scrollview to H:|[scrollview]| and V:|[scrollview]|, set contentview to be H:|[contentview]| and V:|[contentview]|
3, Now try to add Views to content view and set their constraints to the contentview. You should see that when the views are larger than the current window size, the scrollview started to scroll. IE, this setting will automatically set the scrollview.contentSize using autolayout
I am trying to place a tableView in a specific position in ViewController (from half of the page to bottom). But anytime when I am trying to use Constrains the tableView is getting lost somewhere (even if I add Horizontal and Vertical centre in container)
here is the image of my storyboard in assistant editor and view controller scene
and here is a image after adding constrains
Actually I just fixed in the simplest way by just adding missing constrains.
Can anyone please tell me how to fix the following issue.
I am building an iPhone app using Storyboard. I have a Navigation Controller as root view and off that a view controller. On this I have a few buttons that when clicked takes you to a table view controller. All fine and well, but when I link the buttons to their respective table views, the top navigation bar obscures the top cell in the table view controller.
Does anyone know why this is happening and how I can fix it?
Also it seems to have thrown off my layouts from the view controller from which they inherit.
See attached image for a better explanation perhaps.
I believe this is the intended behavior when using the translucent navigation bar. It's semi transparent specifically so that you can see items pass behind it (e.g. a table scrolling). If you don't want this, changing the navigation bar's style to opaque should solve the problem.
Since I wanted to keep the translucence, I just added a UIView between the navigation controller and the prototype cell (width of the view, height 60). That way the first cell in the table starts beneath the navigation bar but I can still see the scrolling underneath.
This is a bug/feature in IB when you use a translucent navigation bar, the content view runs under the navigation bar. For non transparent bars the content view begins after the bar. If your content view is a UIScrollView (UITableView is a descendent of UIScrollView) the content will be automatically scrolled so as to not be hidden under the navigation bar. So the problem only exist in IB when you run the app everything should be ok.
You just need go to the Navigation Controller properties, then Simulated Metrics, and change the Top Bar to be a Transluscent Navigation Bar WITH PROMPT. And that should be it. No need for that extra UIView
How can I properly edit a a ScrollView that is a child of a View in Xcode 4.
I have a really long ScrollView (over two pages with lots of controls) and XCode does not let me see the entire scrollview when it is embedded in a View xib.
How am I supposed to be able to edit the ScrollView in interface builder?
Looks like you're taking the correct approach (as per this stackoverflow question) you just edit it side-by-side like you have in your screenshot and then nest the scrollview back into the view before running the app.