Nextrek
@ 62
Nextrek / iOS / PocketVision / PocketVision / Shared / Utils / ActivityViewFramed.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
// // ActivityViewFramed.m // MPS // // Created by bwbuser on 04/08/11. // Copyright 2011 beeweeb spa. All rights reserved. // #import "ActivityViewFramed.h" @implementation ActivityViewFramed @synthesize textLocal, titleLocal; @synthesize activityIndicatorView; static ActivityViewFramed* activity; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } //THIS CREATES THE ACTIVITY, ATTACH IT AT THE SUPERVIEW (PASSED AS PARAMETER) AND IMMEDIATELY SHOW IT. + (void) showActivityWithSuperView:(UIView*)aView text:(NSString*)aText { if (activity) return; CGPoint center = CGPointMake(aView.frame.size.width/2, aView.frame.size.height/2); activity = [[ActivityViewFramed alloc] initWithNibName:@"ActivityViewFramed" bundle:[NSBundle mainBundle]]; activity.view.center = center; if(STR_ISNULL_OR_EMPTY(aText)) [activity setupWithText:@"Caricamento in corso..."]; else [activity setupWithText:aText]; activity.view.alpha = 0; [aView addSubview:activity.view]; [activity performSelector:@selector(show)]; } //THIS IS FOR USE WITHOUT A TITLE TEXT + (void) showActivityWithSuperView:(UIView*)aView { [ActivityViewFramed showActivityWithSuperView:aView text:nil]; } + (void) hideActivityView { if (activity) { [activity performSelector:@selector(hide)]; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } #pragma mark - View lifecycle - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. self.activityIndicatorBox.layer.cornerRadius = 10; self.activityIndicatorBox.layer.masksToBounds = YES; if (!loaded) { [self performSelector:@selector(setAppearance)]; loaded = YES; } } - (void)viewDidUnload { [self setActivityIndicatorBox:nil]; [super viewDidUnload]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); } -(NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskLandscape; } - (void) setupWithText:(NSString*)aText { self.textLocal = aText; if (loaded) { [self performSelector:@selector(setAppearance)]; } } - (void) setAppearance { textLabel.text = textLocal; } #pragma mark - ANIMATIONS - (void) show { if ([self.view superview]) { [[self.view superview] bringSubviewToFront:self.view]; } [activityIndicatorView startAnimating]; FADEIN(self.view, 0.5) } - (void) hide { FADEOUT_CALLBACK(self.view, 0.5, viewHided) } - (void) viewHided { [activityIndicatorView stopAnimating]; if (activity) { [activity.view removeFromSuperview]; } activity = nil; } @end |
Commits for Nextrek/iOS/PocketVision/PocketVision/Shared/Utils/ActivityViewFramed.m
Revision | Author | Commited | Message |
---|---|---|---|
62 | FAquili | Sat 18 Jan, 2014 16:39:26 +0000 | PocketVision 1.0 |