Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5 UIWindow makeKeyAndVisible closes modal

I have a scenario where I present a modal view controller from the main window's rootViewController. While it is loading the contents of this modal, I am switching to another loading window which I make key and visible.

This window acts as a loading indicator and does not allow the user to interact with the app. When it is done loading, I switch back to the main window by making it key and visible. When I do this, the modal is force closed and the app is no longer able to present modals.

Interestingly enough, if I execute [UIWindow makeKeyWindow] when switching back to the main window, there are no issues. [UIWindow makeKeyAndVisible] is what's causing the issue. Is [UIWindow makeKeyWindow] an acceptable alternative?

This is iOS 5 only. No issues in iOS 6. I am not supporting iOS 4. Does anyone know what might be happening here?

like image 730
Fergal Rooney Avatar asked Oct 25 '12 21:10

Fergal Rooney


1 Answers

I got the same behaviour, and as documentation states that makeKeyAndVisible method is a convenience method it seems to me legit to substitute makeKeyAndVisible call with working code:

[window makeKeyWindow];
window.hidden = NO;

Have no idea what's wrong, but it looks like a bug.

like image 160
Alexey Kozhevnikov Avatar answered Oct 21 '22 10:10

Alexey Kozhevnikov