【问题标题】:Is it possible to move the view in a particular interval and also with button action是否可以在特定间隔内移动视图以及按钮操作
【发布时间】:2012-07-02 06:50:49
【问题描述】:

我正在为 iPhone 和 iPad 开发一个应用程序。在这里,我想以(0.5)时间间隔在 uiwebview 中加载一个 url。完成网页视图的加载后,我想导航到下一个视图。我已经通过将导航编码添加到 [webViewDidFinishLoad:] 来实现这一点,它工作正常。现在,我的客户需要在视图中添加一个按钮来导航,如果用户不感兴趣在 Web 视图中停留 (0.5 ) 秒。

  • 我是否应该对延迟后:0.5 和圆形矩形按钮使用单独的(选择器:)操作?

     if it so, how can i implement this,
     I googled it, but could not find the solution. Any help appreciated. Thanks.
    

【问题讨论】:

    标签: iphone ipad uiwebview timer


    【解决方案1】:

    非常感谢您的回复。在这里,我实现了“NSTimer”概念,而不是使用“PerformSelector:afterDelay”。这是代码,

    timer = [NSTimer scheduledTimerWithTimeInterval: 5.0
                                                 target: self
                                               selector: @selector(goToNextView)
                                               userInfo: nil
                                                repeats: NO];  
        // here i have set the time interval of '5.0' and after that taking into next view.
    
    -(void)goToNextView
    
    {
         newtest15 *nt=[[newtest15 alloc]init];
    
         [self.navigationController pushViewController:nt animated:YES];
      }               
    

    我在工具栏上有一个按钮,它也用于导航到下一个视图。

    -(IBAction)btn:(id)sender{
    
    if ( [timer isValid]) 
    
    {
                [timer invalidate], timer=nil;
    
            }
    
        newtest15 *nt=[[newtest15 alloc]init];
         [self.navigationController pushViewController:nt animated:YES];
    
    }
    
    /* here, when the user wants to move to next view before the time interval of '5', and presses the button at the bottom, this action will be performed, it will invalidate the timer and navigate to the next view*/
    

    【讨论】:

      【解决方案2】:

      您可以在 viewdidload 方法中实现 performSelector: withObject: afterDelay: 0.5 sec。 然后定义一个方法来显示警报消息按钮留在外面或离开页面。然后对警报视图按钮进行一些编码

      【讨论】:

      • 感谢您的回答。我在问,如果用户在(0.5)秒之前点击按钮,(按钮)动作应该发生而不是(afterDelay)函数。
      • 您可能已经看到图像在各个网站中移动,在特定的时间间隔内它会发生变化,并且您观察到“导航点”出现在图像下方,如果用户单击第三个点,将显示图像视图。我在问类似的事情,但在 iPhone 中。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-24
      • 1970-01-01
      • 2015-11-30
      • 1970-01-01
      • 1970-01-01
      • 2016-04-01
      • 1970-01-01
      相关资源
      最近更新 更多