문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top