├── .gitignore
├── English.lproj
└── InfoPlist.strings
├── Info.plist
├── UIClipView.h
├── UIClipView.m
├── UIColor.h
├── UIColor.m
├── UIFont.h
├── UIFont.m
├── UIImage.h
├── UIImage.m
├── UIKit.h
├── UIKit.xcodeproj
├── TemplateIcon.icns
└── project.pbxproj
├── UIKitDefines.h
├── UIKit_Prefix.pch
├── UILabel.h
├── UILabel.m
├── UIScrollView.h
├── UIScrollView.m
├── UITableView.h
├── UITableView.m
├── UITableViewCell-Private.h
├── UITableViewCell.h
├── UITableViewCell.m
├── UIText.h
├── UITextField.h
├── UITextField.m
├── UIView.h
├── UIView.m
└── version.plist
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.mode1v3
3 | *.pbxuser
4 |
--------------------------------------------------------------------------------
/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enormego/UIKit/af0df999735b29259b2a64342d616bc04bce54de/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleName
10 | ${PRODUCT_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | com.yourcompany.${PRODUCT_NAME:identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/UIClipView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIClipView.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIClipView : NSClipView {
12 |
13 | }
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/UIClipView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIClipView.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIClipView.h"
10 | #import "UIColor.h"
11 |
12 |
13 | @implementation UIClipView
14 |
15 | - (id)initWithFrame:(NSRect)frameRect {
16 | if((self = [super initWithFrame:frameRect])) {
17 | [self setWantsLayer:YES];
18 | }
19 |
20 | return self;
21 | }
22 |
23 | - (id)initWithCoder:(NSCoder *)aDecoder {
24 | if((self = [super initWithCoder:aDecoder])) {
25 | [self setWantsLayer:YES];
26 | }
27 |
28 | return self;
29 | }
30 |
31 | - (BOOL)isFlipped {
32 | return YES;
33 | }
34 |
35 | - (NSString*)description {
36 | NSString* description = [super description];
37 | description = [description substringToIndex:description.length - 1];
38 | description = [description stringByAppendingFormat:@"; %@>", NSStringFromRect(self.frame)];
39 | return description;
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/UIColor.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface UIColor : NSObject {
14 | @private
15 | CGColorRef CGColor;
16 | }
17 |
18 | // Convenience methods for creating autoreleased colors
19 | + (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha;
20 | + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha;
21 | + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
22 | + (UIColor *)colorWithCGColor:(CGColorRef)cgColor;
23 | + (UIColor *)colorWithPatternImage:(UIImage *)image;
24 | + (UIColor *)colorWithPatternImageRef:(CGImageRef)imageRef; // Not available on iPhone (UIImage on iPhone is a toll free bridge with CGImageRef)
25 |
26 | // Initializers for creating non-autoreleased colors
27 | - (UIColor *)initWithWhite:(CGFloat)white alpha:(CGFloat)alpha;
28 | - (UIColor *)initWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha;
29 | - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
30 | - (UIColor *)initWithCGColor:(CGColorRef)cgColor;
31 | - (UIColor *)initWithPatternImage:(UIImage*)image;
32 | - (UIColor *)initWithPatternImageRef:(CGImageRef)imageRef;
33 |
34 | // Some convenience methods to create colors. These colors will be as calibrated as possible.
35 | // These colors are cached.
36 | + (UIColor *)blackColor; // 0.0 white
37 | + (UIColor *)darkGrayColor; // 0.333 white
38 | + (UIColor *)lightGrayColor; // 0.667 white
39 | + (UIColor *)whiteColor; // 1.0 white
40 | + (UIColor *)grayColor; // 0.5 white
41 | + (UIColor *)redColor; // 1.0, 0.0, 0.0 RGB
42 | + (UIColor *)greenColor; // 0.0, 1.0, 0.0 RGB
43 | + (UIColor *)blueColor; // 0.0, 0.0, 1.0 RGB
44 | + (UIColor *)cyanColor; // 0.0, 1.0, 1.0 RGB
45 | + (UIColor *)yellowColor; // 1.0, 1.0, 0.0 RGB
46 | + (UIColor *)magentaColor; // 1.0, 0.0, 1.0 RGB
47 | + (UIColor *)orangeColor; // 1.0, 0.5, 0.0 RGB
48 | + (UIColor *)purpleColor; // 0.5, 0.0, 0.5 RGB
49 | + (UIColor *)brownColor; // 0.6, 0.4, 0.2 RGB
50 | + (UIColor *)clearColor; // 0.0 white, 0.0 alpha
51 |
52 | // Set the color: Sets the fill and stroke colors in the current drawing context. Should be implemented by subclassers.
53 | - (void)set;
54 |
55 | // Set the fill or stroke colors individually. These should be implemented by subclassers.
56 | - (void)setFill;
57 | - (void)setStroke;
58 |
59 | // Returns a color in the same color space as the receiver with the specified alpha component.
60 | - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha;
61 |
62 | // Access the underlying CGColor
63 | @property(nonatomic,readonly) CGColorRef CGColor;
64 |
65 | // Converst to NSColor
66 | @property(nonatomic,readonly) NSColor* NSColor;
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/UIColor.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIColor.h"
10 |
11 | CGPatternRef CreateImagePattern(CGImageRef image);
12 | CGColorRef CreatePatternColor(CGImageRef image);
13 |
14 | @implementation UIColor
15 |
16 | // Convenience methods for creating autoreleased colors
17 | + (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha {
18 | return [[[UIColor alloc] initWithWhite:white alpha:alpha] autorelease];
19 | }
20 |
21 | + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha {
22 | return [[[UIColor alloc] initWithHue:hue saturation:saturation brightness:brightness alpha:alpha] autorelease];
23 | }
24 |
25 | + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha {
26 | return [[[UIColor alloc] initWithRed:red green:green blue:blue alpha:alpha] autorelease];
27 | }
28 |
29 | + (UIColor *)colorWithCGColor:(CGColorRef)cgColor {
30 | return [[[UIColor alloc] initWithCGColor:cgColor] autorelease];
31 | }
32 |
33 | + (UIColor *)colorWithPatternImage:(UIImage *)image {
34 | return [[[UIColor alloc] initWithPatternImage:image] autorelease];
35 | }
36 |
37 | + (UIColor *)colorWithPatternImageRef:(CGImageRef)imageRef {
38 | return [[[UIColor alloc] initWithPatternImageRef:imageRef] autorelease];
39 | }
40 |
41 | // Initializers for creating non-autoreleased colors
42 | - (UIColor *)initWithWhite:(CGFloat)white alpha:(CGFloat)alpha {
43 | if((self = [super init])) {
44 | CGColor = CGColorCreateGenericGray(white, alpha);
45 | }
46 |
47 | return self;
48 | }
49 |
50 | - (UIColor *)initWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha {
51 | hue = roundf(hue * 100) / 100;
52 | saturation = roundf(saturation * 100) / 100;
53 | brightness = roundf(brightness * 100) / 100;
54 |
55 | NSInteger hexBrightness = (NSInteger)roundf(brightness * 2.55f);
56 | NSInteger red = 0;
57 | NSInteger green = 0;
58 | NSInteger blue = 0;
59 |
60 | if (saturation == 0.0f) {
61 | red = green = blue = hexBrightness;
62 | } else {
63 |
64 | NSInteger Hi = floor(hue / 60);
65 | NSInteger f = hue / 60 - Hi;
66 | NSInteger p = round(brightness * (100 - saturation) * .0255);
67 | NSInteger q = round(brightness * (100 - f * saturation) * .0255);
68 | NSInteger t = round(brightness * (100 - (1 - f) * saturation) * .0255);
69 |
70 | switch (Hi) {
71 | case 0:
72 | red = hexBrightness;
73 | green = t;
74 | blue = p;
75 | break;
76 | case 1:
77 | red = q;
78 | green = hexBrightness;
79 | blue = p;
80 | break;
81 | case 2:
82 | red = p;
83 | green = hexBrightness;
84 | blue = t;
85 | break;
86 | case 3:
87 | red = p;
88 | green = q;
89 | blue = hexBrightness;
90 | break;
91 | case 4:
92 | red = t;
93 | green = p;
94 | blue = hexBrightness;
95 | break;
96 | case 5:
97 | red = hexBrightness;
98 | green = p;
99 | blue = q;
100 | }
101 | }
102 |
103 | return [self initWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:alpha];
104 | }
105 |
106 | - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha {
107 | if((self = [super init])) {
108 | CGColor = CGColorCreateGenericRGB(red, green, blue, alpha);
109 | }
110 |
111 | return self;
112 | }
113 |
114 | - (UIColor *)initWithCGColor:(CGColorRef)cgColor {
115 | if((self = [super init])) {
116 | CGColor = CGColorRetain(cgColor);
117 | }
118 |
119 | return self;
120 | }
121 |
122 | - (UIColor *)initWithPatternImage:(UIImage*)image {
123 | return nil;
124 | }
125 |
126 | - (UIColor *)initWithPatternImageRef:(CGImageRef)imageRef {
127 | if((self = [super init])) {
128 | CGColor = CreatePatternColor(imageRef);
129 | }
130 |
131 | return self;
132 | }
133 |
134 | + (UIColor *)blackColor {
135 | return [UIColor colorWithWhite:0.0f alpha:1.0f];
136 | }
137 |
138 | + (UIColor *)darkGrayColor {
139 | return [UIColor colorWithWhite:0.333f alpha:1.0f];
140 | }
141 |
142 | + (UIColor *)lightGrayColor {
143 | return [UIColor colorWithWhite:0.667f alpha:1.0f];
144 | }
145 |
146 | + (UIColor *)whiteColor {
147 | return [UIColor colorWithWhite:1.0f alpha:1.0f];
148 | }
149 |
150 | + (UIColor *)grayColor {
151 | return [UIColor colorWithWhite:0.5f alpha:1.0f];
152 | }
153 |
154 | + (UIColor *)redColor {
155 | return [UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:1.0f];
156 | }
157 |
158 | + (UIColor *)greenColor {
159 | return [UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:1.0f];
160 | }
161 |
162 | + (UIColor *)blueColor {
163 | return [UIColor colorWithRed:0.0f green:0.0f blue:1.0f alpha:1.0f];
164 | }
165 |
166 | + (UIColor *)cyanColor {
167 | return [UIColor colorWithRed:0.0f green:1.0f blue:1.0f alpha:1.0f];
168 | }
169 |
170 | + (UIColor *)yellowColor {
171 | return [UIColor colorWithRed:1.0f green:1.0f blue:0.0f alpha:1.0f];
172 | }
173 |
174 | + (UIColor *)magentaColor {
175 | return [UIColor colorWithRed:1.0f green:0.0f blue:1.0f alpha:1.0f];
176 | }
177 |
178 | + (UIColor *)orangeColor {
179 | return [UIColor colorWithRed:1.0f green:0.5f blue:0.0f alpha:1.0f];
180 | }
181 |
182 | + (UIColor *)purpleColor {
183 | return [UIColor colorWithRed:0.5f green:0.0f blue:0.5f alpha:1.0f];
184 | }
185 |
186 | + (UIColor *)brownColor {
187 | return [UIColor colorWithRed:0.6f green:0.4f blue:0.2f alpha:1.0f];
188 | }
189 |
190 | + (UIColor *)clearColor {
191 | return [UIColor colorWithWhite:0.0f alpha:0.0f];
192 | }
193 |
194 | // Set the color: Sets the fill and stroke colors in the current drawing context. Should be implemented by subclassers.
195 | - (void)set {
196 | // Not sure
197 | }
198 |
199 | // Set the fill or stroke colors individually. These should be implemented by subclassers.
200 | - (void)setFill {
201 | // Not sure
202 | }
203 |
204 | - (void)setStroke {
205 | // Not sure
206 | }
207 |
208 | // Returns a color in the same color space as the receiver with the specified alpha component.
209 | - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha {
210 | CGColorRef cgColor = CGColorCreateCopyWithAlpha(self.CGColor, alpha);
211 | UIColor* color = [UIColor colorWithCGColor:cgColor];
212 | CGColorRelease(cgColor);
213 | return color;
214 | }
215 |
216 | - (CGColorRef)CGColor {
217 | return CGColor;
218 | }
219 |
220 | - (NSColor*)NSColor {
221 | NSColorSpace* colorSpace = [[[NSColorSpace alloc] initWithCGColorSpace:CGColorGetColorSpace(self.CGColor)] autorelease];
222 | const CGFloat* components = (const CGFloat*)CGColorGetComponents(self.CGColor);
223 | NSInteger numberOfComponents = CGColorGetNumberOfComponents(self.CGColor);
224 |
225 | return [NSColor colorWithColorSpace:colorSpace components:components count:numberOfComponents];
226 | }
227 |
228 | - (BOOL)isEqual:(UIColor*)aColor {
229 | if(![aColor isKindOfClass:[UIColor class]]) return NO;
230 | return CGColorEqualToColor(self.CGColor, aColor.CGColor);
231 | }
232 |
233 | - (void)dealloc {
234 | CGColorRelease(CGColor);
235 | [super dealloc];
236 | }
237 |
238 |
239 | @end
240 |
241 |
242 | /*
243 | * @see http://developer.apple.com/mac/library/samplecode/GeekGameBoard/listing38.html
244 | */
245 |
246 | // callback for CreateImagePattern.
247 | static void drawPatternImage (void *info, CGContextRef ctx) {
248 | CGImageRef image = (CGImageRef) info;
249 | CGContextDrawImage(ctx,
250 | CGRectMake(0,0, CGImageGetWidth(image),CGImageGetHeight(image)),
251 | image);
252 | }
253 |
254 | // callback for CreateImagePattern.
255 | static void releasePatternImage( void *info ) {
256 | CGImageRelease( (CGImageRef)info );
257 | }
258 |
259 |
260 | CGPatternRef CreateImagePattern(CGImageRef image) {
261 | NSCParameterAssert(image);
262 | int width = CGImageGetWidth(image);
263 | int height = CGImageGetHeight(image);
264 | static const CGPatternCallbacks callbacks = {0, &drawPatternImage, &releasePatternImage};
265 | return CGPatternCreate (image,
266 | CGRectMake (0, 0, width, height),
267 | CGAffineTransformMake (1, 0, 0, 1, 0, 0),
268 | width,
269 | height,
270 | kCGPatternTilingConstantSpacing,
271 | true,
272 | &callbacks);
273 | }
274 |
275 |
276 | CGColorRef CreatePatternColor(CGImageRef image) {
277 | CGPatternRef pattern = CreateImagePattern(image);
278 | CGColorSpaceRef space = CGColorSpaceCreatePattern(NULL);
279 | CGFloat components[1] = {1.0};
280 | CGColorRef color = CGColorCreateWithPattern(space, pattern, components);
281 | CGColorSpaceRelease(space);
282 | CGPatternRelease(pattern);
283 | return color;
284 | }
--------------------------------------------------------------------------------
/UIFont.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIFont.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface UIFont : NSFont {
13 |
14 | }
15 |
16 | + (UIFont *)systemFontOfSize:(CGFloat)fontSize;
17 | + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/UIFont.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIFont.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIFont.h"
10 |
11 |
12 | @implementation UIFont
13 |
14 | + (UIFont *)systemFontOfSize:(CGFloat)fontSize {
15 | return (UIFont *)[[self class] fontWithName:@"Helvetica" size:fontSize];
16 | }
17 |
18 | + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize {
19 | return (UIFont *)[[self class] fontWithName:@"Helvetica Bold" size:fontSize];
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/UIImage.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface UIImage : NSImage {
13 |
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/UIImage.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIImage.h"
10 |
11 |
12 | @implementation UIImage
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/UIKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIKit.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 | #import
13 | #import
14 | #import
15 | #import
16 | #import
17 | #import
18 | #import
19 | #import
--------------------------------------------------------------------------------
/UIKit.xcodeproj/TemplateIcon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/enormego/UIKit/af0df999735b29259b2a64342d616bc04bce54de/UIKit.xcodeproj/TemplateIcon.icns
--------------------------------------------------------------------------------
/UIKit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 45;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 28092F91101378D600AE0F9A /* UILabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 28092F8F101378D600AE0F9A /* UILabel.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 28092F92101378D600AE0F9A /* UILabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 28092F90101378D600AE0F9A /* UILabel.m */; };
12 | 28092FA01013793B00AE0F9A /* UIColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 28092F9E1013793B00AE0F9A /* UIColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
13 | 28092FA11013793B00AE0F9A /* UIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 28092F9F1013793B00AE0F9A /* UIColor.m */; };
14 | 28092FC810137B6B00AE0F9A /* UIImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 28092FC610137B6B00AE0F9A /* UIImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
15 | 28092FC910137B6B00AE0F9A /* UIImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 28092FC710137B6B00AE0F9A /* UIImage.m */; };
16 | 280930211013854900AE0F9A /* UIClipView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2809301F1013854900AE0F9A /* UIClipView.h */; settings = {ATTRIBUTES = (Public, ); }; };
17 | 280930221013854900AE0F9A /* UIClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 280930201013854900AE0F9A /* UIClipView.m */; };
18 | 280932EE10139A5700AE0F9A /* UITableViewCell-Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 280932EC10139A5700AE0F9A /* UITableViewCell-Private.h */; settings = {ATTRIBUTES = (Public, ); }; };
19 | 280934411013A99F00AE0F9A /* UIFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 2809343F1013A99F00AE0F9A /* UIFont.h */; settings = {ATTRIBUTES = (Public, ); }; };
20 | 280934421013A99F00AE0F9A /* UIFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 280934401013A99F00AE0F9A /* UIFont.m */; };
21 | 28093688101560AF00AE0F9A /* UITextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 28093686101560AF00AE0F9A /* UITextField.h */; settings = {ATTRIBUTES = (Public, ); }; };
22 | 28093689101560AF00AE0F9A /* UITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 28093687101560AF00AE0F9A /* UITextField.m */; };
23 | 280A6E3D1083B56E00D056F0 /* UIText.h in Headers */ = {isa = PBXBuildFile; fileRef = 280A6E3B1083B56E00D056F0 /* UIText.h */; settings = {ATTRIBUTES = (Public, ); }; };
24 | 284CBB3C0FAA51AA007DBD91 /* UIView.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB3A0FAA51AA007DBD91 /* UIView.h */; settings = {ATTRIBUTES = (Public, ); }; };
25 | 284CBB3D0FAA51AA007DBD91 /* UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 284CBB3B0FAA51AA007DBD91 /* UIView.m */; };
26 | 284CBB420FAA51B4007DBD91 /* UITableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB400FAA51B4007DBD91 /* UITableView.h */; settings = {ATTRIBUTES = (Public, ); }; };
27 | 284CBB430FAA51B4007DBD91 /* UITableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 284CBB410FAA51B4007DBD91 /* UITableView.m */; };
28 | 284CBB4A0FAA51DF007DBD91 /* UITableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB480FAA51DF007DBD91 /* UITableViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
29 | 284CBB4B0FAA51DF007DBD91 /* UITableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 284CBB490FAA51DF007DBD91 /* UITableViewCell.m */; };
30 | 284CBB4F0FAA5201007DBD91 /* UIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB4D0FAA5201007DBD91 /* UIKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
31 | 284CBB530FAA523F007DBD91 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 284CBB520FAA523F007DBD91 /* QuartzCore.framework */; };
32 | 284CBB890FAA52D3007DBD91 /* UIScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB870FAA52D3007DBD91 /* UIScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; };
33 | 284CBB8A0FAA52D3007DBD91 /* UIScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 284CBB880FAA52D3007DBD91 /* UIScrollView.m */; };
34 | 284CBB9F0FAA53D7007DBD91 /* UIKitDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 284CBB9D0FAA53D7007DBD91 /* UIKitDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };
35 | 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
36 | 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
37 | /* End PBXBuildFile section */
38 |
39 | /* Begin PBXFileReference section */
40 | 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; };
41 | 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; };
42 | 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
43 | 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; };
44 | 28092F8F101378D600AE0F9A /* UILabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILabel.h; sourceTree = ""; };
45 | 28092F90101378D600AE0F9A /* UILabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILabel.m; sourceTree = ""; };
46 | 28092F9E1013793B00AE0F9A /* UIColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIColor.h; sourceTree = ""; };
47 | 28092F9F1013793B00AE0F9A /* UIColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIColor.m; sourceTree = ""; };
48 | 28092FC610137B6B00AE0F9A /* UIImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImage.h; sourceTree = ""; };
49 | 28092FC710137B6B00AE0F9A /* UIImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImage.m; sourceTree = ""; };
50 | 2809301F1013854900AE0F9A /* UIClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIClipView.h; sourceTree = ""; };
51 | 280930201013854900AE0F9A /* UIClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIClipView.m; sourceTree = ""; };
52 | 280932EC10139A5700AE0F9A /* UITableViewCell-Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableViewCell-Private.h"; sourceTree = ""; };
53 | 2809343F1013A99F00AE0F9A /* UIFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIFont.h; sourceTree = ""; };
54 | 280934401013A99F00AE0F9A /* UIFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIFont.m; sourceTree = ""; };
55 | 28093686101560AF00AE0F9A /* UITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextField.h; sourceTree = ""; };
56 | 28093687101560AF00AE0F9A /* UITextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITextField.m; sourceTree = ""; };
57 | 280A6E3B1083B56E00D056F0 /* UIText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIText.h; sourceTree = ""; };
58 | 284CBB3A0FAA51AA007DBD91 /* UIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIView.h; sourceTree = ""; };
59 | 284CBB3B0FAA51AA007DBD91 /* UIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIView.m; sourceTree = ""; };
60 | 284CBB400FAA51B4007DBD91 /* UITableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableView.h; sourceTree = ""; };
61 | 284CBB410FAA51B4007DBD91 /* UITableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableView.m; sourceTree = ""; };
62 | 284CBB480FAA51DF007DBD91 /* UITableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewCell.h; sourceTree = ""; };
63 | 284CBB490FAA51DF007DBD91 /* UITableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewCell.m; sourceTree = ""; };
64 | 284CBB4D0FAA5201007DBD91 /* UIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKit.h; sourceTree = ""; };
65 | 284CBB520FAA523F007DBD91 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
66 | 284CBB870FAA52D3007DBD91 /* UIScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollView.h; sourceTree = ""; };
67 | 284CBB880FAA52D3007DBD91 /* UIScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollView.m; sourceTree = ""; };
68 | 284CBB9D0FAA53D7007DBD91 /* UIKitDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKitDefines.h; sourceTree = ""; };
69 | 32DBCF5E0370ADEE00C91783 /* UIKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKit_Prefix.pch; sourceTree = ""; };
70 | 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
71 | 8DC2EF5B0486A6940098B216 /* UIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UIKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
72 | D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; };
73 | /* End PBXFileReference section */
74 |
75 | /* Begin PBXFrameworksBuildPhase section */
76 | 8DC2EF560486A6940098B216 /* Frameworks */ = {
77 | isa = PBXFrameworksBuildPhase;
78 | buildActionMask = 2147483647;
79 | files = (
80 | 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */,
81 | 284CBB530FAA523F007DBD91 /* QuartzCore.framework in Frameworks */,
82 | );
83 | runOnlyForDeploymentPostprocessing = 0;
84 | };
85 | /* End PBXFrameworksBuildPhase section */
86 |
87 | /* Begin PBXGroup section */
88 | 034768DFFF38A50411DB9C8B /* Products */ = {
89 | isa = PBXGroup;
90 | children = (
91 | 8DC2EF5B0486A6940098B216 /* UIKit.framework */,
92 | );
93 | name = Products;
94 | sourceTree = "";
95 | };
96 | 0867D691FE84028FC02AAC07 /* UIKit */ = {
97 | isa = PBXGroup;
98 | children = (
99 | 08FB77AEFE84172EC02AAC07 /* Classes */,
100 | 32C88DFF0371C24200C91783 /* Other Sources */,
101 | 089C1665FE841158C02AAC07 /* Resources */,
102 | 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
103 | 034768DFFF38A50411DB9C8B /* Products */,
104 | );
105 | name = UIKit;
106 | sourceTree = "";
107 | };
108 | 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
109 | isa = PBXGroup;
110 | children = (
111 | 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */,
112 | 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */,
113 | );
114 | name = "External Frameworks and Libraries";
115 | sourceTree = "";
116 | };
117 | 089C1665FE841158C02AAC07 /* Resources */ = {
118 | isa = PBXGroup;
119 | children = (
120 | 8DC2EF5A0486A6940098B216 /* Info.plist */,
121 | 089C1666FE841158C02AAC07 /* InfoPlist.strings */,
122 | );
123 | name = Resources;
124 | sourceTree = "";
125 | };
126 | 08FB77AEFE84172EC02AAC07 /* Classes */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 280A6E3B1083B56E00D056F0 /* UIText.h */,
130 | 284CBB9D0FAA53D7007DBD91 /* UIKitDefines.h */,
131 | 284CBB4D0FAA5201007DBD91 /* UIKit.h */,
132 | 284CBB3A0FAA51AA007DBD91 /* UIView.h */,
133 | 284CBB3B0FAA51AA007DBD91 /* UIView.m */,
134 | 28092F8F101378D600AE0F9A /* UILabel.h */,
135 | 28092F90101378D600AE0F9A /* UILabel.m */,
136 | 28092F9E1013793B00AE0F9A /* UIColor.h */,
137 | 28092F9F1013793B00AE0F9A /* UIColor.m */,
138 | 2809343F1013A99F00AE0F9A /* UIFont.h */,
139 | 280934401013A99F00AE0F9A /* UIFont.m */,
140 | 28092FC610137B6B00AE0F9A /* UIImage.h */,
141 | 28092FC710137B6B00AE0F9A /* UIImage.m */,
142 | 284CBB400FAA51B4007DBD91 /* UITableView.h */,
143 | 284CBB410FAA51B4007DBD91 /* UITableView.m */,
144 | 284CBB480FAA51DF007DBD91 /* UITableViewCell.h */,
145 | 284CBB490FAA51DF007DBD91 /* UITableViewCell.m */,
146 | 280932EC10139A5700AE0F9A /* UITableViewCell-Private.h */,
147 | 284CBB870FAA52D3007DBD91 /* UIScrollView.h */,
148 | 284CBB880FAA52D3007DBD91 /* UIScrollView.m */,
149 | 2809301F1013854900AE0F9A /* UIClipView.h */,
150 | 280930201013854900AE0F9A /* UIClipView.m */,
151 | 28093686101560AF00AE0F9A /* UITextField.h */,
152 | 28093687101560AF00AE0F9A /* UITextField.m */,
153 | );
154 | name = Classes;
155 | sourceTree = "";
156 | };
157 | 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = {
158 | isa = PBXGroup;
159 | children = (
160 | 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */,
161 | );
162 | name = "Linked Frameworks";
163 | sourceTree = "";
164 | };
165 | 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = {
166 | isa = PBXGroup;
167 | children = (
168 | 284CBB520FAA523F007DBD91 /* QuartzCore.framework */,
169 | 0867D6A5FE840307C02AAC07 /* AppKit.framework */,
170 | D2F7E79907B2D74100F64583 /* CoreData.framework */,
171 | 0867D69BFE84028FC02AAC07 /* Foundation.framework */,
172 | );
173 | name = "Other Frameworks";
174 | sourceTree = "";
175 | };
176 | 32C88DFF0371C24200C91783 /* Other Sources */ = {
177 | isa = PBXGroup;
178 | children = (
179 | 32DBCF5E0370ADEE00C91783 /* UIKit_Prefix.pch */,
180 | );
181 | name = "Other Sources";
182 | sourceTree = "";
183 | };
184 | /* End PBXGroup section */
185 |
186 | /* Begin PBXHeadersBuildPhase section */
187 | 8DC2EF500486A6940098B216 /* Headers */ = {
188 | isa = PBXHeadersBuildPhase;
189 | buildActionMask = 2147483647;
190 | files = (
191 | 284CBB3C0FAA51AA007DBD91 /* UIView.h in Headers */,
192 | 284CBB420FAA51B4007DBD91 /* UITableView.h in Headers */,
193 | 284CBB4A0FAA51DF007DBD91 /* UITableViewCell.h in Headers */,
194 | 284CBB4F0FAA5201007DBD91 /* UIKit.h in Headers */,
195 | 284CBB890FAA52D3007DBD91 /* UIScrollView.h in Headers */,
196 | 284CBB9F0FAA53D7007DBD91 /* UIKitDefines.h in Headers */,
197 | 28092F91101378D600AE0F9A /* UILabel.h in Headers */,
198 | 28092FA01013793B00AE0F9A /* UIColor.h in Headers */,
199 | 28092FC810137B6B00AE0F9A /* UIImage.h in Headers */,
200 | 280930211013854900AE0F9A /* UIClipView.h in Headers */,
201 | 280932EE10139A5700AE0F9A /* UITableViewCell-Private.h in Headers */,
202 | 280934411013A99F00AE0F9A /* UIFont.h in Headers */,
203 | 28093688101560AF00AE0F9A /* UITextField.h in Headers */,
204 | 280A6E3D1083B56E00D056F0 /* UIText.h in Headers */,
205 | );
206 | runOnlyForDeploymentPostprocessing = 0;
207 | };
208 | /* End PBXHeadersBuildPhase section */
209 |
210 | /* Begin PBXNativeTarget section */
211 | 8DC2EF4F0486A6940098B216 /* UIKit */ = {
212 | isa = PBXNativeTarget;
213 | buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "UIKit" */;
214 | buildPhases = (
215 | 8DC2EF500486A6940098B216 /* Headers */,
216 | 8DC2EF520486A6940098B216 /* Resources */,
217 | 8DC2EF540486A6940098B216 /* Sources */,
218 | 8DC2EF560486A6940098B216 /* Frameworks */,
219 | );
220 | buildRules = (
221 | );
222 | dependencies = (
223 | );
224 | name = UIKit;
225 | productInstallPath = "$(HOME)/Library/Frameworks";
226 | productName = UIKit;
227 | productReference = 8DC2EF5B0486A6940098B216 /* UIKit.framework */;
228 | productType = "com.apple.product-type.framework";
229 | };
230 | /* End PBXNativeTarget section */
231 |
232 | /* Begin PBXProject section */
233 | 0867D690FE84028FC02AAC07 /* Project object */ = {
234 | isa = PBXProject;
235 | buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UIKit" */;
236 | compatibilityVersion = "Xcode 3.1";
237 | hasScannedForEncodings = 1;
238 | mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */;
239 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
240 | projectDirPath = "";
241 | projectRoot = "";
242 | targets = (
243 | 8DC2EF4F0486A6940098B216 /* UIKit */,
244 | );
245 | };
246 | /* End PBXProject section */
247 |
248 | /* Begin PBXResourcesBuildPhase section */
249 | 8DC2EF520486A6940098B216 /* Resources */ = {
250 | isa = PBXResourcesBuildPhase;
251 | buildActionMask = 2147483647;
252 | files = (
253 | 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
254 | );
255 | runOnlyForDeploymentPostprocessing = 0;
256 | };
257 | /* End PBXResourcesBuildPhase section */
258 |
259 | /* Begin PBXSourcesBuildPhase section */
260 | 8DC2EF540486A6940098B216 /* Sources */ = {
261 | isa = PBXSourcesBuildPhase;
262 | buildActionMask = 2147483647;
263 | files = (
264 | 284CBB3D0FAA51AA007DBD91 /* UIView.m in Sources */,
265 | 284CBB430FAA51B4007DBD91 /* UITableView.m in Sources */,
266 | 284CBB4B0FAA51DF007DBD91 /* UITableViewCell.m in Sources */,
267 | 284CBB8A0FAA52D3007DBD91 /* UIScrollView.m in Sources */,
268 | 28092F92101378D600AE0F9A /* UILabel.m in Sources */,
269 | 28092FA11013793B00AE0F9A /* UIColor.m in Sources */,
270 | 28092FC910137B6B00AE0F9A /* UIImage.m in Sources */,
271 | 280930221013854900AE0F9A /* UIClipView.m in Sources */,
272 | 280934421013A99F00AE0F9A /* UIFont.m in Sources */,
273 | 28093689101560AF00AE0F9A /* UITextField.m in Sources */,
274 | );
275 | runOnlyForDeploymentPostprocessing = 0;
276 | };
277 | /* End PBXSourcesBuildPhase section */
278 |
279 | /* Begin PBXVariantGroup section */
280 | 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
281 | isa = PBXVariantGroup;
282 | children = (
283 | 089C1667FE841158C02AAC07 /* English */,
284 | );
285 | name = InfoPlist.strings;
286 | sourceTree = "";
287 | };
288 | /* End PBXVariantGroup section */
289 |
290 | /* Begin XCBuildConfiguration section */
291 | 1DEB91AE08733DA50010E9CD /* Debug */ = {
292 | isa = XCBuildConfiguration;
293 | buildSettings = {
294 | ALWAYS_SEARCH_USER_PATHS = NO;
295 | COPY_PHASE_STRIP = NO;
296 | DYLIB_COMPATIBILITY_VERSION = 1;
297 | DYLIB_CURRENT_VERSION = 1;
298 | FRAMEWORK_VERSION = A;
299 | GCC_DYNAMIC_NO_PIC = NO;
300 | GCC_ENABLE_FIX_AND_CONTINUE = YES;
301 | GCC_MODEL_TUNING = G5;
302 | GCC_OPTIMIZATION_LEVEL = 0;
303 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
304 | GCC_PREFIX_HEADER = UIKit_Prefix.pch;
305 | INFOPLIST_FILE = Info.plist;
306 | INSTALL_PATH = "@executable_path/../Frameworks";
307 | PRODUCT_NAME = UIKit;
308 | WRAPPER_EXTENSION = framework;
309 | };
310 | name = Debug;
311 | };
312 | 1DEB91AF08733DA50010E9CD /* Release */ = {
313 | isa = XCBuildConfiguration;
314 | buildSettings = {
315 | ALWAYS_SEARCH_USER_PATHS = NO;
316 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
317 | DYLIB_COMPATIBILITY_VERSION = 1;
318 | DYLIB_CURRENT_VERSION = 1;
319 | FRAMEWORK_VERSION = A;
320 | GCC_MODEL_TUNING = G5;
321 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
322 | GCC_PREFIX_HEADER = UIKit_Prefix.pch;
323 | INFOPLIST_FILE = Info.plist;
324 | INSTALL_PATH = "@executable_path/../Frameworks";
325 | PRODUCT_NAME = UIKit;
326 | WRAPPER_EXTENSION = framework;
327 | };
328 | name = Release;
329 | };
330 | 1DEB91B208733DA50010E9CD /* Debug */ = {
331 | isa = XCBuildConfiguration;
332 | buildSettings = {
333 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
334 | GCC_C_LANGUAGE_STANDARD = c99;
335 | GCC_OPTIMIZATION_LEVEL = 0;
336 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
337 | GCC_WARN_UNUSED_VARIABLE = YES;
338 | ONLY_ACTIVE_ARCH = YES;
339 | PREBINDING = NO;
340 | SDKROOT = macosx10.5;
341 | };
342 | name = Debug;
343 | };
344 | 1DEB91B308733DA50010E9CD /* Release */ = {
345 | isa = XCBuildConfiguration;
346 | buildSettings = {
347 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
348 | GCC_C_LANGUAGE_STANDARD = c99;
349 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
350 | GCC_WARN_UNUSED_VARIABLE = YES;
351 | PREBINDING = NO;
352 | SDKROOT = macosx10.5;
353 | };
354 | name = Release;
355 | };
356 | /* End XCBuildConfiguration section */
357 |
358 | /* Begin XCConfigurationList section */
359 | 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "UIKit" */ = {
360 | isa = XCConfigurationList;
361 | buildConfigurations = (
362 | 1DEB91AE08733DA50010E9CD /* Debug */,
363 | 1DEB91AF08733DA50010E9CD /* Release */,
364 | );
365 | defaultConfigurationIsVisible = 0;
366 | defaultConfigurationName = Release;
367 | };
368 | 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UIKit" */ = {
369 | isa = XCConfigurationList;
370 | buildConfigurations = (
371 | 1DEB91B208733DA50010E9CD /* Debug */,
372 | 1DEB91B308733DA50010E9CD /* Release */,
373 | );
374 | defaultConfigurationIsVisible = 0;
375 | defaultConfigurationName = Release;
376 | };
377 | /* End XCConfigurationList section */
378 | };
379 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
380 | }
381 |
--------------------------------------------------------------------------------
/UIKitDefines.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIKitDefines.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #ifdef __cplusplus
10 | #define UIKIT_EXTERN extern "C" __attribute__((visibility ("default")))
11 | #else
12 | #define UIKIT_EXTERN extern __attribute__((visibility ("default")))
13 | #endif
14 |
15 | #define UIKIT_STATIC_INLINE static inline
16 | #define UIKIT_EXTERN_CLASS __attribute__((visibility("default")))
17 |
18 | #define CGAutorelease(x) (__typeof(x))[NSMakeCollectable(x) autorelease]
--------------------------------------------------------------------------------
/UIKit_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'UIKit' target in the 'UIKit' project.
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/UILabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 6/24/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | // TODO: Fix Shadows. For some reason CATextLayer is ignoring it's shadow property
15 |
16 | @class CATextLayer;
17 | @interface UILabel : UIView {
18 | @private
19 | CATextLayer* _textLayer;
20 | NSString* _text;
21 | NSFont* _font;
22 | UIColor* _textColor;
23 | UIColor* _shadowColor;
24 | UIColor* _highlightedTextColor;
25 | CGSize _shadowOffset;
26 | BOOL _highlighted;
27 | UITextAlignment _textAlignment;
28 | UILineBreakMode _lineBreakMode;
29 | }
30 |
31 | @property(nonatomic,copy) NSString* text;
32 | @property(nonatomic,retain) NSFont* font;
33 | @property(nonatomic,retain) UIColor* textColor;
34 | @property(nonatomic,retain) UIColor* shadowColor;
35 | @property(nonatomic,assign) CGSize shadowOffset;
36 | @property(nonatomic,assign) UITextAlignment textAlignment;
37 | @property(nonatomic,assign) UILineBreakMode lineBreakMode;
38 |
39 | @property(nonatomic,retain) UIColor* highlightedTextColor;
40 | @property(nonatomic,assign,getter=isHighlighted) BOOL highlighted;
41 | @end
42 |
--------------------------------------------------------------------------------
/UILabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 6/24/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UILabel.h"
10 | #import "UITextField.h"
11 |
12 | #import
13 |
14 | @implementation UILabel
15 | @synthesize text=_text, font=_font, textColor=_textColor, shadowColor=_shadowColor, shadowOffset=_shadowOffset;
16 | @synthesize textAlignment=_textAlignment, lineBreakMode=_lineBreakMode;
17 | @synthesize highlighted=_highlighted, highlightedTextColor=_highlightedTextColor;
18 |
19 | - (id)initWithFrame:(NSRect)frame {
20 | if (self = [super initWithFrame:frame]) {
21 | self.layer = [CATextLayer layer];
22 | self.textColor = [UIColor blackColor];
23 | self.font = [NSFont systemFontOfSize:17.0f];
24 | self.textAlignment = UITextAlignmentLeft;
25 | self.lineBreakMode = UILineBreakModeTailTruncation;
26 | }
27 |
28 | return self;
29 | }
30 |
31 | - (id)initWithCoder:(NSCoder *)aDecoder {
32 | if((self = [super initWithCoder:aDecoder])) {
33 | self.layer = [CATextLayer layer];
34 | self.textColor = [UIColor blackColor];
35 | self.font = [NSFont systemFontOfSize:17.0f];
36 | self.textAlignment = UITextAlignmentLeft;
37 | self.lineBreakMode = UILineBreakModeTailTruncation;
38 | }
39 |
40 | return self;
41 | }
42 |
43 | - (void)setText:(NSString *)text {
44 | [_text release];
45 | _text = [text copy];
46 |
47 | ((CATextLayer*)self.layer).string = _text;
48 | }
49 |
50 | - (void)setFont:(NSFont *)font {
51 | [_font release];
52 | _font = [font retain];
53 |
54 | ((CATextLayer*)self.layer).font = _font;
55 | ((CATextLayer*)self.layer).fontSize = [_font pointSize];
56 | }
57 |
58 | - (void)setTextColor:(UIColor *)textColor {
59 | [_textColor release];
60 | _textColor = [textColor retain];
61 |
62 | if(![self isHighlighted]) {
63 | ((CATextLayer*)self.layer).foregroundColor = _textColor.CGColor;
64 | }
65 | }
66 |
67 | - (void)setShadowColor:(UIColor *)shadowColor {
68 | [_shadowColor release];
69 | _shadowColor = [shadowColor retain];
70 |
71 | self.layer.shadowColor = _shadowColor.CGColor;
72 | }
73 |
74 | - (void)setShadowOffset:(CGSize)shadowOffset {
75 | _shadowOffset = shadowOffset;
76 |
77 | self.layer.shadowOffset = _shadowOffset;
78 | }
79 |
80 | - (void)setTextAlignment:(UITextAlignment)textAlignment {
81 | _textAlignment = textAlignment;
82 |
83 | NSString* alignmentMode = nil;
84 | switch(_textAlignment) {
85 | case UITextAlignmentCenter:
86 | alignmentMode = kCAAlignmentCenter;
87 | break;
88 | case UITextAlignmentRight:
89 | alignmentMode = kCAAlignmentRight;
90 | break;
91 | case UITextAlignmentJusitifed:
92 | alignmentMode = kCAAlignmentJustified;
93 | break;
94 | case UITextAlignmentNatural:
95 | alignmentMode = kCAAlignmentNatural;
96 | break;
97 | default:
98 | alignmentMode = kCAAlignmentLeft;
99 | }
100 |
101 | ((CATextLayer*)self.layer).alignmentMode = alignmentMode;
102 | }
103 |
104 | - (void)setLineBreakMode:(UILineBreakMode)lineBreakMode {
105 | _lineBreakMode = lineBreakMode;
106 |
107 | NSString* truncationMode = nil;
108 |
109 | switch(_lineBreakMode) {
110 | case UILineBreakModeWordWrap:
111 | case UILineBreakModeCharacterWrap:
112 | ((CATextLayer*)self.layer).wrapped = YES;
113 | truncationMode = kCATruncationNone;
114 | break;
115 | case UILineBreakModeClip:
116 | ((CATextLayer*)self.layer).wrapped = NO;
117 | truncationMode = kCATruncationNone;
118 | break;
119 | case UILineBreakModeHeadTruncation:
120 | truncationMode = kCATruncationStart;
121 | break;
122 | case UILineBreakModeMiddleTruncation:
123 | truncationMode = kCATruncationMiddle;
124 | break;
125 | default:
126 | truncationMode = kCATruncationEnd;
127 | }
128 |
129 | ((CATextLayer*)self.layer).truncationMode = truncationMode;
130 | }
131 |
132 | - (void)setHighlightedTextColor:(UIColor *)highlightedTextColor {
133 | [_highlightedTextColor release];
134 | _highlightedTextColor = [highlightedTextColor retain];
135 |
136 | if([self isHighlighted]) {
137 | ((CATextLayer*)self.layer).foregroundColor = _highlightedTextColor.CGColor;
138 | }
139 | }
140 |
141 | - (void)setHighlighted:(BOOL)highlighted {
142 | _highlighted = highlighted;
143 |
144 | if(_highlighted && self.highlighted) {
145 | ((CATextLayer*)self.layer).foregroundColor = self.highlightedTextColor.CGColor;
146 | } else {
147 | ((CATextLayer*)self.layer).foregroundColor = self.textColor.CGColor;
148 | }
149 | }
150 |
151 | - (void)dealloc {
152 | [_text release];
153 | [_font release];
154 | [_textColor release];
155 | [_shadowColor release];
156 | [super dealloc];
157 | }
158 |
159 | @end
160 |
--------------------------------------------------------------------------------
/UIScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface UIScrollView : NSScrollView {
14 | @private
15 | UIColor* _backgroundColor;
16 | }
17 |
18 | - (void)superSetBackgroundColor:(NSColor*)aColor;
19 |
20 | /*
21 | IMPORTANT:
22 | -----------------------------------------------------------------------------
23 | NSScrollView uses the contentSize/Offset properties differently
24 | than the way they're used on the iPhone. Wherever you use contentSize/Offset
25 | on the iPhone, use documentSize/Offset on Mac.
26 | */
27 | @property(nonatomic,assign) NSSize documentSize; // contentOffset on iPhone
28 | @property(nonatomic,assign) NSPoint documentOffset; // contentOffset on iPhone
29 |
30 | @property(nonatomic,retain) UIColor* backgroundColor;
31 | @end
--------------------------------------------------------------------------------
/UIScrollView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIScrollView.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIScrollView.h"
10 | #import "UIClipView.h"
11 | #import "UIColor.h"
12 |
13 | #import
14 |
15 | @interface UIScrollView (Private)
16 | @property(nonatomic,retain) UIView* documentView;
17 | @end
18 |
19 |
20 | @implementation UIScrollView
21 | @synthesize backgroundColor=_backgroundColor;
22 |
23 | - (void)setupScrollViewDefaults {
24 | self.layer = [CALayer layer];
25 |
26 | self.contentView = [[[UIClipView alloc] initWithFrame:self.bounds] autorelease];
27 | self.contentView.wantsLayer = YES;
28 | self.hasVerticalScroller = YES;
29 | self.hasHorizontalScroller = YES;
30 | self.autohidesScrollers = YES;
31 | self.documentView = [[[UIView alloc] initWithFrame:self.bounds] autorelease];
32 |
33 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
34 | }
35 |
36 | - (id)initWithFrame:(NSRect)frameRect {
37 | if((self = [super initWithFrame:frameRect])) {
38 | [self setupScrollViewDefaults];
39 | }
40 |
41 | return self;
42 | }
43 |
44 | - (id)initWithCoder:(NSCoder *)aDecoder {
45 | if((self = [super initWithCoder:aDecoder])) {
46 | [self setupScrollViewDefaults];
47 | }
48 |
49 | return self;
50 | }
51 |
52 | - (void)setDocumentSize:(NSSize)aSize {
53 | NSRect aRect = self.documentView.frame;
54 | aRect.size = aSize;
55 | self.documentView.frame = aRect;
56 | }
57 |
58 | - (NSSize)documentSize {
59 | return self.documentView.frame.size;
60 | }
61 |
62 | - (void)setDocumentOffset:(NSPoint)aPoint {
63 |
64 | }
65 |
66 | - (NSPoint)documentOffset {
67 | return NSMakePoint(0.0f, 0.0f);
68 | }
69 |
70 | - (void)addSubview:(UIView*)aView {
71 | if([aView isKindOfClass:[NSClipView class]]) {
72 | [super addSubview:aView];
73 | } else if([aView isKindOfClass:[NSScroller class]]) {
74 | [super addSubview:aView];
75 | } else {
76 | [self.documentView addSubview:aView];
77 | }
78 | }
79 |
80 | - (BOOL)isFlipped {
81 | return YES;
82 | }
83 |
84 | - (void)setBackgroundColor:(UIColor *)aColor {
85 | [_backgroundColor release];
86 | _backgroundColor = [aColor retain];
87 |
88 | self.documentView.backgroundColor = aColor;
89 | self.contentView.backgroundColor = aColor.NSColor;
90 | [super setBackgroundColor:aColor.NSColor];
91 | }
92 |
93 | - (void)superSetBackgroundColor:(NSColor*)aColor {
94 | [super setBackgroundColor:aColor];
95 | }
96 |
97 | - (void)dealloc {
98 | [_backgroundColor release];
99 | [super dealloc];
100 | }
101 |
102 | @end
103 |
--------------------------------------------------------------------------------
/UITableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITableView.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | typedef enum {
16 | UITableViewStylePlain, // regular table view
17 | UITableViewStyleGrouped // preferences style table view
18 | } UITableViewStyle;
19 |
20 | typedef enum {
21 | UITableViewScrollPositionNone,
22 | UITableViewScrollPositionTop,
23 | UITableViewScrollPositionMiddle,
24 | UITableViewScrollPositionBottom
25 | } UITableViewScrollPosition; // scroll so row of interest is completely visible at top/center/bottom of view
26 |
27 | typedef enum {
28 | UITableViewRowAnimationFade,
29 | UITableViewRowAnimationRight, // slide in from right (or out to right)
30 | UITableViewRowAnimationLeft,
31 | UITableViewRowAnimationTop,
32 | UITableViewRowAnimationBottom,
33 | UITableViewRowAnimationNone, // available in iPhone 3.0
34 | } UITableViewRowAnimation;
35 |
36 | @protocol UITableViewDataSource, UITableViewDelegate;
37 |
38 | UIKIT_EXTERN_CLASS @interface UITableView : UIScrollView {
39 | @private
40 | UITableViewStyle _style;
41 |
42 | id _dataSource;
43 | id _delegate;
44 |
45 | NSMutableArray* _sectionData;
46 | CGFloat _rowHeight;
47 | CGFloat _sectionHeaderHeight;
48 | CGFloat _sectionFooterHeight;
49 |
50 | BOOL _isEditing;
51 | BOOL _allowsSelection;
52 | BOOL _allowsSelectionDuringEditing;
53 |
54 | UITableViewCellSeparatorStyle _separatorStyle;
55 |
56 | NSMutableArray *_visibleCells;
57 | NSIndexPath *_firstResponderIndexPath;
58 | UITableViewCell *_firstResponderCell;
59 | NSMutableDictionary *_reusableTableCells;
60 | UITableViewCell *_topSeparatorCell;
61 | id _topSeparator;
62 | NSMutableArray *_extraSeparators;
63 | CFMutableDictionaryRef _visibleHeaderViews;
64 | CFMutableDictionaryRef _visibleFooterViews;
65 | NSMutableArray *_reusableHeaderViews;
66 | NSMutableArray *_reusableFooterViews;
67 | NSMutableArray *_reusableTransparentHeaderViews;
68 | NSMutableArray *_reusableTransparentFooterViews;
69 |
70 | NSMutableArray *_highlightedIndexPaths;
71 | NSMutableArray *_selectedIndexPaths;
72 | NSInteger _swipeToDeleteSection;
73 | NSInteger _swipeToDeleteRow;
74 | NSIndexPath *_pendingSelectionIndexPath;
75 | UIView *_touchedContentView;
76 | UIView *_newContentView;
77 |
78 | id _deleteAnimationSupport;
79 | id _reorderingSupport;
80 |
81 | UIView *_index;
82 | UIView *_tableHeaderBackgroundView;
83 | UIView *_tableHeaderView;
84 | UIView *_tableFooterView;
85 | id _countLabel;
86 |
87 | NSInteger _tableReloadingSuspendedCount;
88 | NSInteger _tableDisplaySuspendedCount;
89 | NSInteger _sectionIndexMinimumDisplayRowCount;
90 | NSInteger _itemCountFooterMinimumDisplayRowCount;
91 |
92 | NSMutableArray *_insertItems;
93 | NSMutableArray *_deleteItems;
94 | NSMutableArray *_reloadItems;
95 |
96 | UIColor *_separatorColor;
97 | UIColor *_checkmarkColor;
98 |
99 | NSArray *_defaultSectionIndexTitles;
100 |
101 | NSInteger _updateCount;
102 |
103 | struct {
104 | unsigned int dataSourceNumberOfRowsInSection:1;
105 | unsigned int dataSourceCellForRow:1;
106 | unsigned int dataSourceNumberOfSectionsInTableView:1;
107 | unsigned int dataSourceTitleForHeaderInSection:1;
108 | unsigned int dataSourceTitleForFooterInSection:1;
109 | unsigned int dataSourceCommitEditingStyle:1;
110 | unsigned int dataSourceSectionIndexTitlesForTableView:1;
111 | unsigned int dataSourceSectionForSectionIndexTitle:1;
112 | unsigned int dataSourceCanEditRow:1;
113 | unsigned int dataSourceCanMoveRow:1;
114 | unsigned int dataSourceCanUpdateRow:1;
115 | unsigned int delegateEditingStyleForRowAtIndexPath:1;
116 | unsigned int delegateTitleForDeleteConfirmationButtonForRowAtIndexPath:1;
117 | unsigned int delegateShouldIndentWhileEditing:1;
118 | unsigned int dataSourceMoveRow:1;
119 | unsigned int delegateCellForRow:1;
120 | unsigned int delegateWillDisplayCell:1;
121 | unsigned int delegateHeightForRow:1;
122 | unsigned int delegateHeightForSectionHeader:1;
123 | unsigned int delegateHeightForSectionFooter:1;
124 | unsigned int delegateViewForHeaderInSection:1;
125 | unsigned int delegateViewForFooterInSection:1;
126 | unsigned int delegateDisplayedItemCountForRowCount:1;
127 | unsigned int delegateDisplayStringForRowCount:1;
128 | unsigned int delegateAccessoryTypeForRow:1;
129 | unsigned int delegateAccessoryButtonTappedForRow:1;
130 | unsigned int delegateWillSelectRow:1;
131 | unsigned int delegateWillDeselectRow:1;
132 | unsigned int delegateDidSelectRow:1;
133 | unsigned int delegateDidDeselectRow:1;
134 | unsigned int delegateWillBeginEditing:1;
135 | unsigned int delegateDidEndEditing:1;
136 | unsigned int delegateWillMoveToRow:1;
137 | unsigned int delegateIndentationLevelForRow:1;
138 | unsigned int delegateWantsHeaderForSection:1;
139 | unsigned int delegateHeightForRowsInSection:1;
140 | unsigned int style:1;
141 | unsigned int wasEditing:1;
142 | unsigned int isEditing:1;
143 | unsigned int scrollsToSelection:1;
144 | unsigned int reloadSkippedDuringSuspension:1;
145 | unsigned int updating:1;
146 | unsigned int displaySkippedDuringSuspension:1;
147 | unsigned int needsReload:1;
148 | unsigned int updatingVisibleCellsManually:1;
149 | unsigned int scheduledUpdateVisibleCells:1;
150 | unsigned int scheduledUpdateVisibleCellsFrames:1;
151 | unsigned int warnForForcedCellUpdateDisabled:1;
152 | unsigned int displayTopSeparator:1;
153 | unsigned int countStringInsignificantRowCount:4;
154 | unsigned int needToAdjustExtraSeparators:1;
155 | unsigned int overlapsSectionHeaderViews:1;
156 | unsigned int ignoreDragSwipe:1;
157 | unsigned int ignoreTouchSelect:1;
158 | unsigned int lastHighlightedRowActive:1;
159 | unsigned int reloading:1;
160 | unsigned int showsSelectionImmediatelyOnTouchBegin:1;
161 | unsigned int indexHidden:1;
162 | unsigned int indexHiddenForSearch:1;
163 | unsigned int defaultShowsHorizontalScrollIndicator:1;
164 | unsigned int defaultShowsVerticalScrollIndicator:1;
165 | unsigned int sectionIndexTitlesLoaded:1;
166 | unsigned int tableHeaderViewShouldAutoHide:1;
167 | unsigned int tableHeaderViewIsHidden:1;
168 | unsigned int tableHeaderViewWasHidden:1;
169 | unsigned int hideScrollIndicators;
170 | } _tableFlags;
171 |
172 | unsigned int _selectedSection;
173 | unsigned int _selectedRow;
174 | unsigned int _lastSelectedSection;
175 | unsigned int _lastSelectedRow;
176 |
177 | NSPoint liveResizeScrollOffset;
178 | }
179 |
180 | @property(nonatomic,readonly) UITableViewStyle style;
181 | @property(nonatomic,assign) id dataSource;
182 | @property(nonatomic,assign) id delegate;
183 | @property(nonatomic) CGFloat rowHeight; // will return the default value if unset
184 | @property(nonatomic) CGFloat sectionHeaderHeight; // will return the default value if unset
185 | @property(nonatomic) CGFloat sectionFooterHeight; // will return the default value if unset
186 |
187 | /* Data
188 | * Reloads everything from scratch. redisplays visible rows. because we only keep
189 | * info about visible rows, this is cheap. will adjust offset if table shrinks
190 | */
191 | - (void)reloadData;
192 |
193 | // Info
194 |
195 | - (NSInteger)numberOfSections;
196 | - (NSInteger)numberOfRowsInSection:(NSInteger)section;
197 |
198 | /*
199 | - (NSRect)rectForSection:(NSInteger)section; // includes header, footer and all rows
200 | - (NSRect)rectForHeaderInSection:(NSInteger)section;
201 | - (NSRect)rectForFooterInSection:(NSInteger)section;
202 | - (NSRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath;
203 |
204 | - (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point; // returns nil if point is outside table
205 | - (NSIndexPath *)indexPathForCell:(UITableViewCell*)cell; // returns nil if cell is not visible
206 | - (NSArray *)indexPathsForRowsInRect:(NSRect)rect; // returns nil if rect not valid
207 | */
208 |
209 | - (UITableViewCell*)cellForRowAtIndexPath:(NSIndexPath*)indexPath; // returns nil if cell is not visible or index path is out of range
210 | - (NSArray*)visibleCells;
211 | - (NSArray*)indexPathsForVisibleRows;
212 |
213 | - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;
214 | - (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;
215 |
216 | // Row insertion/deletion/reloading.
217 | /*
218 | - (void)beginUpdates; // allow multiple insert/delete of rows and sections to be animated simultaneously. Nestable
219 | - (void)endUpdates; // only call insert/delete/reload calls inside an update block. otherwise things like row count, etc. may be invalid.
220 |
221 | - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
222 | - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
223 | - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
224 |
225 | - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
226 | - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
227 | - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
228 | */
229 |
230 | // Editing. When set, rows show insert/delete/reorder controls based on data source queries
231 |
232 | @property(nonatomic,getter=isEditing) BOOL editing; // default is NO. setting is not animated.
233 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated;
234 |
235 | @property(nonatomic) BOOL allowsSelection; // default is YES. Controls whether rows can be selected when not in editing mode
236 | @property(nonatomic) BOOL allowsSelectionDuringEditing; // default is NO. Controls whether rows can be selected when in editing mode
237 |
238 | // Selection
239 |
240 | - (NSIndexPath *)indexPathForSelectedRow; // return nil or index path representing section and row of selection.
241 |
242 | // Selects and deselects rows. These methods will not call the delegate methods (-tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath:), nor will it send out a notification.
243 | - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition;
244 | - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated;
245 |
246 | // Appearance
247 |
248 | @property(nonatomic) UITableViewCellSeparatorStyle separatorStyle; // default is UITableViewCellSeparatorStyleSingleLine
249 | @property(nonatomic,retain) UIColor* separatorColor; // default is the standard separator gray
250 |
251 | @property(nonatomic,retain) UIView* tableHeaderView; // accessory view for above row content. default is nil. not to be confused with section header
252 | @property(nonatomic,retain) UIView* tableFooterView; // accessory view below content. default is nil. not to be confused with section footer
253 |
254 | - (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier; // Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one.
255 |
256 | @end
257 |
258 | //_______________________________________________________________________________________________________________
259 | // this protocol represents the data model object. as such, it supplies no information about appearance (including the cells)
260 |
261 | @protocol UITableViewDataSource
262 |
263 | @required
264 |
265 | - (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section;
266 |
267 | // Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
268 | // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)
269 |
270 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
271 |
272 | @optional
273 |
274 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; // Default is 1 if not implemented
275 |
276 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; // fixed font style. use custom view (UILabel) if you want something different
277 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
278 |
279 | // Editing
280 |
281 | // Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable.
282 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
283 |
284 | // Moving/reordering
285 |
286 | // Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath:
287 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
288 |
289 | // Index
290 |
291 | - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; // return list of section titles to display in section index view (e.g. "ABCD...Z#")
292 | - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; // tell table which section corresponds to section title/index (e.g. "B",1))
293 |
294 | // Data manipulation - insert and delete support
295 |
296 | // After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change
297 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
298 |
299 | // Data manipulation - reorder / moving support
300 |
301 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
302 |
303 | @end
304 |
305 | //_______________________________________________________________________________________________________________
306 | // this represents the display and behaviour of the cells.
307 |
308 | @protocol UITableViewDelegate
309 |
310 | @optional
311 |
312 | // Display customization
313 |
314 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
315 |
316 | // Variable height support
317 |
318 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
319 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
320 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
321 |
322 | // Section header & footer information. Views are preferred over title should you decide to provide both
323 |
324 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; // custom view for header. will be adjusted to default or specified header height
325 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; // custom view for footer. will be adjusted to default or specified footer height
326 |
327 | // Accessories (disclosures).
328 |
329 | - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0);
330 | - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;
331 |
332 | // Selection
333 |
334 | // Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection.
335 | - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath;
336 | - (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
337 | // Called after the user changes the selection.
338 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
339 | - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
340 |
341 | // Editing
342 |
343 | // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES.
344 | - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
345 | - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
346 |
347 | // Controls whether the background is indented while editing. If not implemented, the default is YES. This is unrelated to the indentation level below. This method only applies to grouped style table views.
348 | - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath;
349 |
350 | // The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row
351 | - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath;
352 | - (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath;
353 |
354 | // Moving/reordering
355 |
356 | // Allows customization of the target row for a particular row as it is being moved/reordered
357 | - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;
358 |
359 | // Indentation
360 |
361 | - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; // return 'depth' of row for hierarchies
362 |
363 | @end
364 |
365 | UIKIT_EXTERN NSString *const UITableViewSelectionDidChangeNotification;
366 |
367 | //_______________________________________________________________________________________________________________
368 |
369 | // This category provides convenience methods to make it easier to use an NSIndexPath to represent a section and row
370 | @interface NSIndexPath (UITableView)
371 |
372 | + (NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section;
373 |
374 | @property(nonatomic,readonly) NSUInteger section;
375 | @property(nonatomic,readonly) NSUInteger row;
376 |
377 | @end
378 |
--------------------------------------------------------------------------------
/UITableView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITableView.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UIColor.h"
11 | #import "UITableViewCell-Private.h"
12 |
13 | static inline CGRect CGRectFromOffsetHeight(float offset, float height) {
14 | return CGRectMake(0.0f, offset, 100.0f, height);
15 | }
16 |
17 | @interface UITableView (Private)
18 | - (void)queueReusableCell:(UITableViewCell*)aTableViewCell;
19 | - (void)layoutVisibleCells;
20 | - (void)removeInvisibleCells;
21 | - (void)clearAllCells;
22 | @end
23 |
24 |
25 | @implementation UITableView
26 | @synthesize style=_style, dataSource=_dataSource, delegate=_delegate;
27 | @synthesize rowHeight=_rowHeight, sectionHeaderHeight=_sectionHeaderHeight, sectionFooterHeight=_sectionFooterHeight;
28 | @synthesize editing=_isEditing, allowsSelection=_allowsSelection, allowsSelectionDuringEditing=_allowsSelectionDuringEditing;
29 | @synthesize separatorStyle=_separatorStyle, separatorColor=_separatorColor;
30 | @synthesize tableHeaderView=_tableHeaderView, tableFooterView=_tableFooterView;
31 |
32 | - (void)setupTableViewDefaults {
33 | _rowHeight = 44.0f;
34 | _sectionHeaderHeight = 22.0f;
35 | _sectionFooterHeight = 22.0f;
36 | _allowsSelection = YES;
37 | _allowsSelectionDuringEditing = NO;
38 | _separatorStyle = UITableViewCellSeparatorStyleSingleLine;
39 | _separatorColor = [[UIColor grayColor] retain];
40 | _reusableTableCells = [[NSMutableDictionary alloc] init];
41 | _visibleCells = [[NSMutableArray alloc] init];
42 | _sectionData = [[NSMutableArray alloc] init];
43 |
44 | self.hasVerticalScroller = YES;
45 | self.hasHorizontalScroller = NO;
46 | self.autohidesScrollers = NO;
47 |
48 | ((UIView*)self.documentView).autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
49 | }
50 |
51 | - (id)initWithFrame:(NSRect)frameRect {
52 | if((self = [super initWithFrame:frameRect])) {
53 | [self setupTableViewDefaults];
54 | }
55 |
56 | return self;
57 | }
58 |
59 | - (id)initWithCoder:(NSCoder *)aDecoder {
60 | if((self = [super initWithCoder:aDecoder])) {
61 | [self setupTableViewDefaults];
62 | }
63 |
64 | return self;
65 | }
66 |
67 | #pragma mark Todo
68 |
69 | - (void)reloadData {
70 | float height = 0.0f;
71 | NSInteger sections = 1;
72 | BOOL variableRowHeights = [self.delegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)];
73 |
74 | if([self.dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]) {
75 | sections = [self.dataSource numberOfSectionsInTableView:self];
76 | }
77 |
78 | [_sectionData removeAllObjects];
79 |
80 | for(int section = 0; section < sections; section++) {
81 | NSInteger rows = [self.dataSource tableView:self numberOfRowsInSection:section];
82 | NSMutableArray* rowInfo = [[NSMutableArray alloc] initWithCapacity:rows];
83 | float offsetY = height;
84 |
85 | for(int row = 0; row < rows; row++) {
86 | float rowHeight = self.rowHeight;
87 |
88 | if(variableRowHeights) {
89 | rowHeight = [self.delegate tableView:self heightForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section]];
90 | }
91 |
92 | NSRect rowRect = NSMakeRect(0.0f, height, self.contentView.frame.size.width, rowHeight);
93 | [rowInfo addObject:[NSValue valueWithRect:rowRect]];
94 |
95 | height += rowHeight;
96 | }
97 |
98 | NSMutableDictionary* sectionInfo = [[NSMutableDictionary alloc] initWithCapacity:2];
99 | [sectionInfo setObject:rowInfo forKey:@"rows"];
100 | [rowInfo release];
101 |
102 | NSRect sectionRect = NSMakeRect(0.0f, offsetY, self.contentView.frame.size.width, height-offsetY);
103 | [sectionInfo setObject:[NSValue valueWithRect:sectionRect] forKey:@"rect"];
104 | [_sectionData addObject:sectionInfo];
105 | [sectionInfo release];
106 | }
107 |
108 |
109 | if(height == 0) height = 1.0f;
110 | self.documentSize = NSMakeSize([self contentSize].width, height);
111 |
112 | [self clearAllCells];
113 | [self layoutVisibleCells];
114 | }
115 |
116 | - (NSInteger)numberOfSections {
117 | if([_dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]) {
118 | return [_dataSource numberOfSectionsInTableView:self];
119 | } else {
120 | return 1;
121 | }
122 | }
123 |
124 | - (NSInteger)numberOfRowsInSection:(NSInteger)section {
125 | return [_dataSource tableView:self numberOfRowsInSection:section];
126 | }
127 |
128 | - (UITableViewCell*)cellForRowAtIndexPath:(NSIndexPath*)indexPath {
129 | return [_dataSource tableView:self cellForRowAtIndexPath:indexPath];
130 | }
131 |
132 | - (NSArray*)visibleCells {
133 | return _visibleCells;
134 | }
135 |
136 | - (NSArray*)indexPathsForVisibleRows {
137 | // ToDo: indexPathsForVisibleRows
138 | return nil;
139 | }
140 |
141 | - (void)layoutVisibleCells {
142 | CGRect clipViewBounds = NSRectToCGRect(self.contentView.bounds);
143 | NSArray* subviews = [[[self.documentView subviews] copy] autorelease];
144 |
145 | NSInteger section = 0;
146 | for(NSDictionary* sectionInfo in _sectionData) {
147 | CGRect sectionRect = NSRectToCGRect([[sectionInfo objectForKey:@"rect"] rectValue]);
148 | sectionRect.origin.x = 0.0f;
149 | sectionRect.size.width = self.contentView.frame.size.width;
150 |
151 | if(!CGRectIntersectsRect(clipViewBounds, sectionRect)) {
152 | section++;
153 | continue;
154 | }
155 |
156 | NSInteger row = 0;
157 | for(NSValue* rowRectValue in [sectionInfo objectForKey:@"rows"]) {
158 | NSRect rowRect = [rowRectValue rectValue];
159 | rowRect.origin.x = 0.0f;
160 | rowRect.size.width = self.contentView.frame.size.width;
161 |
162 | if(!CGRectIntersectsRect(clipViewBounds, NSRectToCGRect(rowRect))) {
163 | row++;
164 | continue;
165 | }
166 |
167 | BOOL skip = NO;
168 | for(UIView* view in subviews) {
169 | if(![view isKindOfClass:[UITableViewCell class]]) continue;
170 | if(CGRectIntersectsRect(NSRectToCGRect(rowRect), NSRectToCGRect(view.frame))) {
171 | skip = YES;
172 | break;
173 | }
174 | }
175 |
176 | if(skip) {
177 | row++;
178 | continue;
179 | }
180 |
181 | NSIndexPath* indexPath = [NSIndexPath indexPathForRow:row inSection:section];
182 |
183 | UITableViewCell* aCell = [self.dataSource tableView:self cellForRowAtIndexPath:indexPath];
184 | // if(!aCell.separatorColor) aCell.separatorColor = _separatorColor;
185 |
186 | aCell.frame = rowRect;
187 | [aCell setNeedsLayout];
188 | [aCell setNeedsDisplay];
189 | [self.documentView addSubview:aCell];
190 | [aCell layoutIfNeeded];
191 | [_visibleCells addObject:aCell];
192 |
193 | row++;
194 | }
195 |
196 | section++;
197 | }
198 | }
199 |
200 | - (void)clearAllCells {
201 | [_visibleCells removeAllObjects];
202 |
203 | NSMutableSet* cells = [[NSMutableSet alloc] init];
204 | for(UITableViewCell* cell in [self.documentView subviews]) {
205 | if(![cell isKindOfClass:[UITableViewCell class]]) continue;
206 | [cells addObject:cell];
207 | }
208 |
209 | for(UITableViewCell* cell in cells) {
210 | [self queueReusableCell:cell];
211 | [cell removeFromSuperview];
212 | }
213 |
214 | [cells release];
215 | }
216 |
217 | - (void)removeInvisibleCells {
218 | NSMutableSet* cellsToRemove = [NSMutableSet set];
219 | CGRect clipViewBounds = NSRectToCGRect(self.contentView.bounds);
220 |
221 | for(UITableViewCell* cell in [self.documentView subviews]) {
222 | if(![cell isKindOfClass:[UITableViewCell class]]) continue;
223 | if(CGRectIntersectsRect(clipViewBounds, NSRectToCGRect(cell.frame))) continue;
224 | [cellsToRemove addObject:cell];
225 | }
226 |
227 | [cellsToRemove makeObjectsPerformSelector:@selector(removeFromSuperview)];
228 | [_visibleCells removeObjectsInArray:[cellsToRemove allObjects]];
229 |
230 | for(UITableViewCell* cell in cellsToRemove) {
231 | [self queueReusableCell:cell];
232 | }
233 | }
234 |
235 | - (void)reflectScrolledClipView:(NSClipView *)aClipView{
236 | [super reflectScrolledClipView:aClipView];
237 | [self removeInvisibleCells];
238 | [self layoutVisibleCells];
239 | }
240 |
241 | #pragma mark -
242 | #pragma mark Live resizing methods
243 | - (void)viewWillStartLiveResize {
244 | [super viewWillStartLiveResize];
245 | liveResizeScrollOffset = self.documentOffset;
246 | }
247 |
248 | - (void)viewDidEndLiveResize {
249 | [super viewDidEndLiveResize];
250 | [self removeInvisibleCells];
251 | [self layoutVisibleCells];
252 | }
253 |
254 | - (void)setFrame:(NSRect)frameRect {
255 | [super setFrame:frameRect];
256 |
257 | if([self inLiveResize]) {
258 | self.documentOffset = liveResizeScrollOffset;
259 | [self removeInvisibleCells];
260 | [self layoutVisibleCells];
261 | }
262 | }
263 |
264 | #pragma mark Todo
265 | - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated {
266 |
267 | }
268 |
269 | #pragma mark Todo
270 | - (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated {
271 |
272 | }
273 |
274 | #pragma mark Todo
275 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
276 |
277 | }
278 |
279 | #pragma mark Todo
280 | - (NSIndexPath *)indexPathForSelectedRow {
281 | return nil;
282 | }
283 |
284 | #pragma mark Todo
285 | - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition {
286 |
287 | }
288 |
289 | #pragma mark Todo
290 | - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated {
291 |
292 | }
293 |
294 | - (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier {
295 | if(!identifier) return nil;
296 |
297 | UITableViewCell* aTableViewCell = [[_reusableTableCells objectForKey:identifier] anyObject];
298 | if(!aTableViewCell) return nil;
299 |
300 | [aTableViewCell retain];
301 |
302 | [[_reusableTableCells objectForKey:identifier] removeObject:aTableViewCell];
303 |
304 | return [aTableViewCell autorelease];
305 | }
306 |
307 | - (void)queueReusableCell:(UITableViewCell*)aTableViewCell {
308 | if(!aTableViewCell) return;
309 | if(!aTableViewCell.reuseIdentifier) return;
310 |
311 | if([[_reusableTableCells objectForKey:aTableViewCell.reuseIdentifier] containsObject:aTableViewCell]) return;
312 |
313 | [aTableViewCell prepareForReuse];
314 |
315 | if(![_reusableTableCells objectForKey:aTableViewCell.reuseIdentifier]) {
316 | [_reusableTableCells setObject:[NSMutableSet setWithCapacity:1] forKey:aTableViewCell.reuseIdentifier];
317 | }
318 |
319 | [[_reusableTableCells objectForKey:aTableViewCell.reuseIdentifier] addObject:aTableViewCell];
320 | }
321 |
322 | - (void)dealloc {
323 | [_sectionData release];
324 | [_visibleCells release];
325 | [_reusableTableCells release];
326 | [super dealloc];
327 | }
328 |
329 | @end
330 |
331 | @implementation NSIndexPath (UITableView)
332 |
333 | + (NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section {
334 | NSUInteger indexArr[] = {section,row};
335 | return [NSIndexPath indexPathWithIndexes:indexArr length:2];
336 | }
337 |
338 | - (NSUInteger)section {
339 | return [self indexAtPosition:0];
340 | }
341 |
342 | - (NSUInteger)row {
343 | return [self indexAtPosition:1];
344 | }
345 |
346 | @end
347 |
--------------------------------------------------------------------------------
/UITableViewCell-Private.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITableViewCell-Private.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/19/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UITableViewCell.h"
11 |
12 | @interface UITableViewCell (Private)
13 | @property(nonatomic,retain) UIColor* separatorColor;
14 | @end
15 |
--------------------------------------------------------------------------------
/UITableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITableViewCell.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @class UIImage, UIColor, UILabel, UIImageView, UIButton, UITextField;
14 |
15 | typedef enum {
16 | UITableViewCellStyleDefault, // Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x)
17 | UITableViewCellStyleValue1, // Left aligned label on left and right aligned label on right with blue text (Used in Settings)
18 | UITableViewCellStyleValue2, // Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts)
19 | UITableViewCellStyleSubtitle // Left aligned label on top and left aligned label on bottom with gray text (Used in iPod).
20 | } UITableViewCellStyle; // available in iPhone 3.0
21 |
22 | typedef enum {
23 | UITableViewCellSeparatorStyleNone,
24 | UITableViewCellSeparatorStyleSingleLine
25 | } UITableViewCellSeparatorStyle;
26 |
27 | typedef enum {
28 | UITableViewCellSelectionStyleNone,
29 | UITableViewCellSelectionStyleBlue,
30 | UITableViewCellSelectionStyleGray
31 | } UITableViewCellSelectionStyle;
32 |
33 | typedef enum {
34 | UITableViewCellEditingStyleNone,
35 | UITableViewCellEditingStyleDelete,
36 | UITableViewCellEditingStyleInsert
37 | } UITableViewCellEditingStyle;
38 |
39 | typedef enum {
40 | UITableViewCellAccessoryNone, // don't show any accessory view
41 | UITableViewCellAccessoryDisclosureIndicator, // regular chevron. doesn't track
42 | UITableViewCellAccessoryDetailDisclosureButton, // blue button w/ chevron. tracks
43 | UITableViewCellAccessoryCheckmark // checkmark. doesn't track
44 | } UITableViewCellAccessoryType;
45 |
46 | enum {
47 | UITableViewCellStateDefaultMask = 0,
48 | UITableViewCellStateShowingEditControlMask = 1 << 0,
49 | UITableViewCellStateShowingDeleteConfirmationMask = 1 << 1
50 | };
51 | typedef NSUInteger UITableViewCellStateMask; // available in iPhone 3.0
52 |
53 | #define UITableViewCellStateEditingMask UITableViewCellStateShowingEditControlMask
54 |
55 | UIKIT_EXTERN_CLASS @interface UITableViewCell : UIView {
56 | @private
57 | id _layoutManager;
58 | id _target;
59 | SEL _editAction;
60 | SEL _accessoryAction;
61 | id _oldEditingData;
62 | id _editingData;
63 | CGFloat _rightMargin;
64 | NSInteger _indentationLevel;
65 | CGFloat _indentationWidth;
66 | NSString *_reuseIdentifier;
67 | UIView *_contentView;
68 | UIImageView *_imageView;
69 | UILabel *_textLabel;
70 | UILabel *_detailTextLabel;
71 | UIView *_backgroundView;
72 | UIView *_selectedBackgroundView;
73 | UIView *_selectedOverlayView;
74 | UIColor *_separatorColor;
75 | UIView *_floatingSeparatorView;
76 | CFMutableDictionaryRef _unhighlightedStates;
77 | struct {
78 | unsigned int separatorStyle:3;
79 | unsigned int selectionFadeFraction:11; // used to indicate selection
80 | unsigned int editingStyle:3;
81 | unsigned int showsAccessoryWhenEditing:1;
82 | unsigned int showDisclosure:1;
83 | unsigned int showTopSeparator:1;
84 |
85 | unsigned int disclosureClickable:1;
86 | unsigned int disclosureStyle:1;
87 | unsigned int showingRemoveControl:1;
88 | unsigned int sectionLocation:3;
89 | unsigned int tableViewStyle:1;
90 | unsigned int fontSet:1;
91 | unsigned int usingDefaultSelectedBackgroundView:1;
92 | unsigned int wasSwiped:1;
93 | unsigned int highlighted:1;
94 | unsigned int separatorDirty:1;
95 | unsigned int drawn:1;
96 | unsigned int drawingDisabled:1;
97 | unsigned int style:12;
98 | } _tableCellFlags;
99 |
100 | UIView *_accessoryView;
101 | UIView *_editingAccessoryView;
102 | UIView *_customAccessoryView;
103 | UIView *_customEditingAccessoryView;
104 | UIView *_separatorView;
105 | UIView *_topSeparatorView;
106 | UITextField *_editableTextField;
107 | CFAbsoluteTime _lastSelectionTime;
108 | NSTimer *_deselectTimer;
109 | CGFloat _textFieldOffset;
110 | SEL _returnAction;
111 | UITableViewCellSelectionStyle _selectionStyle;
112 | BOOL _isSelected;
113 | BOOL _isHighlighted;
114 | UITableViewCellEditingStyle _editingStyle;
115 | BOOL _showsReorderControl;
116 | BOOL _shouldIndentWhileEditing;
117 | BOOL _editing;
118 | BOOL _showingDeleteConfirmation;
119 | UITableViewCellAccessoryType _accessoryType;
120 | UITableViewCellAccessoryType _editingAccessoryType;
121 | }
122 |
123 | // Designated initializer. If the cell can be reused, you must pass in a reuse identifier. You should use the same reuse identifier for all cells of the same form.
124 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier;
125 |
126 | // Content. These properties provide direct access to the internal label and image views used by the table view cell. These should be used instead of the content properties below.
127 | @property(nonatomic,readonly,retain) UIImageView *imageView __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // default is nil. image view will be created if necessary.
128 |
129 | @property(nonatomic,readonly,retain) UILabel *textLabel __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // default is nil. label will be created if necessary.
130 | @property(nonatomic,readonly,retain) UILabel *detailTextLabel __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // default is nil. label will be created if necessary (and the current style supports a detail label).
131 |
132 | // If you want to customize cells by simply adding additional views, you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode.
133 | @property(nonatomic,readonly,retain) UIView *contentView;
134 |
135 | // Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. The 'backgroundView' will be added as a subview behind all other views.
136 | @property(nonatomic,retain) UIView *backgroundView;
137 |
138 | // Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. The 'selectedBackgroundView' will be added as a subview directly above the backgroundView if not nil, or behind all other views. It is added as a subview only when the cell is selected. Calling -setSelected:animated: will cause the 'selectedBackgroundView' to animate in and out with an alpha fade.
139 | @property(nonatomic,retain) UIView *selectedBackgroundView;
140 |
141 | @property(nonatomic,readonly,copy) NSString *reuseIdentifier;
142 | - (void)prepareForReuse; // if the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the table view method dequeueReusableCellWithIdentifier:. If you override, you MUST call super.
143 |
144 | @property(nonatomic) UITableViewCellSelectionStyle selectionStyle; // default is UITableViewCellSelectionStyleBlue.
145 | @property(nonatomic,getter=isSelected) BOOL selected; // set selected state (title, image, background). default is NO. animated is NO
146 | @property(nonatomic,getter=isHighlighted) BOOL highlighted; // set highlighted state (title, image, background). default is NO. animated is NO
147 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated; // animate between regular and selected state
148 | - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; // animate between regular and highlighted state
149 |
150 | @property(nonatomic,readonly) UITableViewCellEditingStyle editingStyle; // default is UITableViewCellEditingStyleNone. This is set by UITableView using the delegate's value for cells who customize their appearance accordingly.
151 | @property(nonatomic) BOOL showsReorderControl; // default is NO
152 | @property(nonatomic) BOOL shouldIndentWhileEditing; // default is YES. This is unrelated to the indentation level below.
153 |
154 | @property(nonatomic) UITableViewCellAccessoryType accessoryType; // default is UITableViewCellAccessoryNone. use to set standard type
155 | @property(nonatomic,retain) UIView *accessoryView; // if set, use custom view. ignore accessoryType. tracks if enabled can calls accessory action
156 | @property(nonatomic) UITableViewCellAccessoryType editingAccessoryType; // default is UITableViewCellAccessoryNone. use to set standard type
157 | @property(nonatomic,retain) UIView *editingAccessoryView; // if set, use custom view. ignore editingAccessoryType. tracks if enabled can calls accessory action
158 |
159 | @property(nonatomic) NSInteger indentationLevel; // adjust content indent. default is 0
160 | @property(nonatomic) CGFloat indentationWidth; // width for each level. default is 10.0
161 |
162 | @property(nonatomic,getter=isEditing) BOOL editing; // show appropriate edit controls (+/- & reorder). By default -setEditing: calls setEditing:animated: with NO for animated.
163 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated;
164 |
165 | @property(nonatomic,readonly) BOOL showingDeleteConfirmation; // currently showing "Delete" button
166 |
167 | @end
168 |
169 | @interface UITableViewCell (UIDeprecated)
170 |
171 | // Frame is ignored. The size will be specified by the table view width and row height.
172 | - (id)initWithFrame:(NSRect)frame reuseIdentifier:(NSString *)reuseIdentifier;
173 |
174 | // Content properties. These properties were deprecated in iPhone OS 3.0. The textLabel and imageView properties above should be used instead.
175 | // For selected attributes, set the highlighted attributes on the textLabel and imageView.
176 | @property(nonatomic,copy) NSString *text __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil
177 | @property(nonatomic,retain) NSFont *font __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil (Use default font)
178 | // @property(nonatomic) UITextAlignment textAlignment __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is UITextAlignmentLeft
179 | // @property(nonatomic) UILineBreakMode lineBreakMode __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is UILineBreakModeTailTruncation
180 | @property(nonatomic,retain) UIColor *textColor __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil (text draws black)
181 | @property(nonatomic,retain) UIColor *selectedTextColor __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil (text draws white)
182 |
183 | @property(nonatomic,retain) UIImage *image __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil. appears on left next to title.
184 | @property(nonatomic,retain) UIImage *selectedImage __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is nil
185 |
186 | // Use the new editingAccessoryType and editingAccessoryView instead
187 | @property(nonatomic) BOOL hidesAccessoryWhenEditing __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // default is YES
188 |
189 | // Use the table view data source method -tableView:commitEditingStyle:forRowAtIndexPath: or the table view delegate method -tableView:accessoryButtonTappedForRowWithIndexPath: instead
190 | @property(nonatomic,assign) id target __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // target for insert/delete/accessory clicks. default is nil (i.e. go up responder chain). weak reference
191 | @property(nonatomic) SEL editAction __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // action to call on insert/delete call. set by UITableView
192 | @property(nonatomic) SEL accessoryAction __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0); // action to call on accessory view clicked. set by UITableView
193 |
194 | @end
195 |
--------------------------------------------------------------------------------
/UITableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITableViewCell.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UITableViewCell.h"
10 | #import "UITableViewCell-Private.h"
11 | #import "UILabel.h"
12 |
13 | #import
14 |
15 | @implementation UITableViewCell
16 | @synthesize imageView=_imageView, textLabel=_textLabel, detailTextLabel=_detailTextLabel;
17 | @synthesize contentView=_contentView, backgroundView=_backgroundView, selectedBackgroundView=_selectedBackgroundView;
18 | @synthesize reuseIdentifier=_reuseIdentifier, selectionStyle=_selectionStyle, selected=_isSelected;
19 | @synthesize highlighted=_isHighlighted, editingStyle=_editingStyle, showsReorderControl=_showsReorderControl;
20 | @synthesize shouldIndentWhileEditing=_shouldIndentWhileEditing, accessoryType=_accessoryType;
21 | @synthesize accessoryView=_accessoryView, editingAccessoryView=_editingAccessoryView;
22 | @synthesize editingAccessoryType=_editingAccessoryType, indentationLevel=_indentationLevel;
23 | @synthesize indentationWidth=_indentationWidth, editing=_editing, showingDeleteConfirmation=_showingDeleteConfirmation;
24 |
25 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
26 | if(self = [self initWithFrame:NSMakeRect(0.0f, 0.0f, 320.0f, 44.0f) reuseIdentifier:reuseIdentifier]) {
27 |
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (id)initWithFrame:(NSRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
34 | if((self = [super initWithFrame:frame])) {
35 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
36 | self.backgroundColor = [UIColor whiteColor];
37 | _reuseIdentifier = [reuseIdentifier copy];
38 | _selectionStyle = UITableViewCellSelectionStyleBlue;
39 |
40 | _contentView = [[UIView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frame.size.width, frame.size.height-1.0f)];
41 | _contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
42 |
43 |
44 | self.separatorColor = [UIColor blackColor];
45 |
46 | _separatorView = [[UIView alloc] initWithFrame:NSMakeRect(0.0f, 10.0f, frame.size.width, 10.0f)];
47 | _separatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
48 |
49 | //[_contentView addSubview:_separatorView];
50 |
51 | [self addSubview:_contentView];
52 | //[self addSubview:_separatorView];
53 |
54 | _separatorView.backgroundColor = [UIColor blackColor];
55 | }
56 |
57 | return self;
58 | }
59 |
60 | - (UILabel*)textLabel {
61 | @synchronized(self) {
62 | if(!_textLabel) {
63 | _textLabel = [[UILabel alloc] initWithFrame:_contentView.bounds];
64 | _textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
65 | _textLabel.font = [NSFont boldSystemFontOfSize:17.0f];
66 | _textLabel.backgroundColor = self.backgroundColor;
67 | _textLabel.textColor = [UIColor blackColor];
68 |
69 | [_contentView addSubview:_textLabel];
70 | }
71 | }
72 |
73 | return _textLabel;
74 | }
75 |
76 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
77 | self.selected = selected;
78 | }
79 |
80 | - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
81 | self.highlighted = highlighted;
82 | }
83 |
84 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
85 | self.editing = editing;
86 | }
87 |
88 | - (void)prepareForReuse {
89 |
90 | }
91 |
92 | - (UIColor*)separatorColor {
93 | return _separatorColor;
94 | }
95 |
96 | - (void)setSeparatorColor:(UIColor*)aColor {
97 | [_separatorColor release];
98 | _separatorColor = [aColor retain];
99 | _separatorView.backgroundColor = _separatorColor;
100 | }
101 |
102 | - (void)layoutSubviews {
103 | [super layoutSubviews];
104 | }
105 |
106 | - (void)dealloc {
107 | [_separatorColor release];
108 | [_contentView release];
109 | [super dealloc];
110 | }
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/UIText.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIText.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 10/12/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | typedef enum {
10 | UILineBreakModeWordWrap = 0, // Wraps text
11 | UILineBreakModeCharacterWrap, // Same as calling UILineBreakModeWordWrap for right now -- different behavior than the iPhone
12 | UILineBreakModeClip, // Simply clip when it hits the end of the rect
13 | UILineBreakModeHeadTruncation, // Truncate at head of line: "...wxyz". Will truncate multiline text on first line
14 | UILineBreakModeTailTruncation, // Truncate at tail of line: "abcd...". Will truncate multiline text on last line
15 | UILineBreakModeMiddleTruncation, // Truncate middle of line: "ab...yz". Will truncate multiline text in the middle
16 | } UILineBreakMode;
17 |
18 | typedef enum {
19 | UITextAlignmentLeft = 0,
20 | UITextAlignmentCenter,
21 | UITextAlignmentRight,
22 |
23 | // As of iPhone OS 3.1.2 these are not available on the iPhone
24 | UITextAlignmentJusitifed,
25 | UITextAlignmentNatural
26 | } UITextAlignment;
27 |
28 | typedef enum {
29 | UIBaselineAdjustmentAlignBaselines = 0, // default. used when shrinking text to position based on the original baseline
30 | UIBaselineAdjustmentAlignCenters,
31 | UIBaselineAdjustmentNone,
32 | } UIBaselineAdjustment;
--------------------------------------------------------------------------------
/UITextField.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/20/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class UIColor;
12 | @interface UITextField : NSTextField {
13 | @private
14 | UIColor* textColor;
15 | UIColor* backgroundColor;
16 | }
17 |
18 | @property(nonatomic,retain) UIColor* textColor;
19 | @property(nonatomic,retain) UIColor* backgroundColor;
20 | @end
21 |
--------------------------------------------------------------------------------
/UITextField.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 7/20/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UITextField.h"
10 | #import "UIColor.h"
11 | #import
12 |
13 | //
14 | // IMPORTANT NOTE:
15 | // Do NOT layer back UI/NSTextField. It will cause a lot of issues.
16 | //
17 |
18 | @implementation UITextField
19 | @synthesize backgroundColor, textColor;
20 |
21 | - (id)initWithFrame:(NSRect)frame {
22 | if((self = [super initWithFrame:(NSRect)frame])) {
23 | [self setDrawsBackground:NO];
24 | }
25 |
26 | return self;
27 | }
28 |
29 | - (id)initWithCoder:(NSCoder *)aDecoder {
30 | if((self = [super initWithCoder:aDecoder])) {
31 | [self setDrawsBackground:NO];
32 | }
33 |
34 | return self;
35 | }
36 |
37 | - (BOOL)isFlipped {
38 | return YES;
39 | }
40 |
41 | - (void)setTextColor:(UIColor *)aColor {
42 | [textColor release];
43 | textColor = [aColor retain];
44 | [super setTextColor:self.textColor.NSColor];
45 | }
46 |
47 | - (void)setBackgroundColor:(UIColor *)aColor {
48 | [backgroundColor release];
49 | backgroundColor = [aColor retain];
50 | [super setBackgroundColor:backgroundColor.NSColor];
51 | }
52 |
53 | - (void)dealloc {
54 | [textColor release];
55 | [backgroundColor release];
56 | [super dealloc];
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/UIView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView.h
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | enum {
13 | UIViewAutoresizingNone = 0,
14 | UIViewAutoresizingFlexibleLeftMargin = 1,
15 | UIViewAutoresizingFlexibleWidth = 2,
16 | UIViewAutoresizingFlexibleRightMargin = 4,
17 | UIViewAutoresizingFlexibleTopMargin = 8,
18 | UIViewAutoresizingFlexibleHeight = 16,
19 | UIViewAutoresizingFlexibleBottomMargin = 32
20 | };
21 |
22 | @class UIColor, CALayer;
23 | @interface UIView : NSView {
24 | @private
25 | UIColor* _backgroundColor;
26 | BOOL _needsLayout;
27 | }
28 |
29 | - (void)setNeedsDisplay;
30 |
31 | - (void)setNeedsLayout;
32 | - (void)layoutIfNeeded;
33 | - (void)layoutSubviews;
34 |
35 | @property(nonatomic,retain) UIColor* backgroundColor;
36 | @end
37 |
38 | @interface NSView (UIViewLayerBacking)
39 | @property(nonatomic,assign,getter=isHidden) BOOL hidden;
40 | @property(nonatomic,retain) CALayer* layer;
41 | @end
--------------------------------------------------------------------------------
/UIView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView.m
3 | // UIKit
4 | //
5 | // Created by Shaun Harrison on 4/30/09.
6 | // Copyright 2009 enormego. All rights reserved.
7 | //
8 |
9 | #import "UIView.h"
10 | #import "UIColor.h"
11 |
12 | #import
13 |
14 | @implementation UIView
15 | @synthesize backgroundColor=_backgroundColor;
16 |
17 | - (id)initWithFrame:(NSRect)frame {
18 | if((self = [super initWithFrame:frame])) {
19 | [self setLayer:[CALayer layer]];
20 | }
21 |
22 | return self;
23 | }
24 |
25 | - (id)initWithCoder:(NSCoder *)aDecoder {
26 | if((self = [super initWithCoder:aDecoder])) {
27 | [self setLayer:[CALayer layer]];
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (void)setNeedsDisplay {
34 | [super setNeedsDisplay:YES];
35 | }
36 |
37 | - (void)display {
38 | [super display];
39 | }
40 |
41 | - (void)displayIfNeeded {
42 | [self layoutIfNeeded];
43 | [super displayIfNeeded];
44 | }
45 |
46 | - (void)setBackgroundColor:(UIColor *)aColor {
47 | [_backgroundColor release];
48 | _backgroundColor = [aColor retain];
49 |
50 | self.layer.backgroundColor = self.backgroundColor.CGColor;
51 | }
52 |
53 | - (void)viewDidMoveToSuperview {
54 | [super viewDidMoveToSuperview];
55 |
56 | }
57 |
58 | - (void)setNeedsLayout {
59 | _needsLayout = YES;
60 | [self setNeedsDisplay];
61 | [self.layer setNeedsLayout];
62 | }
63 |
64 | - (void)layoutSubviews {
65 |
66 | }
67 |
68 | - (void)layoutIfNeeded {
69 | if(_needsLayout) {
70 | [self layoutSubviews];
71 | _needsLayout = NO;
72 | }
73 | }
74 |
75 | - (BOOL)isFlipped {
76 | return YES;
77 | }
78 |
79 | - (NSString*)description {
80 | NSString* description = [super description];
81 | description = [description substringToIndex:description.length - 1];
82 | description = [description stringByAppendingFormat:@"; %@>", NSStringFromRect(self.frame)];
83 | return description;
84 | }
85 |
86 | - (void)dealloc {
87 | self.backgroundColor = nil;
88 | [super dealloc];
89 | }
90 |
91 | @end
92 |
--------------------------------------------------------------------------------
/version.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildVersion
6 | 3
7 | CFBundleVersion
8 | 1.0
9 | ProductBuildVersion
10 | 9M2729
11 | ProjectName
12 | DevToolsWizardTemplates
13 | SourceVersion
14 | 11600000
15 |
16 |
17 |
--------------------------------------------------------------------------------