appjam 0.1.8.9 → 0.1.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +114 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/AppDelegate.m.tt +13 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/CustomBadge.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/CustomBadge.m +241 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherItem.h +58 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherItem.m +227 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherPageControl.h +37 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherPageControl.m +117 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherScrollView.h +23 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherScrollView.m +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherView.h +70 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherView.m +830 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherViewController.h +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MyLauncher/MyLauncherViewController.m +302 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/AESCrypt.h +37 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/AESCrypt.m +50 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSData+Base64.h +17 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSData+Base64.m +110 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSData+CommonCrypto.h +112 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSData+CommonCrypto.m +546 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSString+Base64.h +15 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/AESCrypt-ObjC/NSString+Base64.m +82 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCCrossHairView.h +16 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCCrossHairView.m +43 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCFrameView.h +55 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCFrameView.m +234 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCIntrospect.h +155 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCIntrospect.m +1654 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCIntrospectSettings.h +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCStatusBarOverlay.h +34 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/DCIntrospect/DCStatusBarOverlay.m +107 -0
- data/lib/appjam/version.rb +1 -1
- metadata +32 -3
@@ -0,0 +1,58 @@
|
|
1
|
+
//
|
2
|
+
// MyLauncherItem.h
|
3
|
+
// @rigoneri
|
4
|
+
//
|
5
|
+
// Copyright 2010 Rodrigo Neri
|
6
|
+
// Copyright 2011 David Jarrett
|
7
|
+
//
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
// you may not use this file except in compliance with the License.
|
10
|
+
// You may obtain a copy of the License at
|
11
|
+
//
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
//
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
// See the License for the specific language governing permissions and
|
18
|
+
// limitations under the License.
|
19
|
+
//
|
20
|
+
|
21
|
+
#import <UIKit/UIKit.h>
|
22
|
+
|
23
|
+
@class CustomBadge;
|
24
|
+
|
25
|
+
@protocol MyLauncherItemDelegate <NSObject>
|
26
|
+
-(void)didDeleteItem:(id)item;
|
27
|
+
@end
|
28
|
+
|
29
|
+
@interface MyLauncherItem : UIControl {
|
30
|
+
BOOL dragging;
|
31
|
+
BOOL deletable;
|
32
|
+
BOOL titleBoundToBottom;
|
33
|
+
}
|
34
|
+
|
35
|
+
@property (nonatomic, assign) id delegate;
|
36
|
+
@property (nonatomic, retain) NSString *title;
|
37
|
+
@property (nonatomic, retain) NSString *image;
|
38
|
+
@property (nonatomic, retain) NSString *iPadImage;
|
39
|
+
@property (nonatomic, retain) NSString *controllerStr;
|
40
|
+
@property (nonatomic, retain) NSString *controllerTitle;
|
41
|
+
@property (nonatomic, retain) UIButton *closeButton;
|
42
|
+
@property (nonatomic, retain) CustomBadge *badge;
|
43
|
+
|
44
|
+
-(id)initWithTitle:(NSString *)title image:(NSString *)image target:(NSString *)targetControllerStr deletable:(BOOL)_deletable;
|
45
|
+
-(id)initWithTitle:(NSString *)title iPhoneImage:(NSString *)image iPadImage:(NSString *)iPadImage target:(NSString *)targetControllerStr targetTitle:(NSString *)targetTitle deletable:(BOOL)_deletable;
|
46
|
+
-(void)layoutItem;
|
47
|
+
-(void)setDragging:(BOOL)flag;
|
48
|
+
-(BOOL)dragging;
|
49
|
+
-(BOOL)deletable;
|
50
|
+
|
51
|
+
-(BOOL)titleBoundToBottom;
|
52
|
+
-(void)setTitleBoundToBottom:(BOOL)bind;
|
53
|
+
|
54
|
+
-(NSString *)badgeText;
|
55
|
+
-(void)setBadgeText:(NSString *)text;
|
56
|
+
-(void)setCustomBadge:(CustomBadge *)customBadge;
|
57
|
+
|
58
|
+
@end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
//
|
2
|
+
// MyLauncherItem.m
|
3
|
+
// @rigoneri
|
4
|
+
//
|
5
|
+
// Copyright 2010 Rodrigo Neri
|
6
|
+
// Copyright 2011 David Jarrett
|
7
|
+
//
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
// you may not use this file except in compliance with the License.
|
10
|
+
// You may obtain a copy of the License at
|
11
|
+
//
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
//
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
// See the License for the specific language governing permissions and
|
18
|
+
// limitations under the License.
|
19
|
+
//
|
20
|
+
|
21
|
+
#import "MyLauncherItem.h"
|
22
|
+
#import "CustomBadge.h"
|
23
|
+
|
24
|
+
@implementation MyLauncherItem
|
25
|
+
|
26
|
+
@synthesize delegate = _delegate;
|
27
|
+
@synthesize title = _title;
|
28
|
+
@synthesize image = _image;
|
29
|
+
@synthesize iPadImage = _iPadImage;
|
30
|
+
@synthesize closeButton = _closeButton;
|
31
|
+
@synthesize controllerStr = _controllerStr;
|
32
|
+
@synthesize controllerTitle = _controllerTitle;
|
33
|
+
@synthesize badge = _badge;
|
34
|
+
|
35
|
+
#pragma mark - Lifecycle
|
36
|
+
|
37
|
+
-(id)initWithTitle:(NSString *)title image:(NSString *)image target:(NSString *)targetControllerStr deletable:(BOOL)_deletable {
|
38
|
+
return [self initWithTitle:title
|
39
|
+
iPhoneImage:image
|
40
|
+
iPadImage:image
|
41
|
+
target:targetControllerStr
|
42
|
+
targetTitle:title
|
43
|
+
deletable:_deletable];
|
44
|
+
}
|
45
|
+
|
46
|
+
-(id)initWithTitle:(NSString *)title iPhoneImage:(NSString *)image iPadImage:(NSString *)iPadImage target:(NSString *)targetControllerStr targetTitle:(NSString *)targetTitle deletable:(BOOL)_deletable {
|
47
|
+
|
48
|
+
if((self = [super init]))
|
49
|
+
{
|
50
|
+
dragging = NO;
|
51
|
+
deletable = _deletable;
|
52
|
+
|
53
|
+
[self setTitle:title];
|
54
|
+
[self setImage:image];
|
55
|
+
[self setIPadImage:iPadImage];
|
56
|
+
[self setControllerStr:targetControllerStr];
|
57
|
+
[self setControllerTitle:targetTitle];
|
58
|
+
|
59
|
+
[self setCloseButton:[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]];
|
60
|
+
self.closeButton.hidden = YES;
|
61
|
+
}
|
62
|
+
return self;
|
63
|
+
}
|
64
|
+
|
65
|
+
#pragma mark - Layout
|
66
|
+
|
67
|
+
-(void)layoutItem
|
68
|
+
{
|
69
|
+
if(!self.image)
|
70
|
+
return;
|
71
|
+
|
72
|
+
for(id subview in [self subviews])
|
73
|
+
[subview removeFromSuperview];
|
74
|
+
|
75
|
+
UIImage *image = nil;
|
76
|
+
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && [self iPadImage]) {
|
77
|
+
image = [UIImage imageNamed:self.iPadImage];
|
78
|
+
} else {
|
79
|
+
image = [UIImage imageNamed:self.image];
|
80
|
+
}
|
81
|
+
|
82
|
+
UIImageView *itemImage = [[UIImageView alloc] initWithImage:image];
|
83
|
+
CGFloat itemImageX = (self.bounds.size.width/2) - (itemImage.bounds.size.width/2);
|
84
|
+
CGFloat itemImageY = (self.bounds.size.height/2) - (itemImage.bounds.size.height/2);
|
85
|
+
itemImage.frame = CGRectMake(itemImageX, itemImageY, itemImage.bounds.size.width, itemImage.bounds.size.height);
|
86
|
+
[self addSubview:itemImage];
|
87
|
+
CGFloat itemImageWidth = itemImage.bounds.size.width;
|
88
|
+
|
89
|
+
if(self.badge) {
|
90
|
+
self.badge.frame = CGRectMake((itemImageX + itemImageWidth) - (self.badge.bounds.size.width - 6),
|
91
|
+
itemImageY-6, self.badge.bounds.size.width, self.badge.bounds.size.height);
|
92
|
+
[self addSubview:self.badge];
|
93
|
+
}
|
94
|
+
|
95
|
+
if(deletable)
|
96
|
+
{
|
97
|
+
self.closeButton.frame = CGRectMake(itemImageX-10, itemImageY-10, 30, 30);
|
98
|
+
[self.closeButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
|
99
|
+
self.closeButton.backgroundColor = [UIColor clearColor];
|
100
|
+
[self.closeButton addTarget:self action:@selector(closeItem:) forControlEvents:UIControlEventTouchUpInside];
|
101
|
+
[self addSubview:self.closeButton];
|
102
|
+
}
|
103
|
+
|
104
|
+
CGFloat itemLabelY = itemImageY + itemImage.bounds.size.height;
|
105
|
+
CGFloat itemLabelHeight = self.bounds.size.height - itemLabelY;
|
106
|
+
|
107
|
+
if (titleBoundToBottom)
|
108
|
+
{
|
109
|
+
itemLabelHeight = 34;
|
110
|
+
itemLabelY = (self.bounds.size.height + 6) - itemLabelHeight;
|
111
|
+
}
|
112
|
+
|
113
|
+
UILabel *itemLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, itemLabelY, self.bounds.size.width, itemLabelHeight)];
|
114
|
+
itemLabel.backgroundColor = [UIColor clearColor];
|
115
|
+
itemLabel.font = [UIFont boldSystemFontOfSize:11];
|
116
|
+
itemLabel.textColor = COLOR(46, 46, 46);
|
117
|
+
itemLabel.textAlignment = UITextAlignmentCenter;
|
118
|
+
itemLabel.lineBreakMode = UILineBreakModeTailTruncation;
|
119
|
+
itemLabel.text = self.title;
|
120
|
+
itemLabel.numberOfLines = 2;
|
121
|
+
[self addSubview:itemLabel];
|
122
|
+
}
|
123
|
+
|
124
|
+
#pragma mark - Touch
|
125
|
+
|
126
|
+
-(void)closeItem:(id)sender
|
127
|
+
{
|
128
|
+
[UIView animateWithDuration:0.1
|
129
|
+
delay:0
|
130
|
+
options:UIViewAnimationOptionCurveEaseIn
|
131
|
+
animations:^{
|
132
|
+
self.alpha = 0;
|
133
|
+
self.transform = CGAffineTransformMakeScale(0.00001, 0.00001);
|
134
|
+
}
|
135
|
+
completion:nil];
|
136
|
+
|
137
|
+
[[self delegate] didDeleteItem:self];
|
138
|
+
}
|
139
|
+
|
140
|
+
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event
|
141
|
+
{
|
142
|
+
[super touchesBegan:touches withEvent:event];
|
143
|
+
[[self nextResponder] touchesBegan:touches withEvent:event];
|
144
|
+
}
|
145
|
+
|
146
|
+
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent *)event
|
147
|
+
{
|
148
|
+
[super touchesMoved:touches withEvent:event];
|
149
|
+
[[self nextResponder] touchesMoved:touches withEvent:event];
|
150
|
+
}
|
151
|
+
|
152
|
+
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent *)event
|
153
|
+
{
|
154
|
+
[super touchesEnded:touches withEvent:event];
|
155
|
+
[[self nextResponder] touchesEnded:touches withEvent:event];
|
156
|
+
}
|
157
|
+
|
158
|
+
#pragma mark - Setters and Getters
|
159
|
+
|
160
|
+
-(void)setFrame:(CGRect)frame
|
161
|
+
{
|
162
|
+
[super setFrame:frame];
|
163
|
+
}
|
164
|
+
|
165
|
+
-(void)setDragging:(BOOL)flag
|
166
|
+
{
|
167
|
+
if(dragging == flag)
|
168
|
+
return;
|
169
|
+
|
170
|
+
dragging = flag;
|
171
|
+
|
172
|
+
[UIView animateWithDuration:0.1
|
173
|
+
delay:0
|
174
|
+
options:UIViewAnimationOptionCurveEaseIn
|
175
|
+
animations:^{
|
176
|
+
if(dragging) {
|
177
|
+
self.transform = CGAffineTransformMakeScale(1.4, 1.4);
|
178
|
+
self.alpha = 0.7;
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
self.transform = CGAffineTransformIdentity;
|
182
|
+
self.alpha = 1;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
completion:nil];
|
186
|
+
}
|
187
|
+
|
188
|
+
-(BOOL)dragging
|
189
|
+
{
|
190
|
+
return dragging;
|
191
|
+
}
|
192
|
+
|
193
|
+
-(BOOL)deletable
|
194
|
+
{
|
195
|
+
return deletable;
|
196
|
+
}
|
197
|
+
|
198
|
+
-(BOOL)titleBoundToBottom
|
199
|
+
{
|
200
|
+
return titleBoundToBottom;
|
201
|
+
}
|
202
|
+
|
203
|
+
-(void)setTitleBoundToBottom:(BOOL)bind
|
204
|
+
{
|
205
|
+
titleBoundToBottom = bind;
|
206
|
+
[self layoutItem];
|
207
|
+
}
|
208
|
+
|
209
|
+
-(NSString *)badgeText {
|
210
|
+
return self.badge.badgeText;
|
211
|
+
}
|
212
|
+
|
213
|
+
-(void)setBadgeText:(NSString *)text {
|
214
|
+
if (text && [text length] > 0) {
|
215
|
+
[self setBadge:[CustomBadge customBadgeWithString:text]];
|
216
|
+
} else {
|
217
|
+
[self setBadge:nil];
|
218
|
+
}
|
219
|
+
[self layoutItem];
|
220
|
+
}
|
221
|
+
|
222
|
+
-(void)setCustomBadge:(CustomBadge *)customBadge {
|
223
|
+
[self setBadge:customBadge];
|
224
|
+
[self layoutItem];
|
225
|
+
}
|
226
|
+
|
227
|
+
@end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
//
|
2
|
+
// MyLauncherPageControl.h
|
3
|
+
// @rigoneri
|
4
|
+
//
|
5
|
+
// Copyright 2010 Rodrigo Neri
|
6
|
+
// Copyright 2011 David Jarrett
|
7
|
+
//
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
// you may not use this file except in compliance with the License.
|
10
|
+
// You may obtain a copy of the License at
|
11
|
+
//
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
//
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
// See the License for the specific language governing permissions and
|
18
|
+
// limitations under the License.
|
19
|
+
//
|
20
|
+
|
21
|
+
#import <UIKit/UIKit.h>
|
22
|
+
|
23
|
+
@interface MyLauncherPageControl : UIPageControl {
|
24
|
+
NSInteger currentPage;
|
25
|
+
NSInteger numberOfPages;
|
26
|
+
NSInteger maxNumberOfPages;
|
27
|
+
BOOL hidesForSinglePage;
|
28
|
+
}
|
29
|
+
|
30
|
+
@property (nonatomic) NSInteger currentPage;
|
31
|
+
@property (nonatomic) NSInteger numberOfPages;
|
32
|
+
@property (nonatomic) NSInteger maxNumberOfPages;
|
33
|
+
@property (nonatomic) BOOL hidesForSinglePage;
|
34
|
+
@property (nonatomic, strong) UIColor *inactivePageColor;
|
35
|
+
@property (nonatomic, strong) UIColor *activePageColor;
|
36
|
+
|
37
|
+
@end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
//
|
2
|
+
// MyLauncherPageControl.m
|
3
|
+
// @rigoneri
|
4
|
+
//
|
5
|
+
// Copyright 2010 Rodrigo Neri
|
6
|
+
// Copyright 2011 David Jarrett
|
7
|
+
//
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
// you may not use this file except in compliance with the License.
|
10
|
+
// You may obtain a copy of the License at
|
11
|
+
//
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
//
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
// See the License for the specific language governing permissions and
|
18
|
+
// limitations under the License.
|
19
|
+
//
|
20
|
+
|
21
|
+
#import "MyLauncherPageControl.h"
|
22
|
+
|
23
|
+
@implementation MyLauncherPageControl
|
24
|
+
|
25
|
+
@synthesize numberOfPages, maxNumberOfPages, hidesForSinglePage;
|
26
|
+
@synthesize inactivePageColor = _inactivePageColor;
|
27
|
+
@synthesize activePageColor = _activePageColor;
|
28
|
+
@dynamic currentPage;
|
29
|
+
|
30
|
+
- (id)initWithFrame:(CGRect)frame
|
31
|
+
{
|
32
|
+
if ((self = [super initWithFrame:frame]))
|
33
|
+
{
|
34
|
+
hidesForSinglePage = NO;
|
35
|
+
maxNumberOfPages = 20; // Max before clipping
|
36
|
+
[self setActivePageColor:COLOR(2, 100, 162)];
|
37
|
+
[self setInactivePageColor:[UIColor grayColor]];
|
38
|
+
}
|
39
|
+
return self;
|
40
|
+
}
|
41
|
+
|
42
|
+
- (void)drawRect:(CGRect)rect
|
43
|
+
{
|
44
|
+
if (hidesForSinglePage == NO || [self numberOfPages] > 1)
|
45
|
+
{
|
46
|
+
CGContextRef context = UIGraphicsGetCurrentContext();
|
47
|
+
|
48
|
+
CGFloat dotSize = 7;
|
49
|
+
CGFloat margin = 5;
|
50
|
+
CGFloat dotWidth = dotSize + (2 * margin);
|
51
|
+
CGFloat totalWidth = (dotWidth * [self numberOfPages]) + (2 * margin);
|
52
|
+
|
53
|
+
CGRect contentRect = CGRectMake(round(self.frame.size.width/2 - totalWidth/2),
|
54
|
+
round(self.frame.size.height/2 - dotSize/2),
|
55
|
+
dotSize, dotSize);
|
56
|
+
|
57
|
+
contentRect.origin.x += margin;
|
58
|
+
for (NSInteger i = 0; i < [self numberOfPages]; i++)
|
59
|
+
{
|
60
|
+
contentRect.origin.x += margin;
|
61
|
+
|
62
|
+
if (i == [self currentPage])
|
63
|
+
{
|
64
|
+
CGContextSetFillColorWithColor(context, [self.activePageColor CGColor]);
|
65
|
+
}
|
66
|
+
else
|
67
|
+
{
|
68
|
+
CGContextSetFillColorWithColor(context, [self.inactivePageColor CGColor]);
|
69
|
+
}
|
70
|
+
CGContextFillEllipseInRect(context, contentRect);
|
71
|
+
contentRect.origin.x += dotSize + margin;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
- (NSInteger)currentPage
|
77
|
+
{
|
78
|
+
return currentPage;
|
79
|
+
}
|
80
|
+
|
81
|
+
- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
|
82
|
+
{
|
83
|
+
if (self.touchInside)
|
84
|
+
{
|
85
|
+
CGPoint point = [touch locationInView:self];
|
86
|
+
NSInteger currentPageInt = self.currentPage;
|
87
|
+
|
88
|
+
if (point.x <= self.frame.size.width/2)
|
89
|
+
[self setCurrentPage:--currentPageInt];
|
90
|
+
else
|
91
|
+
[self setCurrentPage:++currentPageInt];
|
92
|
+
|
93
|
+
[self sendActionsForControlEvents:UIControlEventValueChanged];
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
-(void)setNumberOfPages:(NSInteger)count
|
98
|
+
{
|
99
|
+
if (count > maxNumberOfPages) return;
|
100
|
+
self.hidden = count <= 1 ? YES : NO;
|
101
|
+
|
102
|
+
numberOfPages = count;
|
103
|
+
if (currentPage > [self numberOfPages]-1) [self setCurrentPage:[self numberOfPages] - 1];
|
104
|
+
|
105
|
+
[self setNeedsDisplay];
|
106
|
+
}
|
107
|
+
|
108
|
+
- (void)setCurrentPage:(NSInteger)page
|
109
|
+
{
|
110
|
+
if (page > [self numberOfPages]-1) page = [self numberOfPages] - 1;
|
111
|
+
if (page < 0) page = 0;
|
112
|
+
|
113
|
+
currentPage = page;
|
114
|
+
[self setNeedsDisplay];
|
115
|
+
}
|
116
|
+
|
117
|
+
@end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// MyLauncherScrollView.h
|
3
|
+
// @rigoneri
|
4
|
+
//
|
5
|
+
// Copyright 2010 Rodrigo Neri
|
6
|
+
//
|
7
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
// you may not use this file except in compliance with the License.
|
9
|
+
// You may obtain a copy of the License at
|
10
|
+
//
|
11
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
//
|
13
|
+
// Unless required by applicable law or agreed to in writing, software
|
14
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
// See the License for the specific language governing permissions and
|
17
|
+
// limitations under the License.
|
18
|
+
//
|
19
|
+
|
20
|
+
#import <UIKit/UIKit.h>
|
21
|
+
|
22
|
+
@interface MyLauncherScrollView : UIScrollView
|
23
|
+
@end
|