【问题标题】:How we can add UIPopOverController on UIButton?我们如何在 UIButton 上添加 UIPopOverController?
【发布时间】:2012-03-09 20:02:23
【问题描述】:

自从上半小时以来我遇到了一个问题。我正在使用UIButton,我想在上面显示UIPopovercontroller。但是它在touchUpinside action 上崩溃了。我知道如果我这样做我们可以轻松完成使用UIBarButton 但我有一些UI specification 这就是为什么我不能使用UIBarButtonUIToolbar

所以,如果有人对在UIButton 上显示UIPopovercontroller 有任何想法,请帮助我。我们将不胜感激。

【问题讨论】:

  • 你为什么不在这里发布你的代码和崩溃报告。

标签: iphone uibutton uipopovercontroller


【解决方案1】:
[popoverController presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

【讨论】:

    【解决方案2】:

    您可以尝试使用以下代码:

    -(IBAction)Show_Menu_Controller:(id)sender
    {
        if (_colorPicker == nil) {
            self.colorPicker = [[[ColorPickerController alloc] initWithStyle:UITableViewStylePlain] autorelease];  
            _colorPicker.delegate = self;
            self.colorPickerPopover = [[[UIPopoverController alloc] initWithContentViewController:_colorPicker] autorelease];               
        }
       [self.colorPickerPopover setPopoverContentSize:CGSizeMake(600.0f, 250.0f)];
    
    
        [self.colorPickerPopover presentPopoverFromRect:CGRectMake(365,-118 , 300, 200) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];  **//Set the Origin & Direction of PopOverController accordingly**
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-23
      • 1970-01-01
      • 2017-01-31
      • 1970-01-01
      • 1970-01-01
      • 2013-10-13
      • 1970-01-01
      • 2016-09-09
      相关资源
      最近更新 更多