Repository navigation
Expand file tree
/
Copy pathInfoViewController.m
More file actions
125 lines (111 loc) · 4.53 KB
/
Copy pathInfoViewController.m
File metadata and controls
125 lines (111 loc) · 4.53 KB
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
//
// InfoViewController.m
// Split
//
// Created by Jeffrey Rosenbluth on 12/27/11.
// Copyright (c) 2011 Applause Code. All rights reserved.
//
#import "InfoViewController.h"
@implementation InfoViewController
@synthesize fullScrollView;
@synthesize scrollView;
@synthesize drop;
@synthesize geometryProof;
@synthesize convexity;
@synthesize alertMe;
@synthesize faSchedule;
@synthesize twitter;
@synthesize website;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self setTitle:@"About"];
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *lbbi = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(done:)];
[[self navigationItem] setLeftBarButtonItem:lbbi];
[scrollView setContentSize:CGSizeMake(520, 52)];
[scrollView setShowsHorizontalScrollIndicator:NO];
[fullScrollView setContentSize:CGSizeMake(320, 640)];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(removeInfoView:)
name: UIApplicationWillResignActiveNotification
object: nil];
}
- (void)viewDidUnload
{
[self setScrollView:nil];
[self setDrop:nil];
[self setGeometryProof:nil];
[self setConvexity:nil];
[self setAlertMe:nil];
[self setFaSchedule:nil];
[self setFullScrollView:nil];
[self setTwitter:nil];
[self setWebsite:nil];
[super viewDidUnload];
}
- (void)viewWillAppear:(BOOL)animated {
CGPoint dropCenter = [[self drop] center];
CGPoint geomCenter = [[self geometryProof] center];
CGPoint convCenter = [[self convexity] center];
CGPoint alerCenter = [[self alertMe] center];
CGPoint fascCenter = [[self faSchedule] center];
CGPoint startCenter = CGPointMake(-50, [drop center].y);
[drop setCenter:startCenter];
[geometryProof setCenter:startCenter];
[convexity setCenter:startCenter];
[alertMe setCenter:startCenter];
[faSchedule setCenter:startCenter];
[UIView animateWithDuration:.7
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
[drop setCenter:dropCenter];
[geometryProof setCenter:geomCenter];
[convexity setCenter:convCenter];
[alertMe setCenter:alerCenter];
[faSchedule setCenter:fascCenter];}
completion:^(BOOL finished) {}];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)done:(id)sender {
[[self navigationController] dismissModalViewControllerAnimated:YES];
}
- (void)removeInfoView:(id)sender {
[[self navigationController] dismissModalViewControllerAnimated:NO];
}
- (IBAction)toURL:(id)sender {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Coming Soon" message:nil delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:nil];
if (sender == drop)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/drop!/id415884044?mt=8"]];
else if (sender == faSchedule)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/faschedule/id472827413?mt=8"]];
else if (sender == geometryProof)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/geometry-proof/id479753226?mt=8"]];
else if (sender == convexity)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/convexity/id492001353?mt=8"]];
else if (sender == alertMe)
[alertView show];
else if (sender == twitter)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://twitter.com/#!/ApplauseCode"]];
else if (sender == website)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.applausecode.com"]];
}
@end