Xcode 使用 UIImageView 继续

Xcode segue with an UIImageView

在 Xcode 中,我可以控制 + 鼠标从一个 UIButton 拖动到另一个 UIViewController,以便在用户使用时使该按钮能够继续到 UIViewController按下按钮,如何为 UIImageView 重新创建此 属性?

我尝试将其特征更改为按钮 [检查] 和启用用户交互 [检查],以及启用辅助功能,并在属性检查器中启用用户交互,但是,当我控制 + 鼠标从 UIImageView 到另一个 UIViewController.

如果可能*,我将不胜感激不涉及代码的解决方案。

*Objective-C

您无法在 UIImageView 上添加 segue。将 UIImageView 的视图控制器的 segue 添加到目标视图控制器。给你的 UIImageView 点击手势,在点击手势的动作方法中使用 perform segue 方法。

见下方代码

-(void)tapHandeler:(UITapGestureRecognizer*)guesture
{
    [self performSegueWithIdentifier:@"YOUR SEGUE IDENTIFIER" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if([segue.identifier isEqualToString:@"YOUR SEGUE IDENTIFIER"]) {

        // If you want to do any preprocessing, do here
    }
}

使用按钮。

为按钮分配图像。然后制作 segue