Question

I am using IOS 5. I am a very beginner in IOS. In my project i have 2 xib files. One is a UIView and other is a UIViewcotroller. The UIViewcontroller is having 3 views(TopBar,ContentArea,BottomBar). uiview also has 3 subviews. I added UIView as subview of UIViewController. My requirement is change the UIView height when i hide topbar only, bottombar only, topbar and bottombar.

Hope you can help me.

Thanks in advance.

Was it helpful?

Solution

set the views as properties,

@property (nonatomic, retain)UIView *element1_p1;

then when you need to change the size, change the frame,

self.element1_p1.frame = CGRectMake(center.x,
                                    center.y,
                                    elementWidth, elementHeight);

I recommend doing an animation for the change of height, so it feels better UX

great tutorial for changing views properties with animation

OTHER TIPS

UIView has method as setFrame to resize the view.

Read this and this - you will get an idea how subviews respond to parent view's frame changes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top