daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How to update UIWebView during an animation?
  2. - (IBAction)flipWebViewGestureRecognizer:(id)sender
  3. {
  4.     // isFrontView is boolean to determine if card is front or back
  5.     if(self.isFrontOfView)
  6.     {
  7.         self.isFrontOfView = NO;
  8.         [UIView transitionWithView: self.imageView
  9.                           duration: 1.0
  10.                            options: UIViewAnimationOptionTransitionFlipFromTop
  11.                         animations: ^{ [self loadBack]; }
  12.                         completion: nil];
  13.     }
  14.     else
  15.     {
  16.         self.isFrontOfView = YES;
  17.         [UIView transitionWithView: self.imageView
  18.                           duration: 1.0
  19.                            options: UIViewAnimationOptionTransitionFlipFromTop
  20.                         animations: ^{ [self loadFront]; }
  21.                         completion: nil];
  22.     }
  23. }
  24.    
  25. - (void) loadFront
  26. {
  27.     NSString *html = @"<p>Front Of Card</p>";
  28.     [self.viewWebView loadHTMLString:html baseURL:nil];
  29. }
  30.  
  31. - (void) loadBack
  32. {
  33.     NSString *html = @"<p>Front Of Card</p> <br /> <p>as well as back of card<p>";
  34.     [self.viewWebView loadHTMLString:html baseURL:nil];
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top