UIView changes when iphone application starts from background
My iphone application has a us开发者_运维问答er form under UIViewController
.
When I out of application (go to background mode) and start application again some of my UIView
changes its positions and sizes. (These UIViews
depend on keyboard position)
Definately somewhere is my fault.
I try to figure what is going on when application starts again from background and where the UIView
changes can be done.
May be you can suggest any links to read.
Thank you.
The UIViewController's viewDidLoad
and viewWillAppear
methods get called every time the view is dumped from memory, something that commonly happens when the app goes into the background. Depending on your code, it's possible that you're storing some position data that's not getting cleared. If that's the case, you can either:
Change your code to better fit the Model-View-Controller pattern so that the positioning code and variables are all in the controller, and you appropriately clean things up in its 'viewWillDisappear
and
viewDidUnload` methods (the better way), orClear out whatever remnants are hanging around in your application delegate's applicationWillEnterBackground method.
精彩评论