我怎样才能使图像总是面对? [英] How can I make image always face up?
问题描述
我有一个描述猴子的头的图像。我想那猴子的头始终朝上。当您打开猴子的头转动过该设备,但我想的是,尽管iPhone的旋转猴子头dooesn't打开(如指南针)。
I have an image that describes a head of a monkey. I want that the head of the monkey always face up. When you turn the device the head of the monkey turns too, but I want that in spite of the rotation of the iphone the monkey head dooesn't turn (like a compass).
我怎样才能做到这一点?
How can I do this?
推荐答案
如果你想跟着设备,因为它变成你就必须跟踪与CLLocationManager。
If you want to follow the device as it turns you'll have to track with the CLLocationManager.
但如果你只是想猴子直立从纵向到横向(和它们的对立面)用户跃迁那么也许UIInterfaceOrientation将这样的伎俩:
But if you just want the monkey to be upright as the user transistions from portrait to landscape (and their opposites) then maybe the UIInterfaceOrientation will do the trick:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
这篇关于我怎样才能使图像总是面对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!