由于某些原因,我将我的应用程序限制为只能在横向模式下运行,但奇怪的是,当我从我的应用程序中打开 iPod 音乐库时,它总是会以纵向模式跳出。
看到下面的代码,我很困惑是否是系统默认行为?我如何告诉它以横向模式出现(与其他 UI 保持一致)?谢谢。
- (IBAction)getMusic:(id)sender {
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
picker.allowsPickingMultipleItems = YES;
picker.prompt = NSLocalizedString (@"Add songs to play",nil);
[self presentModalViewController: picker animated: NO];
[picker release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);;
} else {
return YES;
}
}