Skip to content

Commit ced238b

Browse files
author
Damien DeVille
committed
Merge pull request #1 from 0xced/master.
AppKit Compatibility + README
2 parents c4deeb4 + 6872d35 commit ced238b

File tree

8 files changed

+53
-2
lines changed

8 files changed

+53
-2
lines changed

DDProgressView.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
6DA2E7F9132D6DC100985306 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/DDProgressViewViewController.xib; sourceTree = "<group>"; };
3737
6DA2E800132D6E2D00985306 /* DDProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDProgressView.h; sourceTree = "<group>"; };
3838
6DA2E801132D6E2D00985306 /* DDProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDProgressView.m; sourceTree = "<group>"; };
39+
DA8635BA136EEA8000776109 /* AppKitCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppKitCompatibility.h; sourceTree = "<group>"; };
40+
DA8635BB136EEA8000776109 /* AppKitCompatibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppKitCompatibility.m; sourceTree = "<group>"; };
3941
/* End PBXFileReference section */
4042

4143
/* Begin PBXFrameworksBuildPhase section */
@@ -82,6 +84,8 @@
8284
6DA2E7E6132D6DC100985306 /* DDProgressView */ = {
8385
isa = PBXGroup;
8486
children = (
87+
DA8635BA136EEA8000776109 /* AppKitCompatibility.h */,
88+
DA8635BB136EEA8000776109 /* AppKitCompatibility.m */,
8589
6DA2E800132D6E2D00985306 /* DDProgressView.h */,
8690
6DA2E801132D6E2D00985306 /* DDProgressView.m */,
8791
6DA2E7EF132D6DC100985306 /* DDProgressViewAppDelegate.h */,
@@ -285,6 +289,7 @@
285289
6DA2E7FF132D6DC100985306 /* Release */,
286290
);
287291
defaultConfigurationIsVisible = 0;
292+
defaultConfigurationName = Release;
288293
};
289294
/* End XCConfigurationList section */
290295
};

DDProgressView/AppKitCompatibility.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#define UIView NSView
2+
#define UIColor NSColor
3+
#define UIGraphicsGetCurrentContext() [[NSGraphicsContext currentContext] graphicsPort]
4+
5+
@interface NSView (UIKit)
6+
7+
@property (copy) UIColor *backgroundColor ;
8+
9+
- (void)setNeedsDisplay ;
10+
11+
@end

DDProgressView/AppKitCompatibility.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#import "AppKitCompatibility.h"
2+
3+
@implementation NSView (UIKit)
4+
5+
- (UIColor *)backgroundColor
6+
{
7+
return nil ;
8+
}
9+
10+
- (void)setBackgroundColor:(UIColor *)color
11+
{
12+
return ;
13+
}
14+
15+
- (void)setNeedsDisplay
16+
{
17+
[self setNeedsDisplay:YES] ;
18+
}
19+
20+
@end

DDProgressView/DDProgressView.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
// Copyright 2011 Snappy Code. All rights reserved.
77
//
88

9+
#if TARGET_OS_IPHONE
910
#import <UIKit/UIKit.h>
11+
#elif TARGET_OS_MAC
12+
#import "AppKitCompatibility.h"
13+
#endif
1014

1115
@interface DDProgressView : UIView
1216
{

DDProgressView/DDProgressView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (void)drawRect:(CGRect)rect
8484
rect = CGRectInset(rect, 1.0f, 1.0f) ;
8585
CGFloat radius = 0.5f * rect.size.height ;
8686

87-
CGContextSetStrokeColorWithColor(context, outerColor.CGColor) ;
87+
[outerColor setStroke] ;
8888
CGContextSetLineWidth(context, 2.0f) ;
8989

9090
CGContextBeginPath(context) ;
@@ -105,7 +105,7 @@ - (void)drawRect:(CGRect)rect
105105
if (rect.size.width < 2 * radius)
106106
rect.size.width = 2 * radius ;
107107

108-
CGContextSetFillColorWithColor(context, innerColor.CGColor) ;
108+
[innerColor setFill] ;
109109

110110
CGContextBeginPath(context) ;
111111
CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMidY(rect)) ;

README

Whitespace-only changes.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
About
2+
=====
3+
4+
**DDProgressView** is a custom progress view à la Twitter for iPhone.
5+
6+
DDProgressView works on both iOS and Mac OS. You must also compile the `AppKitCompatibility.m` file when targeting Mac OS.
7+
8+
Screenshot
9+
==========
10+
11+
![Gray on Black DDProgressView](https://github.com/0xced/DDProgressView/raw/master/Screenshot.png)

Screenshot.png

1.52 KB
Loading

0 commit comments

Comments
 (0)