相关疑难解决方法(0)

确定何时解除UIMenuController?

有没有办法确定UIMenuController何时被解雇?我有一个(不可编辑的)文本区域,我在菜单显示时突出显示,当他们选择一个项目(简单)或取消(不可能?)时,我想取消突出显示它.

iphone uimenucontroller

15
推荐指数
2
解决办法
5855
查看次数

显示UIMenuController丢失键盘

我正在创建一个类似于手机上的消息应用程序的iPhone应用程序.我只是设置了通过UIMenuController复制消息的能力,但是如果键盘正在显示并且有人试图复制消息,键盘就会消失(大概是因为我[cell becomeFirstResponder];在哪里cell复制了消息单元).

有没有办法显示复制邮件而不会丢失键盘?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath {

    //...other cell setup stuff...

    UILongPressGestureRecognizer *longPressGesture =
    [[UILongPressGestureRecognizer alloc]
      initWithTarget:self action:@selector(showCopyDialog:)];
    [cell addGestureRecognizer:longPressGesture];

    return cell;
}

- (void)showCopyDialog:(UILongPressGestureRecognizer *)gesture
{
    if (gesture.state == UIGestureRecognizerStateBegan)
    {
        ConvoMessageCell *cell = (ConvoMessageCell *)[gesture view];
        NSIndexPath *indexPath = [self.tblConvo indexPathForCell:cell];

        UIMenuController *theMenu = [UIMenuController sharedMenuController];
        [cell becomeFirstResponder];
        [theMenu setTargetRect:CGRectMake(menuX, menuY, 100, 100) inView:cell];
        [theMenu setMenuVisible:YES animated:YES];        
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone copy first-responder uimenucontroller

7
推荐指数
2
解决办法
2544
查看次数

标签 统计

iphone ×2

uimenucontroller ×2

copy ×1

first-responder ×1