开发者

UIPickerView Causing Crash in iOS4

I have a simple tabbar app. Built directly from the tabbar template. As I test the app, I notice that the app sometimes crash. After pinpointing the right sequence, I found out that the app will crash if I do this:

  1. Run app. Open the view that has a UIPickerView on it.
  2. Open another view.
  3. Tap home button (this will send the app to background).
  4. Tap the app icon again to bring it at the front.
  5. Tap the view that has the UIPickerView in it.
  6. Crash!

Checking the console shows: -[UIPickerView setFrame:]: invalid height value 130.0 pinned开发者_运维百科 to 162.0

The UIPickerView I use is a custom size. I use transform of scale 0.8f on the height. So if you calculate 0.8*162.0 is indeed 129.9f (130 as mentioned by the console).

I have no idea how to fix this. Any ideas?


The problem is solved. It seems when the app goes to the background, UIPickerView needs to find its components resources again. It is not about sizing of UIPickerView at all.

I used images for the UIPickerView components, so after I populate the UIPickerView with these images, I released all the images that were allocated earlier. These images must not be released if it were to work in iOS4.

Only release them when the app ends.


Your problem has been fixed by another guy with a radical approach. See this post'sanswer provided by a guy named bhavinb.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜