Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 7, 2012, 05:33 PM   #1
isthisonetaken
macrumors regular
 
Join Date: Jun 2006
Auto Layout and Hiding Embedded View Controllers

Hey All,

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.

Any ideas?
Attached Files
File Type: zip AutoLayoutHELL.zip (35.4 KB, 15 views)
isthisonetaken is offline   0 Reply With Quote
Old Dec 8, 2012, 01:42 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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".
ArtOfWarfare is offline   0 Reply With Quote
Old Dec 9, 2012, 04:47 PM   #3
xStep
macrumors 68000
 
Join Date: Jan 2003
Location: Less lost in L.A.
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
Session 219 - Advanced Collection Views and Building Custom Layouts
Session 228 - Best Practices for Mastering Auto Layout
Session 232 - Auto Layout by Example
__________________
My App: CameraTime - Time lapse photography for novice and advanced users.
xStep is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Xcode doesn't make View Controllers by default anymore gwelmarten Mac Programming 3 Feb 20, 2013 04:14 PM
Auto layout on image view Chirone iPhone/iPad Programming 3 Jan 17, 2013 07:13 AM
View based table view layout woes Starfox Mac Programming 0 Nov 8, 2012 11:50 PM
Views & view controllers - what is the correct way to structure? MickeyT iPhone/iPad Programming 11 Aug 8, 2012 07:29 PM
Passing Data between View Controllers : from uitableview to a details view controller EliasRahme iPhone/iPad Programming 7 Jul 20, 2012 09:04 AM

Forum Jump

All times are GMT -5. The time now is 09:10 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC