【发布时间】:2011-12-30 08:05:29
【问题描述】:
我正在使用 UIPopoverController 并使用 MPMediaPickerController 填充它以从 iPod 库中选择歌曲。我让它工作得很好。但是,我添加了一个完全不相关的功能(触摸按钮并将图像缩放到大尺寸),现在 UIPopoverController 仅在使用新功能后才会出现奇怪的行为。
使用按钮缩放功能后,UIPopoverController 以一种奇怪的方式出现。看起来它是从屏幕上的旋转状态开始动画并降落在正确的位置,但预期的行为是它应该出现在正确的位置。
// code for if the interface is a an iPhone, do not use popup
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self presentModalViewController:picker animated:YES];
// 如果不是 iPhone 使用弹出媒体选择器的代码
else {
UIPopoverController* pop =
[[UIPopoverController alloc] initWithContentViewController:picker];
self.currentPop = pop;
// 检查 iPad 是纵向还是横向,并相应地显示弹出媒体选择器
if (vertMode == TRUE)
{
//如果是纵向模式
[pop presentPopoverFromRect:CGRectMake(668.0f, 846.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:NO];
// 否则如果是横向模式
}
else if (vertMode == FALSE)
{
[pop presentPopoverFromRect:CGRectMake(900.0f, 580.0f, 10.0f, 10.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:NO];
}
[pop release];
}
}
【问题讨论】:
-
如果您从纵向开始,显示弹出框然后旋转到横向会发生什么?
标签: objective-c ios ipad uipopovercontroller