├── README.md ├── .DS_Store ├── redo.png ├── undo.png ├── eraser.png ├── CaplessCoderPaint ├── en.lproj │ └── InfoPlist.strings ├── AppDelegate.h ├── Common.h ├── Line.h ├── main.m ├── CaplessCoderPaint-Prefix.pch ├── Line.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ColorPicker.h ├── TouchDrawView.h ├── Common.m ├── ColorPicker.m ├── CaplessCoderPaint-Info.plist ├── TouchDrawViewController.h ├── TouchDrawViewController.m ├── AppDelegate.m └── TouchDrawView.m ├── CaplessCoderPaintTests ├── en.lproj │ └── InfoPlist.strings ├── CaplessCoderPaintTests-Info.plist └── CaplessCoderPaintTests.m ├── CaplessCoderPaint.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── liuxinxin.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── CaplessCoderPaint.xccheckout ├── xcuserdata │ └── liuxinxin.xcuserdatad │ │ ├── xcschemes │ │ ├── xcschememanagement.plist │ │ └── CaplessCoderPaint.xcscheme │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── project.pbxproj └── TouchDrawViewController.xib /README.md: -------------------------------------------------------------------------------- 1 | # Paint-With-Undo 2 | 3 | Paint App With Undo and Eraser 4 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backslash112/paint-with-undo/HEAD/.DS_Store -------------------------------------------------------------------------------- /redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backslash112/paint-with-undo/HEAD/redo.png -------------------------------------------------------------------------------- /undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backslash112/paint-with-undo/HEAD/undo.png -------------------------------------------------------------------------------- /eraser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backslash112/paint-with-undo/HEAD/eraser.png -------------------------------------------------------------------------------- /CaplessCoderPaint/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CaplessCoderPaintTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/project.xcworkspace/xcuserdata/liuxinxin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backslash112/paint-with-undo/HEAD/CaplessCoderPaint.xcodeproj/project.xcworkspace/xcuserdata/liuxinxin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CaplessCoderPaint/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CaplessCoderPaint/Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Common.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/31. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Common : NSObject 12 | 13 | + (BOOL)color:(UIColor *)color1 14 | isEqualToColor:(UIColor *)color2 15 | withTolerance:(CGFloat)tolerance; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CaplessCoderPaint/Line.h: -------------------------------------------------------------------------------- 1 | // 2 | // Line.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Line : NSObject 12 | 13 | @property (nonatomic) CGPoint begin; 14 | @property (nonatomic) CGPoint end; 15 | @property (nonatomic, retain) UIColor *color; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CaplessCoderPaint/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CaplessCoderPaint/CaplessCoderPaint-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/project.xcworkspace/xcuserdata/liuxinxin.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CaplessCoderPaint/Line.m: -------------------------------------------------------------------------------- 1 | // 2 | // Line.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import "Line.h" 10 | 11 | @implementation Line 12 | 13 | @synthesize begin, end, color; 14 | 15 | - (id)init 16 | { 17 | self = [super init]; 18 | if (self) { 19 | [self setColor:[UIColor blackColor]]; 20 | } 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CaplessCoderPaint/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CaplessCoderPaint/ColorPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // ColorPicker.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ColorPickerDelegate 12 | @optional 13 | - (void)aColorPickerIsSelected:(UIColor *)color; 14 | @end 15 | 16 | @interface ColorPicker : UIView 17 | 18 | @property (nonatomic,retain) id delegate; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CaplessCoderPaint/TouchDrawView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TouchDrawView.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Line.h" 11 | 12 | @interface TouchDrawView : UIView { 13 | BOOL isCleared; 14 | } 15 | 16 | @property (nonatomic) Line *currentLine; 17 | @property (nonatomic) NSMutableArray *linesCompleted; 18 | @property (nonatomic) UIColor *drawColor; 19 | 20 | - (void)undo; 21 | - (void)redo; 22 | @end 23 | -------------------------------------------------------------------------------- /CaplessCoderPaint/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CaplessCoderPaint/Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // Common.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/31. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import "Common.h" 10 | 11 | @implementation Common 12 | 13 | + (BOOL)color:(UIColor *)color1 14 | isEqualToColor:(UIColor *)color2 15 | withTolerance:(CGFloat)tolerance { 16 | 17 | CGFloat r1, g1, b1, a1, r2, g2, b2, a2; 18 | [color1 getRed:&r1 green:&g1 blue:&b1 alpha:&a1]; 19 | [color2 getRed:&r2 green:&g2 blue:&b2 alpha:&a2]; 20 | return 21 | fabs(r1 - r2) <= tolerance && 22 | fabs(g1 - g2) <= tolerance && 23 | fabs(b1 - b2) <= tolerance && 24 | fabs(a1 - a2) <= tolerance; 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/xcuserdata/liuxinxin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CaplessCoderPaint.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C3CF793A1A009723009E47DA 16 | 17 | primary 18 | 19 | 20 | C3CF79551A009723009E47DA 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CaplessCoderPaintTests/CaplessCoderPaintTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yangcun.demo.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CaplessCoderPaintTests/CaplessCoderPaintTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CaplessCoderPaintTests.m 3 | // CaplessCoderPaintTests 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CaplessCoderPaintTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CaplessCoderPaintTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CaplessCoderPaint/ColorPicker.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ColorPicker.m 4 | // CaplessCoderPaint 5 | // 6 | // Created by crossmo/yangcun on 14/10/29. 7 | // Copyright (c) 2014年 yangcun. All rights reserved. 8 | // 9 | 10 | #import "ColorPicker.h" 11 | 12 | @implementation ColorPicker 13 | @synthesize delegate; 14 | 15 | - (id)initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | // Initialization code 20 | } 21 | return self; 22 | } 23 | 24 | /* 25 | // Only override drawRect: if you perform custom drawing. 26 | // An empty implementation adversely affects performance during animation. 27 | - (void)drawRect:(CGRect)rect 28 | { 29 | // Drawing code 30 | } 31 | */ 32 | 33 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 34 | { 35 | if ([delegate respondsToSelector:@selector(aColorPickerIsSelected:)]) { 36 | [delegate aColorPickerIsSelected:[self backgroundColor]]; 37 | } 38 | self.layer.borderWidth = 1.5f; 39 | self.layer.borderColor = [[UIColor redColor] CGColor]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CaplessCoderPaint/CaplessCoderPaint-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.yangcun.demo.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /CaplessCoderPaint/TouchDrawViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TouchDrawViewController.h 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ColorPicker.h" 11 | #import "TouchDrawView.h" 12 | 13 | @interface TouchDrawViewController : UIViewController 14 | { 15 | BOOL isCleared; 16 | BOOL isSelectedColor; 17 | } 18 | 19 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector1; 20 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector2; 21 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector3; 22 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector4; 23 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector5; 24 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector6; 25 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector7; 26 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector8; 27 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector9; 28 | @property (retain, nonatomic) IBOutlet TouchDrawView *drewArea; 29 | 30 | @property (unsafe_unretained, nonatomic) IBOutlet ColorPicker *selector0; 31 | @property (weak, nonatomic) IBOutlet UIButton *undoButton; 32 | @property (weak, nonatomic) IBOutlet UIButton *redoButton; 33 | 34 | - (IBAction)undo:(id)sender; 35 | - (IBAction)redo:(id)sender; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/project.xcworkspace/xcshareddata/CaplessCoderPaint.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 83F1CAAB-77FD-434D-8B37-819BFC4CE9EA 9 | IDESourceControlProjectName 10 | CaplessCoderPaint 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 2028ADFC61201EFD816062097ABFFDBDF1EBB01F 14 | github.com:backslash112/paint-with-undo.git 15 | 16 | IDESourceControlProjectPath 17 | CaplessCoderPaint.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 2028ADFC61201EFD816062097ABFFDBDF1EBB01F 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:backslash112/paint-with-undo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 2028ADFC61201EFD816062097ABFFDBDF1EBB01F 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 2028ADFC61201EFD816062097ABFFDBDF1EBB01F 36 | IDESourceControlWCCName 37 | CaplessCoderPaint 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/xcuserdata/liuxinxin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /CaplessCoderPaint/TouchDrawViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TouchDrawViewController.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import "TouchDrawViewController.h" 10 | #import "TouchDrawView.h" 11 | 12 | @interface TouchDrawViewController () 13 | 14 | @end 15 | 16 | @implementation TouchDrawViewController 17 | @synthesize selector1; 18 | @synthesize selector2; 19 | @synthesize selector3; 20 | @synthesize selector4; 21 | @synthesize selector5; 22 | @synthesize selector6; 23 | @synthesize selector7; 24 | @synthesize selector8; 25 | @synthesize selector9; 26 | @synthesize drewArea; 27 | @synthesize selector0; 28 | 29 | 30 | - (id)init 31 | { 32 | self = [super initWithNibName:@"TouchDrawViewController" 33 | bundle:nil]; 34 | isSelectedColor = NO; 35 | isCleared = NO; 36 | 37 | return self; 38 | } 39 | 40 | - (void)viewDidLoad 41 | { 42 | [super viewDidLoad]; 43 | 44 | [selector1 setDelegate:self]; 45 | [selector2 setDelegate:self]; 46 | [selector3 setDelegate:self]; 47 | [selector4 setDelegate:self]; 48 | [selector5 setDelegate:self]; 49 | [selector6 setDelegate:self]; 50 | [selector7 setDelegate:self]; 51 | [selector8 setDelegate:self]; 52 | [selector9 setDelegate:self]; 53 | [selector0 setDelegate:self]; 54 | 55 | NSLog(@"Loaded the view for HypnosisViewController"); 56 | } 57 | 58 | - (void)viewWillAppear:(BOOL)animated 59 | { 60 | [super viewWillAppear:animated]; 61 | } 62 | 63 | - (void)viewWillDisappear:(BOOL)animated 64 | { 65 | [super viewWillDisappear:animated]; 66 | } 67 | 68 | - (void)aColorPickerIsSelected:(UIColor *)color 69 | { 70 | [drewArea setDrawColor:color]; 71 | 72 | selector1.layer.borderWidth = 0.0f; 73 | selector2.layer.borderWidth = 0.0f; 74 | selector3.layer.borderWidth = 0.0f; 75 | selector4.layer.borderWidth = 0.0f; 76 | selector5.layer.borderWidth = 0.0f; 77 | selector6.layer.borderWidth = 0.0f; 78 | selector7.layer.borderWidth = 0.0f; 79 | selector8.layer.borderWidth = 0.0f; 80 | selector9.layer.borderWidth = 0.0f; 81 | selector0.layer.borderWidth = 0.0f; 82 | } 83 | 84 | - (IBAction)undo:(id)sender 85 | { 86 | [drewArea undo]; 87 | } 88 | 89 | - (IBAction)redo:(id)sender { 90 | [drewArea redo]; 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /CaplessCoderPaint/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "TouchDrawView.h" 11 | #import "TouchDrawViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 20 | // Override point for customization after application launch. 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | [self.window makeKeyAndVisible]; 23 | 24 | TouchDrawViewController *ct = [[TouchDrawViewController alloc] init]; 25 | self.window.rootViewController = ct; 26 | 27 | return YES; 28 | } 29 | 30 | - (void)applicationWillResignActive:(UIApplication *)application 31 | { 32 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 33 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application 37 | { 38 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | - (void)applicationWillEnterForeground:(UIApplication *)application 43 | { 44 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application 48 | { 49 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 50 | } 51 | 52 | - (void)applicationWillTerminate:(UIApplication *)application 53 | { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/xcuserdata/liuxinxin.xcuserdatad/xcschemes/CaplessCoderPaint.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CaplessCoderPaint/TouchDrawView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TouchDrawView.m 3 | // CaplessCoderPaint 4 | // 5 | // Created by crossmo/yangcun on 14/10/29. 6 | // Copyright (c) 2014年 yangcun. All rights reserved. 7 | // 8 | 9 | #import "TouchDrawView.h" 10 | #import "Common.h" 11 | 12 | @implementation TouchDrawView 13 | { 14 | BOOL _isEraser; 15 | } 16 | @synthesize currentLine; 17 | @synthesize linesCompleted; 18 | @synthesize drawColor; 19 | 20 | - (id)initWithCoder:(NSCoder *)c 21 | { 22 | self = [super initWithCoder:c]; 23 | if (self) { 24 | linesCompleted = [[NSMutableArray alloc] init]; 25 | [self setMultipleTouchEnabled:YES]; 26 | 27 | drawColor = [UIColor blackColor]; 28 | [self becomeFirstResponder]; 29 | } 30 | return self; 31 | } 32 | 33 | // It is a method of UIView called every time the screen needs a redisplay or refresh. 34 | - (void)drawRect:(CGRect)rect 35 | { 36 | CGContextRef context = UIGraphicsGetCurrentContext(); 37 | 38 | CGContextSetLineWidth(context, 5.0); 39 | CGContextSetLineCap(context, kCGLineCapRound); 40 | for (Line *line in linesCompleted) { 41 | [[line color] set]; 42 | CGContextMoveToPoint(context, [line begin].x, [line begin].y); 43 | CGContextAddLineToPoint(context, [line end].x, [line end].y); 44 | CGContextStrokePath(context); 45 | } 46 | } 47 | 48 | - (void)undo 49 | { 50 | if ([self.undoManager canUndo]) { 51 | [self.undoManager undo]; 52 | } 53 | } 54 | 55 | - (void)redo 56 | { 57 | if ([self.undoManager canRedo]) { 58 | [self.undoManager redo]; 59 | } 60 | } 61 | 62 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 63 | { 64 | [self.undoManager beginUndoGrouping]; 65 | for (UITouch *t in touches) { 66 | // Create a line for the value 67 | CGPoint loc = [t locationInView:self]; 68 | Line *newLine = [[Line alloc] init]; 69 | [newLine setBegin:loc]; 70 | [newLine setEnd:loc]; 71 | [newLine setColor:drawColor]; 72 | currentLine = newLine; 73 | } 74 | } 75 | 76 | - (void)addLine:(Line*)line 77 | { 78 | [[self.undoManager prepareWithInvocationTarget:self] removeLine:line]; 79 | [linesCompleted addObject:line]; 80 | [self setNeedsDisplay]; 81 | } 82 | 83 | - (void)removeLine:(Line*)line 84 | { 85 | if ([linesCompleted containsObject:line]) { 86 | [[self.undoManager prepareWithInvocationTarget:self] addLine:line]; 87 | [linesCompleted removeObject:line]; 88 | [self setNeedsDisplay]; 89 | } 90 | } 91 | 92 | - (void)removeLineByEndPoint:(CGPoint)point 93 | { 94 | NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { 95 | Line *evaluatedLine = (Line*)evaluatedObject; 96 | // return (evaluatedLine.end.x == point.x && evaluatedLine.end.y == point.y) || 97 | // (evaluatedLine.end.x == point.x - 1.0f && evaluatedLine.end.y == point.y - 1.0f) || 98 | // (evaluatedLine.end.x == point.x + 1.0f && evaluatedLine.end.y == point.y + 1.0f); 99 | return (evaluatedLine.end.x <= point.x-1 || evaluatedLine.end.x > point.x+1) && 100 | (evaluatedLine.end.y <= point.y-1 || evaluatedLine.end.y > point.y+1); 101 | }]; 102 | NSArray *result = [linesCompleted filteredArrayUsingPredicate:predicate]; 103 | if (result && result.count > 0) { 104 | [linesCompleted removeObject:result[0]]; 105 | } 106 | } 107 | 108 | 109 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 110 | { 111 | if (!isCleared) { 112 | for (UITouch *t in touches) { 113 | [currentLine setColor:drawColor]; 114 | CGPoint loc = [t locationInView:self]; 115 | [currentLine setEnd:loc]; 116 | 117 | if (currentLine) { 118 | if ([Common color:drawColor isEqualToColor:[UIColor clearColor] withTolerance:0.2]) { 119 | // eraser 120 | // [self removeLineByEndPoint:loc]; //this solution can not work. 121 | _isEraser = YES; 122 | } else { 123 | _isEraser = NO; 124 | [self addLine:currentLine]; 125 | } 126 | } 127 | Line *newLine = [[Line alloc] init]; 128 | [newLine setBegin:loc]; 129 | [newLine setEnd:loc]; 130 | [newLine setColor:drawColor]; 131 | currentLine = newLine; 132 | } 133 | } 134 | } 135 | 136 | - (void)endTouches:(NSSet *)touches 137 | { 138 | if (!isCleared) { 139 | [self setNeedsDisplay]; 140 | } else { 141 | isCleared = NO; 142 | } 143 | } 144 | 145 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 146 | { 147 | [self endTouches:touches]; 148 | [self.undoManager endUndoGrouping]; 149 | } 150 | 151 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 152 | { 153 | [self endTouches:touches]; 154 | } 155 | 156 | - (BOOL)canBecomeFirstResponder 157 | { 158 | return YES; 159 | } 160 | 161 | - (void)didMoveToWindow 162 | { 163 | [self becomeFirstResponder]; 164 | } 165 | 166 | - (id)initWithFrame:(CGRect)frame 167 | { 168 | self = [super initWithFrame:frame]; 169 | if (self) { 170 | // Initialization code 171 | } 172 | return self; 173 | } 174 | 175 | @end 176 | -------------------------------------------------------------------------------- /TouchDrawViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 77 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /CaplessCoderPaint.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C3327E0D1A00E70C00658E60 /* undo.png in Resources */ = {isa = PBXBuildFile; fileRef = C3327E0C1A00E70C00658E60 /* undo.png */; }; 11 | C3327E0F1A0320C300658E60 /* eraser.png in Resources */ = {isa = PBXBuildFile; fileRef = C3327E0E1A0320C300658E60 /* eraser.png */; }; 12 | C34349BF1A071AF200FD3477 /* redo.png in Resources */ = {isa = PBXBuildFile; fileRef = C34349BE1A071AF200FD3477 /* redo.png */; }; 13 | C3C323EE1A0332CC00D0C3FC /* Common.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C323ED1A0332CC00D0C3FC /* Common.m */; }; 14 | C3CF793F1A009723009E47DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF793E1A009723009E47DA /* Foundation.framework */; }; 15 | C3CF79411A009723009E47DA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF79401A009723009E47DA /* CoreGraphics.framework */; }; 16 | C3CF79431A009723009E47DA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF79421A009723009E47DA /* UIKit.framework */; }; 17 | C3CF79491A009723009E47DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C3CF79471A009723009E47DA /* InfoPlist.strings */; }; 18 | C3CF794B1A009723009E47DA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF794A1A009723009E47DA /* main.m */; }; 19 | C3CF794F1A009723009E47DA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF794E1A009723009E47DA /* AppDelegate.m */; }; 20 | C3CF79511A009723009E47DA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3CF79501A009723009E47DA /* Images.xcassets */; }; 21 | C3CF79581A009723009E47DA /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF79571A009723009E47DA /* XCTest.framework */; }; 22 | C3CF79591A009723009E47DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF793E1A009723009E47DA /* Foundation.framework */; }; 23 | C3CF795A1A009723009E47DA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF79421A009723009E47DA /* UIKit.framework */; }; 24 | C3CF79621A009723009E47DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C3CF79601A009723009E47DA /* InfoPlist.strings */; }; 25 | C3CF79641A009723009E47DA /* CaplessCoderPaintTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF79631A009723009E47DA /* CaplessCoderPaintTests.m */; }; 26 | C3CF796E1A00978E009E47DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CF796D1A00978E009E47DA /* QuartzCore.framework */; }; 27 | C3CF79711A0097A5009E47DA /* Line.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF79701A0097A5009E47DA /* Line.m */; }; 28 | C3CF79741A009856009E47DA /* ColorPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF79731A009856009E47DA /* ColorPicker.m */; }; 29 | C3CF79771A009926009E47DA /* TouchDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF79761A009926009E47DA /* TouchDrawView.m */; }; 30 | C3CF79791A00BADB009E47DA /* TouchDrawViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3CF79781A00BADB009E47DA /* TouchDrawViewController.xib */; }; 31 | C3CF797C1A00C039009E47DA /* TouchDrawViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CF797B1A00C039009E47DA /* TouchDrawViewController.m */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXContainerItemProxy section */ 35 | C3CF795B1A009723009E47DA /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = C3CF79331A009723009E47DA /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = C3CF793A1A009723009E47DA; 40 | remoteInfo = CaplessCoderPaint; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | C3327E0C1A00E70C00658E60 /* undo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = undo.png; sourceTree = ""; }; 46 | C3327E0E1A0320C300658E60 /* eraser.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = eraser.png; sourceTree = ""; }; 47 | C34349BE1A071AF200FD3477 /* redo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = redo.png; sourceTree = ""; }; 48 | C3C323EC1A0332CC00D0C3FC /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = ""; }; 49 | C3C323ED1A0332CC00D0C3FC /* Common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Common.m; sourceTree = ""; }; 50 | C3CF793B1A009723009E47DA /* CaplessCoderPaint.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CaplessCoderPaint.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | C3CF793E1A009723009E47DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 52 | C3CF79401A009723009E47DA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 53 | C3CF79421A009723009E47DA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 54 | C3CF79461A009723009E47DA /* CaplessCoderPaint-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CaplessCoderPaint-Info.plist"; sourceTree = ""; }; 55 | C3CF79481A009723009E47DA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | C3CF794A1A009723009E47DA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | C3CF794C1A009723009E47DA /* CaplessCoderPaint-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CaplessCoderPaint-Prefix.pch"; sourceTree = ""; }; 58 | C3CF794D1A009723009E47DA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 59 | C3CF794E1A009723009E47DA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 60 | C3CF79501A009723009E47DA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 61 | C3CF79561A009723009E47DA /* CaplessCoderPaintTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CaplessCoderPaintTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | C3CF79571A009723009E47DA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 63 | C3CF795F1A009723009E47DA /* CaplessCoderPaintTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CaplessCoderPaintTests-Info.plist"; sourceTree = ""; }; 64 | C3CF79611A009723009E47DA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | C3CF79631A009723009E47DA /* CaplessCoderPaintTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CaplessCoderPaintTests.m; sourceTree = ""; }; 66 | C3CF796D1A00978E009E47DA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 67 | C3CF796F1A0097A5009E47DA /* Line.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Line.h; sourceTree = ""; }; 68 | C3CF79701A0097A5009E47DA /* Line.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Line.m; sourceTree = ""; }; 69 | C3CF79721A009856009E47DA /* ColorPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorPicker.h; sourceTree = ""; }; 70 | C3CF79731A009856009E47DA /* ColorPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorPicker.m; sourceTree = ""; }; 71 | C3CF79751A009926009E47DA /* TouchDrawView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchDrawView.h; sourceTree = ""; }; 72 | C3CF79761A009926009E47DA /* TouchDrawView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TouchDrawView.m; sourceTree = ""; }; 73 | C3CF79781A00BADB009E47DA /* TouchDrawViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = TouchDrawViewController.xib; path = ../TouchDrawViewController.xib; sourceTree = ""; }; 74 | C3CF797A1A00C039009E47DA /* TouchDrawViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchDrawViewController.h; sourceTree = ""; }; 75 | C3CF797B1A00C039009E47DA /* TouchDrawViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TouchDrawViewController.m; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | C3CF79381A009723009E47DA /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | C3CF796E1A00978E009E47DA /* QuartzCore.framework in Frameworks */, 84 | C3CF79411A009723009E47DA /* CoreGraphics.framework in Frameworks */, 85 | C3CF79431A009723009E47DA /* UIKit.framework in Frameworks */, 86 | C3CF793F1A009723009E47DA /* Foundation.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | C3CF79531A009723009E47DA /* Frameworks */ = { 91 | isa = PBXFrameworksBuildPhase; 92 | buildActionMask = 2147483647; 93 | files = ( 94 | C3CF79581A009723009E47DA /* XCTest.framework in Frameworks */, 95 | C3CF795A1A009723009E47DA /* UIKit.framework in Frameworks */, 96 | C3CF79591A009723009E47DA /* Foundation.framework in Frameworks */, 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | /* End PBXFrameworksBuildPhase section */ 101 | 102 | /* Begin PBXGroup section */ 103 | C3327E091A00E6DD00658E60 /* Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | C34349BE1A071AF200FD3477 /* redo.png */, 107 | C3327E0E1A0320C300658E60 /* eraser.png */, 108 | C3327E0C1A00E70C00658E60 /* undo.png */, 109 | ); 110 | name = Files; 111 | sourceTree = ""; 112 | }; 113 | C3CF79321A009723009E47DA = { 114 | isa = PBXGroup; 115 | children = ( 116 | C3327E091A00E6DD00658E60 /* Files */, 117 | C3CF79441A009723009E47DA /* CaplessCoderPaint */, 118 | C3CF795D1A009723009E47DA /* CaplessCoderPaintTests */, 119 | C3CF793D1A009723009E47DA /* Frameworks */, 120 | C3CF793C1A009723009E47DA /* Products */, 121 | ); 122 | sourceTree = ""; 123 | }; 124 | C3CF793C1A009723009E47DA /* Products */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | C3CF793B1A009723009E47DA /* CaplessCoderPaint.app */, 128 | C3CF79561A009723009E47DA /* CaplessCoderPaintTests.xctest */, 129 | ); 130 | name = Products; 131 | sourceTree = ""; 132 | }; 133 | C3CF793D1A009723009E47DA /* Frameworks */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | C3CF796D1A00978E009E47DA /* QuartzCore.framework */, 137 | C3CF793E1A009723009E47DA /* Foundation.framework */, 138 | C3CF79401A009723009E47DA /* CoreGraphics.framework */, 139 | C3CF79421A009723009E47DA /* UIKit.framework */, 140 | C3CF79571A009723009E47DA /* XCTest.framework */, 141 | ); 142 | name = Frameworks; 143 | sourceTree = ""; 144 | }; 145 | C3CF79441A009723009E47DA /* CaplessCoderPaint */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | C3CF794D1A009723009E47DA /* AppDelegate.h */, 149 | C3CF794E1A009723009E47DA /* AppDelegate.m */, 150 | C3CF79501A009723009E47DA /* Images.xcassets */, 151 | C3CF79451A009723009E47DA /* Supporting Files */, 152 | C3CF796F1A0097A5009E47DA /* Line.h */, 153 | C3CF79701A0097A5009E47DA /* Line.m */, 154 | C3CF79721A009856009E47DA /* ColorPicker.h */, 155 | C3CF79731A009856009E47DA /* ColorPicker.m */, 156 | C3CF79751A009926009E47DA /* TouchDrawView.h */, 157 | C3CF79761A009926009E47DA /* TouchDrawView.m */, 158 | C3CF79781A00BADB009E47DA /* TouchDrawViewController.xib */, 159 | C3CF797A1A00C039009E47DA /* TouchDrawViewController.h */, 160 | C3CF797B1A00C039009E47DA /* TouchDrawViewController.m */, 161 | C3C323EC1A0332CC00D0C3FC /* Common.h */, 162 | C3C323ED1A0332CC00D0C3FC /* Common.m */, 163 | ); 164 | path = CaplessCoderPaint; 165 | sourceTree = ""; 166 | }; 167 | C3CF79451A009723009E47DA /* Supporting Files */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | C3CF79461A009723009E47DA /* CaplessCoderPaint-Info.plist */, 171 | C3CF79471A009723009E47DA /* InfoPlist.strings */, 172 | C3CF794A1A009723009E47DA /* main.m */, 173 | C3CF794C1A009723009E47DA /* CaplessCoderPaint-Prefix.pch */, 174 | ); 175 | name = "Supporting Files"; 176 | sourceTree = ""; 177 | }; 178 | C3CF795D1A009723009E47DA /* CaplessCoderPaintTests */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | C3CF79631A009723009E47DA /* CaplessCoderPaintTests.m */, 182 | C3CF795E1A009723009E47DA /* Supporting Files */, 183 | ); 184 | path = CaplessCoderPaintTests; 185 | sourceTree = ""; 186 | }; 187 | C3CF795E1A009723009E47DA /* Supporting Files */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | C3CF795F1A009723009E47DA /* CaplessCoderPaintTests-Info.plist */, 191 | C3CF79601A009723009E47DA /* InfoPlist.strings */, 192 | ); 193 | name = "Supporting Files"; 194 | sourceTree = ""; 195 | }; 196 | /* End PBXGroup section */ 197 | 198 | /* Begin PBXNativeTarget section */ 199 | C3CF793A1A009723009E47DA /* CaplessCoderPaint */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = C3CF79671A009723009E47DA /* Build configuration list for PBXNativeTarget "CaplessCoderPaint" */; 202 | buildPhases = ( 203 | C3CF79371A009723009E47DA /* Sources */, 204 | C3CF79381A009723009E47DA /* Frameworks */, 205 | C3CF79391A009723009E47DA /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | ); 211 | name = CaplessCoderPaint; 212 | productName = CaplessCoderPaint; 213 | productReference = C3CF793B1A009723009E47DA /* CaplessCoderPaint.app */; 214 | productType = "com.apple.product-type.application"; 215 | }; 216 | C3CF79551A009723009E47DA /* CaplessCoderPaintTests */ = { 217 | isa = PBXNativeTarget; 218 | buildConfigurationList = C3CF796A1A009723009E47DA /* Build configuration list for PBXNativeTarget "CaplessCoderPaintTests" */; 219 | buildPhases = ( 220 | C3CF79521A009723009E47DA /* Sources */, 221 | C3CF79531A009723009E47DA /* Frameworks */, 222 | C3CF79541A009723009E47DA /* Resources */, 223 | ); 224 | buildRules = ( 225 | ); 226 | dependencies = ( 227 | C3CF795C1A009723009E47DA /* PBXTargetDependency */, 228 | ); 229 | name = CaplessCoderPaintTests; 230 | productName = CaplessCoderPaintTests; 231 | productReference = C3CF79561A009723009E47DA /* CaplessCoderPaintTests.xctest */; 232 | productType = "com.apple.product-type.bundle.unit-test"; 233 | }; 234 | /* End PBXNativeTarget section */ 235 | 236 | /* Begin PBXProject section */ 237 | C3CF79331A009723009E47DA /* Project object */ = { 238 | isa = PBXProject; 239 | attributes = { 240 | LastUpgradeCheck = 0510; 241 | ORGANIZATIONNAME = yangcun; 242 | TargetAttributes = { 243 | C3CF79551A009723009E47DA = { 244 | TestTargetID = C3CF793A1A009723009E47DA; 245 | }; 246 | }; 247 | }; 248 | buildConfigurationList = C3CF79361A009723009E47DA /* Build configuration list for PBXProject "CaplessCoderPaint" */; 249 | compatibilityVersion = "Xcode 3.2"; 250 | developmentRegion = English; 251 | hasScannedForEncodings = 0; 252 | knownRegions = ( 253 | en, 254 | ); 255 | mainGroup = C3CF79321A009723009E47DA; 256 | productRefGroup = C3CF793C1A009723009E47DA /* Products */; 257 | projectDirPath = ""; 258 | projectRoot = ""; 259 | targets = ( 260 | C3CF793A1A009723009E47DA /* CaplessCoderPaint */, 261 | C3CF79551A009723009E47DA /* CaplessCoderPaintTests */, 262 | ); 263 | }; 264 | /* End PBXProject section */ 265 | 266 | /* Begin PBXResourcesBuildPhase section */ 267 | C3CF79391A009723009E47DA /* Resources */ = { 268 | isa = PBXResourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | C3CF79791A00BADB009E47DA /* TouchDrawViewController.xib in Resources */, 272 | C3327E0F1A0320C300658E60 /* eraser.png in Resources */, 273 | C3327E0D1A00E70C00658E60 /* undo.png in Resources */, 274 | C3CF79491A009723009E47DA /* InfoPlist.strings in Resources */, 275 | C3CF79511A009723009E47DA /* Images.xcassets in Resources */, 276 | C34349BF1A071AF200FD3477 /* redo.png in Resources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | C3CF79541A009723009E47DA /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | C3CF79621A009723009E47DA /* InfoPlist.strings in Resources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | /* End PBXResourcesBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | C3CF79371A009723009E47DA /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | C3CF797C1A00C039009E47DA /* TouchDrawViewController.m in Sources */, 296 | C3CF794F1A009723009E47DA /* AppDelegate.m in Sources */, 297 | C3CF79741A009856009E47DA /* ColorPicker.m in Sources */, 298 | C3CF79771A009926009E47DA /* TouchDrawView.m in Sources */, 299 | C3CF79711A0097A5009E47DA /* Line.m in Sources */, 300 | C3CF794B1A009723009E47DA /* main.m in Sources */, 301 | C3C323EE1A0332CC00D0C3FC /* Common.m in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | C3CF79521A009723009E47DA /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | C3CF79641A009723009E47DA /* CaplessCoderPaintTests.m in Sources */, 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | /* End PBXSourcesBuildPhase section */ 314 | 315 | /* Begin PBXTargetDependency section */ 316 | C3CF795C1A009723009E47DA /* PBXTargetDependency */ = { 317 | isa = PBXTargetDependency; 318 | target = C3CF793A1A009723009E47DA /* CaplessCoderPaint */; 319 | targetProxy = C3CF795B1A009723009E47DA /* PBXContainerItemProxy */; 320 | }; 321 | /* End PBXTargetDependency section */ 322 | 323 | /* Begin PBXVariantGroup section */ 324 | C3CF79471A009723009E47DA /* InfoPlist.strings */ = { 325 | isa = PBXVariantGroup; 326 | children = ( 327 | C3CF79481A009723009E47DA /* en */, 328 | ); 329 | name = InfoPlist.strings; 330 | sourceTree = ""; 331 | }; 332 | C3CF79601A009723009E47DA /* InfoPlist.strings */ = { 333 | isa = PBXVariantGroup; 334 | children = ( 335 | C3CF79611A009723009E47DA /* en */, 336 | ); 337 | name = InfoPlist.strings; 338 | sourceTree = ""; 339 | }; 340 | /* End PBXVariantGroup section */ 341 | 342 | /* Begin XCBuildConfiguration section */ 343 | C3CF79651A009723009E47DA /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ALWAYS_SEARCH_USER_PATHS = NO; 347 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 348 | CLANG_CXX_LIBRARY = "libc++"; 349 | CLANG_ENABLE_MODULES = YES; 350 | CLANG_ENABLE_OBJC_ARC = YES; 351 | CLANG_WARN_BOOL_CONVERSION = YES; 352 | CLANG_WARN_CONSTANT_CONVERSION = YES; 353 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 354 | CLANG_WARN_EMPTY_BODY = YES; 355 | CLANG_WARN_ENUM_CONVERSION = YES; 356 | CLANG_WARN_INT_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_OPTIMIZATION_LEVEL = 0; 364 | GCC_PREPROCESSOR_DEFINITIONS = ( 365 | "DEBUG=1", 366 | "$(inherited)", 367 | ); 368 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 376 | ONLY_ACTIVE_ARCH = YES; 377 | SDKROOT = iphoneos; 378 | }; 379 | name = Debug; 380 | }; 381 | C3CF79661A009723009E47DA /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ALWAYS_SEARCH_USER_PATHS = NO; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 397 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 398 | COPY_PHASE_STRIP = YES; 399 | ENABLE_NS_ASSERTIONS = NO; 400 | GCC_C_LANGUAGE_STANDARD = gnu99; 401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 403 | GCC_WARN_UNDECLARED_SELECTOR = YES; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 408 | SDKROOT = iphoneos; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | C3CF79681A009723009E47DA /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 418 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 419 | GCC_PREFIX_HEADER = "CaplessCoderPaint/CaplessCoderPaint-Prefix.pch"; 420 | INFOPLIST_FILE = "CaplessCoderPaint/CaplessCoderPaint-Info.plist"; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | WRAPPER_EXTENSION = app; 423 | }; 424 | name = Debug; 425 | }; 426 | C3CF79691A009723009E47DA /* Release */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 430 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 431 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 432 | GCC_PREFIX_HEADER = "CaplessCoderPaint/CaplessCoderPaint-Prefix.pch"; 433 | INFOPLIST_FILE = "CaplessCoderPaint/CaplessCoderPaint-Info.plist"; 434 | PRODUCT_NAME = "$(TARGET_NAME)"; 435 | WRAPPER_EXTENSION = app; 436 | }; 437 | name = Release; 438 | }; 439 | C3CF796B1A009723009E47DA /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CaplessCoderPaint.app/CaplessCoderPaint"; 443 | FRAMEWORK_SEARCH_PATHS = ( 444 | "$(SDKROOT)/Developer/Library/Frameworks", 445 | "$(inherited)", 446 | "$(DEVELOPER_FRAMEWORKS_DIR)", 447 | ); 448 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 449 | GCC_PREFIX_HEADER = "CaplessCoderPaint/CaplessCoderPaint-Prefix.pch"; 450 | GCC_PREPROCESSOR_DEFINITIONS = ( 451 | "DEBUG=1", 452 | "$(inherited)", 453 | ); 454 | INFOPLIST_FILE = "CaplessCoderPaintTests/CaplessCoderPaintTests-Info.plist"; 455 | PRODUCT_NAME = "$(TARGET_NAME)"; 456 | TEST_HOST = "$(BUNDLE_LOADER)"; 457 | WRAPPER_EXTENSION = xctest; 458 | }; 459 | name = Debug; 460 | }; 461 | C3CF796C1A009723009E47DA /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CaplessCoderPaint.app/CaplessCoderPaint"; 465 | FRAMEWORK_SEARCH_PATHS = ( 466 | "$(SDKROOT)/Developer/Library/Frameworks", 467 | "$(inherited)", 468 | "$(DEVELOPER_FRAMEWORKS_DIR)", 469 | ); 470 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 471 | GCC_PREFIX_HEADER = "CaplessCoderPaint/CaplessCoderPaint-Prefix.pch"; 472 | INFOPLIST_FILE = "CaplessCoderPaintTests/CaplessCoderPaintTests-Info.plist"; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | TEST_HOST = "$(BUNDLE_LOADER)"; 475 | WRAPPER_EXTENSION = xctest; 476 | }; 477 | name = Release; 478 | }; 479 | /* End XCBuildConfiguration section */ 480 | 481 | /* Begin XCConfigurationList section */ 482 | C3CF79361A009723009E47DA /* Build configuration list for PBXProject "CaplessCoderPaint" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | C3CF79651A009723009E47DA /* Debug */, 486 | C3CF79661A009723009E47DA /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | defaultConfigurationName = Release; 490 | }; 491 | C3CF79671A009723009E47DA /* Build configuration list for PBXNativeTarget "CaplessCoderPaint" */ = { 492 | isa = XCConfigurationList; 493 | buildConfigurations = ( 494 | C3CF79681A009723009E47DA /* Debug */, 495 | C3CF79691A009723009E47DA /* Release */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | C3CF796A1A009723009E47DA /* Build configuration list for PBXNativeTarget "CaplessCoderPaintTests" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | C3CF796B1A009723009E47DA /* Debug */, 504 | C3CF796C1A009723009E47DA /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | /* End XCConfigurationList section */ 510 | }; 511 | rootObject = C3CF79331A009723009E47DA /* Project object */; 512 | } 513 | --------------------------------------------------------------------------------