1

iPhone と iPad の両方でアプリケーションを開発しています。ここでは、( 0.5) 時間間隔で uiwebview に URL をロードしたいと思います。Web ビューの読み込みが完了したら、次のビューに移動したいと考えています。[webViewDidFinishLoad:] にナビゲーション コーディングを追加することでこれを実装しましたが、正常に動作します。ここで、ユーザーが (0.5 ) 秒間 Web ビューにとどまることに興味がない場合、クライアントはナビゲートするためにビューにボタンを追加する必要があります。

  • after delay : 0.5 と round rect button に別の (selector:) アクションを使用する必要がありますか?

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

2 に答える 2

1

返信ありがとうございます。ここでは、「PerformSelector:afterDelay」を使用する代わりに「NSTimer」の概念を実装しました。ここにコードがあります、

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*/
于 2012-07-03T06:42:29.893 に答える
0

viewdidload メソッドで performSelector: withObject: afterDelay: 0.5 秒を実装できます。次に、警告メッセージ ボタンを表示したままにするか、ページを離れるメソッドを定義します。次に、アラートビューボタンにいくつかのコーディングを行います

于 2012-07-02T06:55:51.237 に答える