【问题标题】:in custom tablecell popover not display and application crash?在自定义表格单元格弹出窗口中不显示和应用程序崩溃?
【发布时间】:2013-11-08 08:53:13
【问题描述】:

在我的程序中有表格视图。它有自定义单元格。

此自定义单元格具有不可编辑的文本视图。

当我触摸这个文本视图时,弹出窗口。 它在 ios6 模拟器中运行良好。

但是 ios5.1 模拟器不工作。 它给出了这个错误信息。

* 由于未捕获的异常 'NSInvalidArgumentException' 导致应用程序终止,原因:'-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:]: 无法从没有 窗口。'

在我的自定义单元格视图中,我将此代码用于触摸事件

ViewControllerDateIpcker *popView =[[ViewControllerDateIpcker alloc]init];
    popView.datedelegate = self;
    _popover =[[UIPopoverController alloc]initWithContentViewController:popView];

    [_popover presentPopoverFromRect:[_txtDate bounds]
                              inView:_txtDate
            permittedArrowDirections:UIPopoverArrowDirectionAny
                            animated:YES];

【问题讨论】:

    标签: ios uipopovercontroller popover


    【解决方案1】:

    试试这个:

    ViewControllerDateIpcker *popView =[[ViewControllerDateIpcker alloc]init];
            popView.datedelegate = self;
    _popover =[[UIPopoverController alloc]initWithContentViewController:popView];
    
    [_popover presentPopoverFromRect:[_txtDate bounds]
                                      inView:self.view
                    permittedArrowDirections:UIPopoverArrowDirectionAny
                                    animated:YES];
    

    【讨论】:

    • 它给出了错误属性 'view' not found on object of type 'CellEdit*'。 CellEdit 是我的自定义单元格
    • 然后传递self.contentView。或者你可以通过uiviewcontroller的主uiview
    • 我将 viewcontroller 视图传递给我的单元格并设置它。现在它可以在应用程序崩溃的情况下工作。但它不是来自 textview。它位于我的 viewcontroller 顶部
    • cell.contentView 呢?
    • 在我的表格视图中也有可编辑的文本视图。认为它是文本视图一。弹出文本视图是文本视图二。首先我编辑文本视图一。点击文本视图二后(键盘那个时间弹出) 应用程序 crash.in ios6 模拟器自动键盘隐藏并弹出我的 popview。
    【解决方案2】:

    这只是边界问题。您需要提供一个有边界的视图。 你应该试试这些答案。它也对我有用。 https://stackoverflow.com/a/8416003/1372368https://stackoverflow.com/a/4512944/1372368

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 1970-01-01
      • 2020-08-17
      • 2012-01-09
      • 2013-10-02
      • 1970-01-01
      • 2022-12-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多