Skip to content

Instantly share code, notes, and snippets.

@Shereef
Forked from hamadmj/Find and fix the problem.
Created November 10, 2015 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shereef/4cefe1053e2691eb3ca4 to your computer and use it in GitHub Desktop.
Save Shereef/4cefe1053e2691eb3ca4 to your computer and use it in GitHub Desktop.
Challenge 1
@interface XYZWaitController : UIViewController
@property (strong, nonatomic) UILabel *alert;
@end
@implementation XYZWaitController
- (void)viewDidLoad
{
CGRect frame = CGRectMake(20, 200, 200, 20);
self.alert = [[UILabel alloc] initWithFrame:frame];
self.alert.text = @"Please wait 10 seconds...";
self.alert.textColor = [UIColor whiteColor];
[self.view addSubview:self.alert];
NSOperationQueue *waitQueue = [[NSOperationQueue alloc] init];
[waitQueue addOperationWithBlock:^{
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:10]];
self.alert.text = @"Thanks!";
}];
}
@end
@implementation XYZAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[XYZWaitController alloc] init];
[self.window makeKeyAndVisible];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment