Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. +(void) showSplashScreen
  2. {
  3. UIView *mainScreen = [[[UIApplication sharedApplication]delegate]window];
  4.  
  5. UIView *windowBlocker = [[UIView alloc]initWithFrame:mainScreen.frame];
  6. windowBlocker.tag = 999;
  7. windowBlocker.backgroundColor = [UIColor clearColor];
  8.  
  9. UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((mainScreen.frame.size.width), (mainScreen.frame.size.height), 50, 50)];
  10. imageView.layer.backgroundColor=[[UIColor colorWithRed:200 green:0 blue:0 alpha:0.5] CGColor];
  11.  
  12. imageView.layer.cornerRadius=10;
  13. imageView.layer.masksToBounds = YES;
  14. [windowBlocker addSubview:imageView];
  15.  
  16. UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  17. [windowBlocker addSubview:spinner];
  18. spinner.center = mainScreen.center;
  19. [spinner startAnimating];
  20. }
  21.  
  22. -(void)viewWillAppear:(BOOL)animated {
  23. [super viewWillAppear:animated];
  24. [self performSelector:@selector(addSplash) withObject:nil afterDelay:0.5];
  25. }
  26.  
  27. -(void)addSplash {
  28. [[self class] showSplashScreen];
  29. }
  30.  
  31. +(void) showSplashScreen
  32. {
  33. UIView *mainScreen = [[[UIApplication sharedApplication]delegate]window];
  34.  
  35. UIView *windowBlocker = [[UIView alloc]initWithFrame:mainScreen.frame];
  36. windowBlocker.tag = 999;
  37. windowBlocker.backgroundColor = [UIColor redColor];
  38.  
  39. UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((mainScreen.frame.size.width), (mainScreen.frame.size.height), 50, 50)];
  40. imageView.layer.backgroundColor=[[UIColor colorWithRed:200 green:0 blue:0 alpha:0.5] CGColor];
  41.  
  42. imageView.layer.cornerRadius=10;
  43. imageView.layer.masksToBounds = YES;
  44. [windowBlocker addSubview:imageView];
  45.  
  46. UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  47. [windowBlocker addSubview:spinner];
  48. spinner.center = mainScreen.center;
  49. [spinner startAnimating];
  50.  
  51. [[[[UIApplication sharedApplication]delegate]window] addSubview:windowBlocker];
  52.  
  53. }
  54.  
  55. -(void)viewDidAppear:(BOOL)animated {
  56. [super viewDidAppear:animated];
  57. [[self class] showSplashScreen];
  58. }
  59.  
  60. UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  61. [imageView addSubview:spinner];
  62. spinner.center = mainScreen.center;
  63. [windowBlocker addSubview:imageView];
  64. [self.view addSubview: mainScreen];
  65. [spinner startAnimating];
  66.  
  67. [Self.view addSubview:windowBlocker];
  68.  
  69.  
  70. UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  71. spinner.center = mainScreen.center;
  72. [spinner startAnimating];
  73. [windowBlocker addSubview:spinner];
  74.  
  75. [mainScreen addSubview:windowBlocker];
  76.  
  77. UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  78. spinner.color=[UIColor greenColor];
  79. spinner.center = self.view.center;
  80. [spinner startAnimating];
  81. [windowBlocker addSubview:spinner];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement