Tag: uipopovercontroller

在运行时创buildpopup视图锚的button

这可能是不可能的,但我希望有人会有一个想法如何做到这一点。 我有一个应用程序,我只从iPhone移植到环球。 在iPhone上,我正在使用选项卡式应用程序。 我使用三个标签来显示正常的数据。 我有一个只有在满足特定条件时才会显示的第四个选项卡。 要添加标签,我这样做: if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { UITabBarController *tabController = (UITabBarController *) self.rootViewController; NSMutableArray* newArray = [NSMutableArray arrayWithArray: tabController.viewControllers]; [newArray addObject: [theStoryboard instantiateViewControllerWithIdentifier: @"AdditionalView-Phone"]]; [tabController setViewControllers:newArray animated:YES]; } 对于iPad,我在初始视图上有足够的空间来显示iPhone UI中主要三个选项卡的所有内容。 所以我需要的是一个额外的(小)视图的“额外”的数据。 我想用popOver视图来完成,所以我使用Utility App模板中的导航栏和popupbutton来设置初始视图。 但现在我卡住了。 我无法弄清楚如何在运行时创buildpopoverbutton,并使其正确执行popOver视图。 我可以像这样添加button: UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle: @"Modem" style: UIBarButtonItemStylePlain target: self action: @selector(togglePopover:)]; […]

UIPopOver标题和子标题

我如何设置popOverView的子标题? 说明:这是我得到的:我能够设置标题。 这是我想要的:我想在我的popOverView标题和副标题。 我怎样才能做到这一点 ? 问候 !!

resize后调整UIPopoverController的位置

我有一个UIPopoverController包含一个UITableView 。 popup窗口在其视图控制器的-viewDidAppear函数中resize以适应表格的内容。 当popover正确调整时,它的箭头通常不再指向原始的CGRect 。 是否有办法强制popup窗口在重新resize后重新定位,以便其箭头指向其预定的目标? 编辑:我不能在-viewDidLoad设置popup窗口的大小,因为表视图不加载其数据,直到-viewDidAppear ,结果我不知道什么大小的-viewDidAppear应该是在那之前。 另外,当单击其中一个表视图单元格来显示另一个视图时,我调整了popup窗口的大小,这也导致箭头不再指向其预期的目标。

UIActivityViewController问题iOS 7和iOS 8?

我正在为iPad构build一篇文章阅读应用程序。 我已经整合了社交分享function,这意味着用户可以在Facebook上分享文章和谷歌邮件。 我正在使用UIActivityViewController进行分享。 有一个酒吧button项,当用户点击该UIActivityViewController打开。我更新了Xcode 6当我在模拟器上运行它运行良好但我运行在iOS 7的真实设备(iPad)上,应用程序碰撞点击栏button项。 这是我的代码: – (IBAction)ysshareAction:(id)sender { NSURL *linkURL = [NSURL URLWithString:_DetailModal1[4]];//article url NSMutableAttributedString *stringText = [[NSMutableAttributedString alloc] initWithString:_DetailModal1[0]];//_DetailModal1[0] contain article title//// [stringText addAttribute:NSLinkAttributeName value:linkURL range:NSMakeRange(0, stringText.length)]; NSArray * itemsArray = @[[NSString stringWithFormat:@"%@",_DetailModal1[0]], [NSURL URLWithString:_DetailModal1[4]]]; NSArray * applicationActivities = nil; UIActivityViewController * AVC = [[UIActivityViewController alloc] initWithActivityItems:itemsArray applicationActivities:applicationActivities]; AVC.popoverPresentationController.sourceView = _webView; [self […]

UIPopoverController dealloc获取调用ARC环境

在第二次显示popup窗口控制器(解散popup窗口然后重新显示之后)时,出现以下错误: 终止应用程序,由于未捕获的exception'NSGenericException',原因:' – [UIPopoverController dealloc]达到popup仍然可见。 堆栈跟踪只是一堆hex,SIGABRT每次都发生在UIApplicationMain。 这是button触发的代码: – (IBAction)createNewScore:(id)sender { if (self.pc) if (self.pc.popoverVisible) return; else // Breakpoint is hit here—crashes after this line [self.pc presentPopoverFromBarButtonItem:(UIBarButtonItem *)sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; NGDocumentInfoViewController *documentInfoVC = [[NGDocumentInfoViewController alloc] initWithBlankDocumentTargetInManagedObjectContext:self.context]; UINavigationController *navc = [[UINavigationController alloc] initWithRootViewController:documentInfoVC]; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneCreatingNewScore:)]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel […]

在其contentViewController中closures一个UIPopoverController?

如果你想closures一个popup窗口 – 例如,从popup窗口的contentViewController中的一个button,你必须 – 创build一个引用到由创build它的视图控制器持有的popup窗口 从contentViewController创build一个通知让拥有的视图控制器知道它应该被解散,或者为了同样的目的交替地创build一个委托 当popover准备好被解散时,发送通知或委托消息 调用dismissPopover:animated在通知或委托方法被调用时dismissPopover:animated 同时,从一个UIViewController你可以访问模态视图控制器,父视图控制器,导航控制器,分离视图控制器,标签栏控制器,search显示控制器,子视图控制器,呈现视图控制器和呈现视图控制器。 有没有更好的方法从popover的contentViewController做到这一点?

UIPopViewController不工作

我有一个.h和.m链接的xib文件。 在xib中有一个带有textView的UIView。 我想用这个视图做的事情是当你点击一个button的时候打开它作为一个UIPopViewController。 这是我的代码: – (IBAction)thisButton:(id)sender { popViewController *popVC = [[popViewController alloc] initWithNibName:@"popViewController" bundle:nil]; self.pop = [[UIPopoverController alloc] initWithContentViewController:popVC]; [self.pop setPopoverContentSize:CGSizeMake(220, 120) animated:YES]; [self.pop presentPopoverFromRect:[(UIButton *)sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES]; } 它坠毁与以下错误。 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.' 我不明白这个错误。

在iPad上的popup窗口中按导航视图控制器时animationpopoverContentsize

当包含的UINavigationController推入一个新的控制器时,如何让我的UIPopoverControlleranimation化它的大小? 我有一个UIPopover从UIPopover显示在我的iPad应用程序。 它包含一个UINavigationViewController ,它有一个设置窗口作为其根视图控制器。 设置窗口是UITableViewController一个子类(风格设置为分组),并且点击其任何单元格都会在导航控制器上推送不同的“select器”视图控制器,这些控制器也是UITableViewController子类。 对于每个select器视图,在viewDidAppear ,我正在设置contentSizeForViewInPopover : self.contentSizeForViewInPopover = CGSizeMake(320, self.items.count * 44); 但是这并不影响变化。 当导航animation结束时,popup窗口捕捉到新的高度(宽度从不会从320改变)。 向后导航animation大小的变化(用这个答案的技术来完成),但向前从来没有。 我已经尝试获取对它的setPopoverContentSize:animated:的引用,并使用setPopoverContentSize:animated:但它不起作用。 我看过其他 问题无济于事。 我如何获得它总是animation正确的尺寸变化? 更新:我已经build立了一个简单的testing项目来尝试这一点。 这是一个在Xcode中设置的iPad的标签栏应用程序。 我在其中一个视图控制器的导航栏中添加了一个标签栏项目。 按下该button时,控制器将显示一个包含导航控制器的popup窗口,该控制器具有一个名为TestContentViewController的非常简单的UITableViewController子类作为其根视图控制器。 在该子类的viewDidLoad中,我随机生成了一些项目: self.numItems = arc4random() % 10 + 3; 这是我的行数; 部分的数量是1.在cellForRowAtIndexPath我只是设置单元格的标签文本并将其返回。 当选中一行时,我生成另一个相同类的实例,并将其推送到堆栈上。 对任何VC的contentSizeForViewInPopover属性完全不做任何事情,popover只是达到其最大高度,并停留在那里,无论我的表视图中有多less行。 如果我在viewDidAppear中设置大小,如下所示: -(void)viewDidAppear:(BOOL)animated { self.contentSizeForViewInPopover = CGSizeMake(320, self.numItems * 44); [super viewDidAppear:animated]; { 当popup窗口第一次出现时,它会非常快速地闪烁到完全的高度,然后卡入我设定的高度。 当一个新的控制器在导航控制器上被按下时,它会在没有animation的情况下达到其高度。 当我回去的时候,如果我popup的VC比我popup的那个更高,它会animation到正确的大小。 如果我popup的是更小,它什么都不做。 如果我做同样的事情,但在viewWillAppear : […]

如何在使用自适应search时获得对UIPopoverController的引用?

在我的iOS 7应用程序中,我通过checkFor在prepareForSegue检测到了一个segue是一个popover: if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]) 但是现在我正在使用自适应赛格,在上面的检查中,现在作为Popover segue不再返回true。 这是因为segue不再是一个UIStoryboardPopoverSegue ,而是一个UIStoryboardPopoverPresentationSegue 。 但是,不能简单地添加Presentation单词,因为没有定义。 什么是适当的方式来检测什么时候赛格是一个适应性赛格popup ,而不是一个全屏模态表示? 而且, 你如何获得iOS 8的popover的参考 ? 以下是我为iOS 7做的事情,但是又因为它不是UIStoryboardPopoverSegue这会导致崩溃。 UIPopoverController *popover = ((UIStoryboardPopoverSegue *)segue).popoverController; popover.popoverContentSize = CGSizeMake(380, 1000);

UIAlertController崩溃(iPad)

我正在使用Xcode 6开发iOS应用程序。 当我使用UIAlertController ,它可以在iPhone 6模拟器上运行,但在iPad模拟器上崩溃。 我的问题,同时点击“分享”,然后它可能会坠毁。 我怎么能解决它? 这是我的代码: override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject] { var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share", handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in let shareMenu = UIAlertController(title: nil, message: "Share using", preferredStyle: .ActionSheet) let twitterAction = UIAlertAction(title: "Twitter", style: UIAlertActionStyle.Default, handler: nil) let facebookAction = UIAlertAction(title: […]