在UITableViewRowAction按钮上指向一个弹出窗口

时间:2016-07-16 22:12:33

标签: ios popover uitableviewrowaction

我尝试从自定义UITableViewRowActions中的多个UITableviewCell中的一个启动弹出窗口。似乎没有现成的委托方法以直接的方式执行此操作,但我的搜索找到了以下解决问题的方法:

How to get a reference to button from UITableViewRowAction?

How to correctly start a popover segue from a custom uitableviewcell using the storyboard

How do I implement the UITapGestureRecognizer into my application

Segue from editActionsForRowAtIndexPath

IOS: verify if a point is inside a rect

How to detect a tap gesture in subviews

虽然每个方法都有助于解决方法的某些方面,但没有一个是全面的。但是,根据每个人的指导,我最终得出了这段代码:

else if ([[segue identifier] isEqualToString:@"AccountPopSegue"])
{
    UITapGestureRecognizer *tapGestureRecognizer;

    CGPoint point = [tapGestureRecognizer locationInView:_thisCustomCell.contentView];
    UIView *tappedView = [_thisCustomCell hitTest:point withEvent:nil];

    UIViewController *controller = segue.destinationViewController;
    controller.popoverPresentationController.delegate = self;
    controller.preferredContentSize = CGSizeMake(320, 186);
    UIPopoverPresentationController *thisPPC = controller.popoverPresentationController;


    thisNavController = (UINavigationController *)segue.destinationViewController;
    AccountChangeVC *acCVC = (AccountChangeVC *)thisNavController.topViewController;
    acCVC.delegate = self;

    thisPPC.sourceRect = tappedView.bounds;
    thisPPC.sourceView = tappedView.superview;
}

点击" Acct" action会产生以下行为,显示三行情况:

enter image description here enter image description here

enter image description here enter image description here

enter image description here enter image description here

因此,我似乎已接近完成我想要的演示文稿,但并不完全在那里。

任何人都可以建议更改,直接在启动UITableViewRowAction按钮时使弹出点?

0 个答案:

没有答案