2011-11-29 43 views
0

我想在按钮点击事件中打开弹出窗口。 像下面的图片: enter image description herePopOver在左侧开启+ iphone

但得到什么IM是:

enter image description here

代码中,我曾用于酥料饼是:

PopOver *PopOver_obj=[[PopOver alloc]initWithNibName:@"PopOver_ipad" bundle:nil ];  
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:PopOver_obj];  
popoverController.delegate = self;  
CGSize maximumLabelSize = CGSizeMake(320.0f,200.0f); 
popoverController.popoverContentSize = maximumLabelSize; 
CGRect rect = CGRectMake(100,100, 200.0f, 100.0f); 
[popoverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 
+0

我觉得不使用酥料饼您的要求可能,另一种解决方案是采取视图点击按钮 – Narayana

回答

1

UPDATE

对于iOS 5,您可以使用popoverLayoutMargins popover的属性,用于设置相对于设备屏幕边缘的插入。有关更多详细信息,请参阅this


据我可以从截图中看到你有一个黑色的视图和一个白色的人,但你表现出对他们的上海华弹出。

您可以尝试使用- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated方法,并将白色视图作为view参数传递给方法,UIPopoverArrowDirectionUp传递给arrowDirections argument

我认为这可能会限制弹出窗口超出视图的范围,从而将其保留在您的+按钮下。

让我知道是否有帮助。

+0

感谢您的快速reple我曾使用这条线: - \t [popoverController presentPopoverFromRect:RECT inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp动画:是];但是,它也给了我相同的输出如上图所示 –

+0

告诉我这一点 - 在你的第二个屏幕拍摄是白色背景与self.view不同的视图或是self.view? –