Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. - (void)changeDefaultView:(NSNotification *)note
  2. {
  3. [self closePopover];
  4.  
  5. int i;
  6. for(i = 0; i < [arrWebViewControllers count]; i++)
  7. {
  8. WebViewController *wvc = [arrWebViewControllers objectAtIndex:i];
  9. [[wvc webview] stopLoading];
  10. [[wvc webview] removeFromSuperview];
  11. [[wvc imageview] removeFromSuperview];
  12. wvc = nil;
  13. }
  14.  
  15. [arrWebViewControllers removeAllObjects];
  16. [arrLinks removeAllObjects];
  17. [arrImageViews removeAllObjects];
  18.  
  19. [self loadCategory:[note object]];
  20.  
  21. [self addWidgetsToView];
  22. }
  23.  
  24. - (void)closePopover
  25. {
  26. if(popover != nil)
  27. {
  28. [popover dismissPopoverAnimated:YES];
  29. popover = nil;
  30. }
  31. }
  32.  
  33. - (void)changeDefaultView:(NSNotification *)note
  34. {
  35. [self closePopover];
  36.  
  37. int i;
  38. for(i = 0; i < [arrWebViewControllers count]; i++)
  39. {
  40. WebViewController *wvc = [arrWebViewControllers objectAtIndex:i];
  41. [[wvc webview] stopLoading];
  42. [[wvc webview] removeFromSuperview];
  43. [[wvc imageview] removeFromSuperview];
  44. wvc = nil;
  45. }
  46.  
  47. [arrWebViewControllers removeAllObjects];
  48. [arrLinks removeAllObjects];
  49. [arrImageViews removeAllObjects];
  50.  
  51. // perform the expensive operation on a background thread
  52. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  53.  
  54. [self loadCategory:[note object]];
  55.  
  56. // now get back onto the main thread to perform our UI update
  57. dispatch_async(dispatch_get_main_queue(), ^{
  58.  
  59. [self addWidgetsToView];
  60.  
  61. });
  62.  
  63. });
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement