关于屏幕

之前是处理可以旋转的,这个时候需要主义的就是旋转时候的效果,毕竟允许旋转,就会看到转动。出现后面的一个view,多半是有问题了,比如没有dismiss自己。这个很明显啊。。


Q:

create a simple modal dialog on the iPad, in either the small (UIModalPresentationFormSheet) or the larger (UIModalPresentationPageSheet) settings, but they come out full screen (with a title bar) no matter what I do.

A:

I've figured this out. Turns out I was using UIModalPresentationPageSheet, which always goes to full screen in portrait mode. Because my modal UIViewController wasn't responding to shouldAutorotateToInterfaceOrientation, it was forcing a portrait orientation, which is why I THOUGHT the modal popup wasn't working.

By simply adding a shouldAutorotateToInterfaceOrientation handler to my modal UIViewController, that returns YES, I now see that in landscape mode I am getting a large popup that covers most (but not all) of the screen, which is what I've been expecting.

Q:

If the modal view appears when the device is in portrait, then it will be in portrait. However, once you rotate to landscapeLeft, it will remain locked in that orientation with this code.

To force the interface to rotate, you can use

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
=======

在这个UIModalPresentationFormSheet里面的keyboard问题

Apparently, there is a new -[UIViewController disablesAutomaticKeyboardDismissal]method that you may override to solve this problem in iOS 4.3.

I just confirmed the problem is indeed UIModalPresentationFormSheet and filed a bug report to apple rdar://8084017

I solved this by resizing a UIModalPresentationPageSheet. See my answer here.


UPDATE:

In iOS 4.3 and later, you can now implement `-disablesAutomaticKeyboardDismissal' on your view controller to return NO:

- (BOOL)disablesAutomaticKeyboardDismissal {     return NO; }

//

许多人谈到要早调用makekeyvisible,似乎也不管用。。。。

//

OK, here is how I did it, I thought what messes things up is the fact that orientation of container being different from the view that is presented as modal. So I added another view to contain cocos2d view and presented the modal using that view. The container's orientation is lanscape, so I needed to transform cocos2d view int he load method of its controller.

self.view.transform = CGAffineTransformRotate(self.view.transform, -(M_PI / 2.0)); self.view.frame = CGRectMake(0, 0, 480, 320);
 
//\Please note that you have to set all the items which are in front of the background view toclearColor such that they will not cover the background image.


你可能感兴趣的:(关于屏幕)