Created
January 13, 2016 14:27
-
-
Save sandeeplearner/8b2bb830f1663ac9b3be to your computer and use it in GitHub Desktop.
init implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(id)init{ | |
| self=[super init]; | |
| NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"SBNotificationBarView" owner:self options:nil]; | |
| UIView *mainView = [subviewArray objectAtIndex:0]; | |
| self.view = mainView; | |
| keyWindow= [[SBCustomWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
| keyWindow.windowLevel = UIWindowLevelAlert; | |
| keyWindow.rootViewController = self; | |
| [keyWindow makeKeyAndVisible]; | |
| [keyWindow.rootViewController.view setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
| UIView *currentView = keyWindow.rootViewController.view; | |
| NSDictionary *viewComponents = NSDictionaryOfVariableBindings(currentView); | |
| NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-(0)-[currentView]-(0)-|" options:0 metrics:nil views:viewComponents]; | |
| NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(0)-[currentView(88)]-(>=8)-|" options:0 metrics:nil views:viewComponents]; | |
| yAxisConstraint = [verticalConstraints objectAtIndex:0]; | |
| [keyWindow addConstraints:horizontalConstraints]; | |
| [keyWindow addConstraints:verticalConstraints]; | |
| [keyWindow layoutIfNeeded]; | |
| self.isAutomaticDismissAllowed = YES ; | |
| self.selectedHideAnimationType = Default; | |
| self.durationOfMessageDisplayBeforeAutomaticDismissal = 3.0; | |
| self.backgroundColorOfNotificationBar = [UIColor colorWithRed:0 green:122.0/255.0 blue:255.0/255.0 alpha:1.0]; | |
| self.notificationBarDisplayAndHideAnimationDuration = 0.5; | |
| self.shouldPlaySound = NO; | |
| self.notificationSound = new_mail; | |
| self.imageLeadingSpaceConstraint.constant =0; | |
| self.imageHeightConstraint.constant = 0; | |
| [self.view layoutIfNeeded]; | |
| return self; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment