Last active
August 29, 2015 13:56
Revisions
-
pec1985 revised this gist
Feb 14, 2014 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -37,21 +37,23 @@ - (void)loadView messageLabel.numberOfLines = 0; messageLabel.shadowColor = [UIColor blackColor]; messageLabel.shadowOffset = CGSizeMake(0.0, -1.0); messageLabel.text = @"Some Javascript syntax error here..."; messageLabel.textAlignment = NSTextAlignmentCenter; messageLabel.textColor = [UIColor whiteColor]; messageLabel.translatesAutoresizingMaskIntoConstraints = NO; [view addSubview:titleLabel]; [view addSubview:centerView]; [centerView addSubview:messageLabel]; [centerView addSubview:dismissButton]; [view addSubview:disclosureLabel]; [titleLabel release]; [centerView release]; [messageLabel release]; [disclosureLabel release]; [view release]; NSLayoutConstraint *disclosureContraint1 = [NSLayoutConstraint constraintWithItem:disclosureLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual @@ -209,5 +211,4 @@ - (void)loadView [dismissButton addTarget:self action:@selector(dismiss:) forControlEvents:UIControlEventTouchUpInside]; } -
pec1985 created this gist
Feb 14, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,213 @@ - (void)loadView { self.modalTransitionStyle = UIModalTransitionStyleCoverVertical; UIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor redColor]; [view setBackgroundColor:[UIColor redColor]]; [self setView:view]; UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; dismissButton.backgroundColor = [UIColor whiteColor]; dismissButton.translatesAutoresizingMaskIntoConstraints = NO; [dismissButton setTitle:@"Dismiss" forState:UIControlStateNormal]; UILabel *disclosureLabel = [[UILabel alloc] init]; disclosureLabel.font = [UIFont boldSystemFontOfSize:14]; disclosureLabel.numberOfLines = 0; disclosureLabel.shadowOffset = CGSizeMake(0.0, -1.0); disclosureLabel.text = @"Error messages will only be displayed during development. When your app is packaged for final distribution, no error screen will appear. Test your code!"; disclosureLabel.textColor = [UIColor blackColor]; disclosureLabel.translatesAutoresizingMaskIntoConstraints = NO; UIView *centerView = [[UIView alloc] init]; centerView.translatesAutoresizingMaskIntoConstraints = NO; UILabel *titleLabel = [[UILabel alloc] init]; titleLabel.font = [UIFont boldSystemFontOfSize:32]; titleLabel.shadowColor = [UIColor darkGrayColor]; titleLabel.shadowOffset = CGSizeMake(2.0, 1.0); titleLabel.text = @"Application Error"; titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.textColor = [UIColor greenColor]; titleLabel.translatesAutoresizingMaskIntoConstraints = NO; UILabel *messageLabel = [[UILabel alloc] init]; messageLabel.font = [UIFont boldSystemFontOfSize:20]; messageLabel.numberOfLines = 0; messageLabel.shadowColor = [UIColor blackColor]; messageLabel.shadowOffset = CGSizeMake(0.0, -1.0); messageLabel.text = error; messageLabel.textAlignment = NSTextAlignmentCenter; messageLabel.textColor = [UIColor whiteColor]; messageLabel.translatesAutoresizingMaskIntoConstraints = NO; [view addSubview:titleLabel]; [view addSubview:centerView]; [centerView addSubview:messageLabel]; [centerView addSubview:dismissButton]; [view addSubview:disclosureLabel]; NSLayoutConstraint *disclosureContraint1 = [NSLayoutConstraint constraintWithItem:disclosureLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeLeading multiplier:1 constant:20]; NSLayoutConstraint *disclosureContraint2 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:disclosureLabel attribute:NSLayoutAttributeTrailing multiplier:1 constant:20]; NSLayoutConstraint *disclosureContraint3 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:disclosureLabel attribute:NSLayoutAttributeBottom multiplier:1 constant:20]; NSLayoutConstraint *titleConstraint1 = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeTop multiplier:1 constant:20]; NSLayoutConstraint *titleConstraint2 = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeLeading multiplier:1 constant:20]; NSLayoutConstraint *titleConstraint3 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:titleLabel attribute:NSLayoutAttributeTrailing multiplier:1 constant:20]; NSLayoutConstraint *messageConstraint1 = [NSLayoutConstraint constraintWithItem:centerView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:messageLabel attribute:NSLayoutAttributeTrailing multiplier:1 constant:0]; NSLayoutConstraint *messageConstraint2 = [NSLayoutConstraint constraintWithItem:messageLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeLeading multiplier:1 constant:0]; NSLayoutConstraint *messageConstraint3 = [NSLayoutConstraint constraintWithItem:messageLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeTop multiplier:1 constant:0]; NSLayoutConstraint *buttonConstraint1 = [NSLayoutConstraint constraintWithItem:centerView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:dismissButton attribute:NSLayoutAttributeTrailing multiplier:1 constant:80]; NSLayoutConstraint *buttonConstraint2 = [NSLayoutConstraint constraintWithItem:dismissButton attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeLeading multiplier:1 constant:80]; NSLayoutConstraint *buttonConstraint3 = [NSLayoutConstraint constraintWithItem:dismissButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; NSLayoutConstraint *buttonConstraint4 = [NSLayoutConstraint constraintWithItem:dismissButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:messageLabel attribute:NSLayoutAttributeBottom multiplier:1 constant:40]; NSLayoutConstraint *centerConstraint1 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]; NSLayoutConstraint *centerConstraint2 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]; NSLayoutConstraint *centerConstraint3 = [NSLayoutConstraint constraintWithItem:centerView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeLeading multiplier:1 constant:20]; NSLayoutConstraint *centerConstraint4 = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:centerView attribute:NSLayoutAttributeTrailing multiplier:1 constant:20]; NSLayoutConstraint *centerConstraint5 = [NSLayoutConstraint constraintWithItem:centerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:titleLabel attribute:NSLayoutAttributeBottom multiplier:1 constant:20]; NSLayoutConstraint *centerConstraint6 = [NSLayoutConstraint constraintWithItem:disclosureLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:centerView attribute:NSLayoutAttributeBottom multiplier:1 constant:20]; [centerView addConstraint:messageConstraint1]; [centerView addConstraint:messageConstraint2]; [centerView addConstraint:messageConstraint3]; [centerView addConstraint:buttonConstraint1]; [centerView addConstraint:buttonConstraint2]; [centerView addConstraint:buttonConstraint3]; [centerView addConstraint:buttonConstraint4]; [[self view] addConstraint:titleConstraint1]; [[self view] addConstraint:titleConstraint2]; [[self view] addConstraint:titleConstraint3]; [[self view] addConstraint:centerConstraint1]; [[self view] addConstraint:centerConstraint2]; [[self view] addConstraint:centerConstraint3]; [[self view] addConstraint:centerConstraint4]; [[self view] addConstraint:centerConstraint5]; [[self view] addConstraint:centerConstraint6]; [[self view] addConstraint:disclosureContraint1]; [[self view] addConstraint:disclosureContraint2]; [[self view] addConstraint:disclosureContraint3]; [dismissButton addTarget:self action:@selector(dismiss:) forControlEvents:UIControlEventTouchUpInside]; [view release]; }