Coroa 里怎么设置使得我的应用总是横版 ?


我新建立了一个应用,它虽然能自动适应重力
但我希望他首先能保持横屏,而不会显示竖屏模式
我该怎么来做呢 ?

xcode ios cocoa objective-c

甘蔗瑩FINO 12 years, 9 months ago

这个需要设置UIInterfaceOrientation

   
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

typedef enum {
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;

xiao@W answered 12 years, 9 months ago

Your Answer