gpt4 book ai didi

ipad - 如何在 UIPopoverViewController 中添加 UIView?

转载 作者:行者123 更新时间:2023-12-01 01:05:07 25 4
gpt4 key购买 nike

如何将 UIView 添加到 UIPopoverViewController

最佳答案

-(void) buttonAction:(id)sender {
//build our custom popover view

UIViewController* popoverContent = [[UIViewController alloc]

init];

UIView* popoverView = [[UIView alloc]

initWithFrame:CGRectMake(0, 0, 200, 300)];

popoverView.backgroundColor = [UIColor whiteColor];

popoverContent.view = popoverView;


//resize the popover view shown
//in the current view to the view's size

popoverContent.contentSizeForViewInPopover =

CGSizeMake(200, 300);


//create a popover controller

self.popoverController = [[UIPopoverController alloc]

initWithContentViewController:popoverContent];


//present the popover view non-modal with a
//refrence to the button pressed within the current view
[self.popoverController presentPopoverFromRect:popoverButton.frame

inView:self.view

permittedArrowDirections:UIPopoverArrowDirectionAny

animated:YES];


//release the popover content
[popoverView release];
[popoverContent release];
}

This will add the view to your UIPopoverViewController

关于ipad - 如何在 UIPopoverViewController 中添加 UIView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9095258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com