forked from soffes/sstoolkit
/
SCHUDViewDemoViewController.m
71 lines (50 loc) · 1.4 KB
/
SCHUDViewDemoViewController.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
//
// SCHUDViewDemoViewController.m
// SSCatalog
//
// Created by Sam Soffes on 11/18/09.
// Copyright 2009 Sam Soffes, Inc. All rights reserved.
//
#import "SCHUDViewDemoViewController.h"
@implementation SCHUDViewDemoViewController {
SSHUDView *_hud;
}
#pragma mark - Class Methods
+ (NSString *)title {
return @"HUD View";
}
#pragma mark - NSObject
- (void)dealloc {
[_hud release];
[super dealloc];
}
#pragma mark - UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = [[self class] title];
self.view.backgroundColor = [UIColor whiteColor];
// Show HUD
_hud = [[SSHUDView alloc] initWithTitle:@"Loading..."];
// _hud.hudSize = CGSizeMake(60.0f, 60.0f);
// _hud.textLabelHidden = YES;
// _hud.hidesVignette = YES;
[_hud show];
// After 2 seconds, complete action
[self performSelector:@selector(complete:) withObject:nil afterDelay:2.0];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
return YES;
}
#pragma mark - Actions
- (void)complete:(id)sender {
[_hud completeWithTitle:@"Finished"];
[self performSelector:@selector(pop:) withObject:nil afterDelay:0.7];
}
- (void)pop:(id)sender {
[_hud dismiss];
[self.navigationController popViewControllerAnimated:YES];
}
@end