简体   繁体   English

首次应用徒步旅行者之旅

[英]Walking Tour for the first time app user

I am implementing walking tour for the first time user in the application. 我正在为应用程序中的首次用户实施徒步旅行。 I do not know is there a better way of doing it, but I have implemented the following approach which detects user taps via tap gesture recognition. 我不知道有没有更好的方法,但是我实现了以下方法,该方法通过轻击手势识别来检测用户的轻击。

I wonder how could I handle if I have more than one image? 我想知道如果我有多个图像怎么办? Or is there any better or recommended approach for the walking tour? 还是有更好的或推荐的徒步旅行方式?

- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    UIImageView *imageView = [[UIImageView alloc] 
    initWithImage:[UIImage imageNamed:@"yourimage.png"]];
    [self.window addSubview:imageView];

     UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
     recognizer.delegate = self;
    [imageView addGestureRecognizer:recognizer];
    imageView.userInteractionEnabled =  YES;
    self.imageView = imageView;
}

- (void) handleTap:(UITapGestureRecognizer *)recognize
{
     [self.imageView removeFromSuperView];
}

It is totally up to you how you want yo implement this. 您要如何实现此完全取决于您。 The approach you have mentioned have nothing wrong. 您提到的方法没有错。

For your question if you have more than one images then you can create a container view on which you can add multiple imageViews . 对于您的问题,如果您有多个图像,则可以创建一个容器view在该容器view上可以添加多个imageViews And On Touch on that container you can show hide image view based on your sequence. 在该容器上的“触摸”上,您可以根据自己的顺序显示隐藏图像视图。

Using PageViewController will be another good option for this. 使用PageViewController将是另一个不错的选择。 You can try this control. 您可以尝试使用此控件。

PageViewController PageViewController

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM