开发者

UIView changes when iphone application starts from background

开发者 https://www.devze.com 2023-02-16 23:31 出处:网络
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

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:

  1. 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 'viewWillDisappearandviewDidUnload` methods (the better way), or

  2. Clear out whatever remnants are hanging around in your application delegate's applicationWillEnterBackground method.

0

精彩评论

暂无评论...
验证码 换一张
取 消