|Dec 7, 2012, 04:33 PM||#1|
Auto Layout and Hiding Embedded View Controllers
so I'm having a hell of a time with Auto Layout. I have an iPad app and within it, I have a parent view controller which has two embed views on it. I have the children views all setup and working and wanted to have a button which could hide the smaller view and have the larger view expand to take up the extra space. I have that part working, but what I'm having trouble with is that the larger view controller has a table view in it, which normally sits at the bottom of the view. When the embed view grows to take up the extra space (it moves up on the screen), the table view also moves up.
I cannot for the life of me, figure out how to get the table to stay at the bottom of the view. I've been playing with the constraints and none of the changes I make works.
For hiding the views, I get their current frames and then set new frames for when they're hidden/shown and animate those in an animation block. I'm wondering if maybe that has something to do with it? If so though, what's the best way to hide the views?
I made a sample app of what I'm dealing with, to easily show what's up. It's attached as a zip.
|Dec 8, 2012, 12:42 PM||#2|
I'm going to take it that you, like me, despise Auto Layout and would much rather not use it.
Just go in your interface file, go to the documents tab (the leftmost tab on the right pane) and uncheck "Use Autolayout".
|Dec 9, 2012, 03:47 PM||#3|
I've been looking into Auto Layout this week and so far am not impressed with the IB editing capabilities. Apple out right say in a WWDC 12 video that some things are not currently possible within IB, you have to use code.
For your table view problem you have to edit both the top and bottom vertical constraints. What I found is that for the same relationship, there can be more than one constraint created. The Priority of the constraint goes from 1000, required, down to 1, least wanted I suppose. For the bottom one you'd want a required constraint with an EQUAL qualifier, likely zero from your description.
I played with such a setup for an hour can although I think I figured out the vertical constraint, the horizontal one has me totally puzzled because the same relationship between my table view and it's containing view doesn't appear for the horizontal. Things get worse when dealing with a UIView!
Perhaps you can gain some insight by reviewing the following WWDC 2012 videos.
Session 202 - Introduction to Auto Layout for iOS and OS X
My App: CameraTime - Time lapse photography for novice and advanced users.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Xcode doesn't make View Controllers by default anymore||gwelmarten||Mac Programming||3||Feb 20, 2013 03:14 PM|
|Auto layout on image view||Chirone||iPhone/iPad Programming||3||Jan 17, 2013 06:13 AM|
|View based table view layout woes||Starfox||Mac Programming||0||Nov 8, 2012 10:50 PM|
|Views & view controllers - what is the correct way to structure?||MickeyT||iPhone/iPad Programming||11||Aug 8, 2012 06:29 PM|
|Passing Data between View Controllers : from uitableview to a details view controller||EliasRahme||iPhone/iPad Programming||7||Jul 20, 2012 08:04 AM|
All times are GMT -5. The time now is 06:26 AM.