开发者

iPad Orientation Lock Notification?

Is there a way to receive a notification when the iPad gets orientation locked? When the orientation lock is set on or off, it does send a receivedRotate: notification, but I need a way to be able to distinguish normal rotations from lock "rotations".

The problem is I am rotating things in my view when the rotation changes. When the lock is activated, the iPad sends a receivedRotate: with UIInterfaceOrientationPortrait.

I'v开发者_运维知识库e looked in UIDevice for something like isOrientationLocked, but with no success.

Thanks for any clues on this.

EDIT: When the iPad orientation lock is switched ON, it does send a notification that the rotation changed to portrait for some reason. This causes the elements to rotate since they rotate with any orientation change. This is what I want to prevent.

EDIT2: Yes, the iPad shouldn't send a portrait notification but it does. After this portrait notification the iPad stops sending notifications, which is the way it should be. It's just the initial notification that is in the way.

I cannot use the accelerometer because I still want to be able to use the orientation lock's locking feature. Maybe I would use the accelerometer if I had some way of knowing when the iPad was locked.

EDIT3: receivedRotate: is called with UIInterfaceOrientationPortrait for all orientations.


Apparently it's working now.

I recently jumped back into my old project after installing the latest XCode & iPhone SDK and I no longer receive UIInterfaceOrientationPortrait when the lock is switched on. Haven't changed my code at all so it must be Apple.


Just to be clear, are you only using the rotation notifications to determine your rotations? You are not pulling data from the accelerometer or the like to get your orientation?

One other thing is that the lock is just that, a lock, it should not force you into portrait mode if you are in landscape. It should just keep you in landscape.

So, guessing from what you are doing I might suggest that you really do not want to be using the notifications as the basis of your interface but rather the accelerometer data directly.

As a newly minted iPad owner I might wonder what you are doing since I see the lock as a way to keep the orientation the way I want when my physical orientation is not "normal" like laying on the couch.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜