Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 6, 2009, 10:08 AM   #1
arnieterm
macrumors regular
 
Join Date: Aug 2008
A simple design question

After much reading through the documentation, I am clueless in a design related issue. My problem is as given below:
There is one main UIView viewMain that has three UIView in it
1. viewheader
2. viewDetails
3. ViewBottom
My application requires that sometimes based on contents of the viewHeader and viewDetails may increase more space than given in design time like some labels may go in more than two lines etc
Is it possible at design time that when the subviews in viewHeader and viewDetails resizes these two views also resizes so that viewDetails move some space down so as to make room for viewHeader. Same is expected for viewBottom
It seems to me that I am still not able to understand the autoresizing behaviour of views and their containers
Thanks
Arnieterm
arnieterm is offline   0 Reply With Quote
Old May 6, 2009, 10:31 AM   #2
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Autoresizing works in relation to changes to the superview and not sibling views. I suspect what you'll need to do is programatically adjust the frames of these views in relation to the changes in the other views.
__________________
dejo is offline   0 Reply With Quote
Old May 6, 2009, 10:44 AM   #3
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Various comments:

Typically views automatically resize when a) their superview resizes (automatically or not), b) after autorotation, and c) when a view controller is pushed. Other than that if you want to resize a particular view you need to have code somewhere that causes it to resize. That would usually be in its view controller or in its superview. layoutSubviews is common place for this kind of code to take advantage of the existing infrastructure to layout views.

Obviously the autoresizing behaviour is based on the autoresizeMask property. Not so obviously, autoresizing behavior is based on a superview-subview relationship. Peer views aren't involved in autoresizing. So if a superview is resized in code or because of a rotation it will resize its subviews. But it's not possible to directly express the relationship of two peer views to each other. You can only express the relationship of two peer views to their container view. If there needs to be a relationship beetween peer views it needs to be implemented in their containerView or view controller.

In your example I don't think there's an automatic way for a superview to resize based on its contents. You can't make viewDetails automatically get bigger because its subviews get bigger. You can however implement layoutSubviews in viewDetails to do this. You would then update the contents of the subviews and then send setNeedsLayout to viewDetails. For labels you can use sizeToFit to have them adjust their sizes to their contents. In the viewDetails layoutSubviews it would check the sizes of its subviews and then position them according to your design.
PhoneyDeveloper 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
Simple Graphic Design App DunellenGuy Mac Applications and Mac App Store 5 Apr 4, 2014 08:17 PM
Simple Photoshop/graphic design help Underthemoonicp Design and Graphics 4 Mar 8, 2014 05:41 AM
Simple Graphic Design Question macuser1232 Design and Graphics 26 Nov 14, 2013 10:25 AM
simple graphic design program? ThereGoesJB MacBook Pro 2 Apr 22, 2013 02:43 PM
LinkedIn Overhauls iOS App with Simple Design and Enhanced News Stream MacRumors iOS Blog Discussion 9 Apr 19, 2013 08:38 AM

Forum Jump

All times are GMT -5. The time now is 04:19 AM.

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

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