문제

I created a view controller and set its frame.y to 80, later I need to show another modal view controller when the modal VC dismisses, the viewWillAppear of the first view controller is called, then its frame.y is set back to 0.

Can I prevent this behaviour? I know I can in its viewWillAppear reset the frame.y to 80. But is there any smarter way?

도움이 되었습니까?

해결책

This may be happening because of AutoLayout... Try NSLogging to see if the variables changes when ViewDidAppear is being called or after it is done being called... What about ViewDidLoad? In your .h file you could create and integer and in the ViewDidLoad set it equal to frame.y, then in ViewDidAppear after is has been reset to zero just change it back to that integer... that way you don't have to worry about the hassle of changing that piece of code every time you adjust the size in the xib file.

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