Guest User

Untitled

a guest
Aug 10th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment