我在这里有一点问题。我已经在工具栏按钮单击时激活了一个弹出视图。但是视图不在我想要的位置。请参阅屏幕截图
第一个屏幕显示我拥有的和第二个我想要的。顺便说一句:popview 有问题。不涉及 xib 或故事板。
一些代码
-(IBAction)addbutton:(UIToolbar *)sender;
{
//build our custom popover view
UIViewController* popoverContent = [[UIViewController alloc]
init];
UIView* popoverView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
popoverView.backgroundColor = [UIColor blackColor];
/*
* Adding buttons programaticly to popout view
* button code etc
*/
popoverContent.contentSizeForViewInPopover = CGSizeMake(400, 300);
//create a popover controller
self.popoverController = [[[UIPopoverController alloc]
initWithContentViewController:popoverContent] autorelease];
[popoverController presentPopoverFromRect:popoverButton.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionLeft
animated:YES];
//release the popover content
[popoverView release];
[popoverContent release];
}
谢谢