如何从连接到UIKeyboard的栏中的barButtonItem显示Popover

时间:2011-04-05 19:57:18

标签: ios uibarbuttonitem uipopovercontroller uikeyboard

Image here

嘿伙计们,

我将工具栏作为附件视图附加到键盘上。

[textView setInputAccessoryView:toolbar];

它有一个barButtonItem。我需要在按钮上显示popOver。我知道要用

presentPopoverFromBarButtonItem:permittedArrowDirections:animated:

但这会使popOver显示出奇怪的方向。我试过各种黑客但没有运气。以前有人有这样的问题吗?

创建PopOverController的代码。

- (void) audioRecord:(id)sender event:(UIEvent*)event
{ 

UIBarButtonItem *audioBarButtonItem = (UIBarButtonItem *)sender;
     if(audioInputController == nil)
    {
        audioVC=[[AudioTextViewController alloc] init];
        audioVC.delegate = self;

        self.audioInputController=[[UIPopoverController alloc] initWithContentViewController:audioVC];

        CGSize audioViewSize = audioVC.view.frame.size;

        audioInputController.delegate = self;

        [self.audioInputController setPopoverContentSize:audioVC.view.frame.size];

        [audioInputController presentPopoverFromBarButtonItem:audioBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    }        
}

0 个答案:

没有答案