相关疑难解决方法(0)

如何在iOS中实现弹出对话框

在计算之后,我想显示向用户传达消息的弹出框或警告框.有谁知道在哪里可以找到更多相关信息?

popup ios

295
推荐指数
6
解决办法
30万
查看次数

像iPad popover的iPhone弹出菜单?

如何在iPhone应用程序中实现这个弹出菜单,就像在ipad中使用popover一样?

替代文字


编辑:这是目前最好的:https://github.com/runway20/PopoverView 在此输入图像描述

iphone objective-c popover ipad uipopovercontroller

34
推荐指数
5
解决办法
4万
查看次数

UIModalPresentationPopover for iPhone 6 Plus在横向上不显示弹出窗口

我想总是ViewController在所有设备和所有方向上提供一个popover.我试图通过采用UIPopoverPresentationControllerDelegate和设置sourceView和来完成这个sourceRect.

这适用于所有设备和方向,除了横向的iPhone 6 Plus.在这种情况下,视图控制器在表单中从屏幕底部向上滑动.如何防止它始终出现在弹出框中?

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let popoverPresentationController = segue.destinationViewController.popoverPresentationController
popoverPresentationController?.delegate = self
popoverPresentationController?.sourceView = self.titleLabel!.superview
popoverPresentationController?.sourceRect = self.titleLabel!.frame }

func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None }
Run Code Online (Sandbox Code Playgroud)

所有设备均在iOS 8.2或更高版本下

iphone ios uimodalpresentationstyle ios8 iphone-6-plus

32
推荐指数
2
解决办法
6482
查看次数

iPhone上的UIPopoverPresentationController不会产生弹出窗口

我正在尝试UIPopoverPresentationController在我的iPhone应用程序中实现新功能(使用Objective C).我想要的是一个简单的popover,其中包含一个从启动按钮发出的tableview.

- 编辑 -

这是我的修订代码,改编自文档中的研究,SO,以及下面评论中的输入:

- (IBAction)selectCategoryBtn:(UIButton *)sender
{
    [self performSegueWithIdentifier:@"CatSelectSegue" sender:self.selCatButton];
}

-(void) prepareForSegue:(UIStoryboardSegue *) segue Sender:(id) sender
{
    if (sender == self.selCatButton)
    {
        if ([segue.identifier isEqualToString:@"CatSelectSegue"])
        {
            UIPopoverPresentationController *controller = segue.destinationViewController;
            controller.delegate = self;
            controller.sourceView = self.selCatButton;
            controller.sourceRect = self.selCatButton.frame;
        }
    }
}


-(UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller
{
    return UIModalPresentationNone;
Run Code Online (Sandbox Code Playgroud)

这是我的故事板连接:

在此输入图像描述

然而,这只是以模态方式呈现一个桌面视图,从底部上升并消耗整个屏幕.

我用谷歌搜索了,看起来都是如此,但看起来我并不是唯一一个被我希望解决iPhone烦恼问题所迷惑的人.

任何人都可以看到我的代码中的故障或指导我一个明确的教程?我看过了,但也许API是如此新的没有人能够掌握它.

谢谢!

第二次编辑:

以下是上述代码的结果.我减少了视图控制器中的tableview的大小,我希望将其作为弹出窗口呈现.我把背景涂成灰色,只是为了澄清出现的是什么,而不是弹出窗口.

在此输入图像描述

iphone objective-c popover ios

30
推荐指数
3
解决办法
3万
查看次数

在iPhone上的popover中呈现UIAlertController ActionSheet

我正在创建和呈现ActionSheet如下:

let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
alertController.modalPresentationStyle = .Popover

// Add some buttons

alertController.popoverPresentationController?.delegate = self
alertController.popoverPresentationController?.barButtonItem = someBarButton

self.presentViewController(alertController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

这工作正常在iPad上,不过alertController.popoverPresentationControllernil在iPhone上.

我已经成功地使用自适应segue样式在iPhone上使用自适应segue样式呈现弹出窗口并实现adaptivePresentationStyleForPresentationController委托方法以返回正确的UIModalPresentationStyle但是我已经卡住了如何在代码中执行它,UIAlertController因为它popoverPresentationController在iPhone 上没有

iphone popover ios uialertcontroller

14
推荐指数
1
解决办法
6642
查看次数

io8如何设置UIPopoverPresentationController大小

我设置了UIPopoverPresentationController来显示UIViewController,就像UIAlertView一样.

但是当我创建自定义的UIViewController并使用UIPopoverPresentationController时.有全屏显示.

我想构建像http://cocoa.tumblr.com/post/92070238973/how-can-i-use-both-uipopoverpresentationcontroller这样的效果

我曾尝试设置preferredContentSize,但它仍然显示全屏.

我的代码如下:

 - (void)viewDidLoad {
     [super viewDidLoad];
     contentVC = [UIViewController new];
     contentVC.view.backgroundColor = [UIColor darkGrayColor];
     contentVC.preferredContentSize = CGSizeMake(200, 200);


     UIPopoverPresentationController *popPC =      contentVC.popoverPresentationController;
     popPC.delegate = self;
     popPC.sourceView = self.view;
     popPC.sourceRect = CGRectMake(0,0,0,0);
     popPC.permittedArrowDirections = UIPopoverArrowDirectionAny;
 }

 - (IBAction)btnAction:(id)sender {

 [self presentViewController:contentVC animated:NO completion:ni

 }

 -(UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller
 {
     return UIModalPresentationOverCurrentContext;
 }
Run Code Online (Sandbox Code Playgroud)

有谁知道如何设置uiviewcontroller和UIPopoverPresentationController的大小,如网站效果?

我将在UIViewController中设置其他组件(现在只需设置backgroundcolor).

非常感谢你.

objective-c ios uipopover

11
推荐指数
2
解决办法
7931
查看次数

iOS 中如何绘制工具提示

我真的很喜欢 Apple Measure 应用程序中的这个 UI 元素。我该如何画出类似这样的东西呢?

在此输入图像描述

它不应该是图像,因为我希望它根据文本的固有大小进行缩放。

ios swift

5
推荐指数
1
解决办法
5338
查看次数