├── .gitignore ├── Bounce Icon ├── Bounce Icon.xcodeproj │ └── project.pbxproj └── Bounce Icon │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Bounce Icon-Info.plist │ ├── Bounce Icon-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── Custom Menu ├── Custom Menu.xcodeproj │ └── project.pbxproj └── Custom Menu │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Custom Menu-Info.plist │ ├── Custom Menu-Prefix.pch │ ├── NSImage+RoundCorner.h │ ├── NSImage+RoundCorner.m │ ├── avatars │ ├── avatar_small_1.bmp │ ├── avatar_small_1_h.png │ ├── avatar_small_2.bmp │ ├── avatar_small_2_h.png │ ├── avatar_small_3.bmp │ ├── avatar_small_3_h.png │ ├── avatar_small_4.bmp │ ├── avatar_small_4_h.png │ ├── avatar_small_5.bmp │ ├── avatar_small_5_h.png │ ├── avatar_small_6.bmp │ ├── avatar_small_6_h.png │ ├── avatar_small_7.bmp │ ├── avatar_small_7_h.png │ ├── avatar_small_8.bmp │ └── avatar_small_8_h.png │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── Custom NavBar ├── Custom NavBar.xcodeproj │ └── project.pbxproj └── Custom NavBar │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Custom NavBar-Info.plist │ ├── Custom NavBar-Prefix.pch │ ├── DetailViewController.h │ ├── DetailViewController.m │ ├── MasterViewController.h │ ├── MasterViewController.m │ ├── VCCustomNavigationBar.h │ ├── VCCustomNavigationBar.m │ ├── VCTranslucentBarButtonItem.h │ ├── VCTranslucentBarButtonItem.m │ ├── Window.xib │ ├── backwardbutton.png │ ├── backwardbutton@2x.png │ ├── backwardbutton_landscape.png │ ├── backwardbutton_landscape@2x.png │ ├── en.lproj │ ├── DetailViewController.xib │ ├── InfoPlist.strings │ └── MasterViewController.xib │ ├── forwardbutton.png │ ├── forwardbutton@2x.png │ ├── forwardbutton_landscape.png │ ├── forwardbutton_landscape@2x.png │ ├── landscapeBarBackground.png │ ├── landscapeBarBackground@2x.png │ ├── main.m │ ├── normalbutton.png │ ├── normalbutton@2x.png │ ├── normalbutton_landscape.png │ ├── normalbutton_landscape@2x.png │ ├── portraitBarBackground.png │ └── portraitBarBackground@2x.png ├── CustomURLScheme for iOS ├── CustomURLScheme for iOS.xcodeproj │ └── project.pbxproj └── CustomURLScheme for iOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── CustomURLScheme for iOS-Info.plist │ ├── CustomURLScheme for iOS-Prefix.pch │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── CustomURLScheme ├── CustomURLScheme.xcodeproj │ └── project.pbxproj └── CustomURLScheme │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── CustomURLScheme-Info.plist │ ├── CustomURLScheme-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── Dynamic Dock Icon ├── Dynamic Dock Icon.xcodeproj │ └── project.pbxproj └── Dynamic Dock Icon │ ├── Dynamic Dock Icon-Info.plist │ ├── Dynamic Dock Icon-Prefix.pch │ ├── Dynamic_Dock_IconAppDelegate.h │ ├── Dynamic_Dock_IconAppDelegate.m │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── FileExchange ├── FileExchange.xcodeproj │ └── project.pbxproj └── FileExchange │ ├── FileExchange-Info.plist │ ├── FileExchange-Prefix.pch │ ├── FileExchangeAppDelegate.h │ ├── FileExchangeAppDelegate.m │ ├── FileExchangeViewController.h │ ├── FileExchangeViewController.m │ ├── en.lproj │ ├── FileExchangeViewController.xib │ ├── InfoPlist.strings │ └── MainWindow.xib │ └── main.m ├── Growl Test ├── Growl Test.xcodeproj │ └── project.pbxproj ├── Growl Test │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Growl Registration Ticket.growlRegDict │ ├── Growl Test-Info.plist │ ├── Growl Test-Prefix.pch │ ├── Growl Test.entitlements │ ├── en.lproj │ │ ├── Credits.rtf │ │ ├── InfoPlist.strings │ │ └── MainMenu.xib │ └── main.m └── XPC Client │ ├── com.company.application.GNTPClientService.xpc │ └── Contents │ │ ├── Info.plist │ │ ├── MacOS │ │ └── com.company.application.GNTPClientService │ │ ├── Resources │ │ ├── GNTPClientService.entitlements │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ │ └── _CodeSignature │ │ └── CodeResources │ ├── me.venj.Growl-Test.GNTPClientService.xpc │ └── Contents │ │ ├── Info.plist │ │ ├── MacOS │ │ └── me.venj.Growl-Test.GNTPClientService │ │ ├── Resources │ │ ├── GNTPClientService.entitlements │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ │ └── _CodeSignature │ │ └── CodeResources │ └── xpc-rename-move.rb ├── GrowlTest ├── GrowlTest.xcodeproj │ └── project.pbxproj └── GrowlTest │ ├── Growl Registration Ticket.growlRegDict │ ├── GrowlTest-Info.plist │ ├── GrowlTest-Prefix.pch │ ├── GrowlTestAppDelegate.h │ ├── GrowlTestAppDelegate.m │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ ├── lame.jpg │ └── main.m ├── Local Splash ├── Local Splash.xcodeproj │ └── project.pbxproj └── Local Splash │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Icons │ └── en.lproj │ │ ├── Icon.png │ │ └── Icon@2x.png │ ├── Local Splash-Info.plist │ ├── Local Splash-Prefix.pch │ ├── en.lproj │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ └── InfoPlist.strings │ ├── main.m │ └── zh-Hans.lproj │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── Icon.png │ ├── Icon@2x.png │ └── InfoPlist.strings ├── Move It ├── Move It.xcodeproj │ └── project.pbxproj └── Move It │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Move It-Info.plist │ ├── Move It-Prefix.pch │ ├── NSString+SymlinksAndAliases.h │ ├── NSString+SymlinksAndAliases.m │ ├── PFMoveApplication.h │ ├── PFMoveApplication.m │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ ├── MainMenu.xib │ └── MoveApplication.strings │ ├── main.m │ └── zh-Hans.lproj │ └── MoveApplication.strings ├── MyTestApp ├── MyTestApp.xcodeproj │ └── project.pbxproj ├── MyTestApp │ ├── MySillyAdd.h │ ├── MySillyAdd.m │ ├── MyTestApp-Info.plist │ ├── MyTestApp-Prefix.pch │ ├── MyTestAppAppDelegate.h │ ├── MyTestAppAppDelegate.m │ ├── MyTestAppViewController.h │ ├── MyTestAppViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainWindow.xib │ │ └── MyTestAppViewController.xib │ └── main.m ├── MyTestAppApplicationTests │ ├── MyTestAppApplicationTests-Info.plist │ ├── MyTestAppApplicationTests-Prefix.pch │ ├── MyTestAppApplicationTests.h │ ├── MyTestAppApplicationTests.m │ └── en.lproj │ │ └── InfoPlist.strings └── MyTestAppLogicTests │ ├── MyTestAppLogicTests-Info.plist │ ├── MyTestAppLogicTests-Prefix.pch │ ├── MyTestAppLogicTests.h │ ├── MyTestAppLogicTests.m │ └── en.lproj │ └── InfoPlist.strings ├── NavStatusStyle ├── NavStatusStyle.xcodeproj │ └── project.pbxproj ├── NavStatusStyle │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── DetailViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ ├── MasterViewController.swift │ └── UINavigation+StatusBar.swift └── NavStatusStyleTests │ ├── Info.plist │ └── NavStatusStyleTests.swift ├── Paste Button ├── Paste Button.xcodeproj │ └── project.pbxproj └── Paste Button │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Paste Button-Info.plist │ ├── Paste Button-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── Play With Dock ├── Play With Dock.xcodeproj │ └── project.pbxproj └── Play With Dock │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── DockIconBadgeView.h │ ├── DockIconBadgeView.m │ ├── DockIconView.h │ ├── DockIconView.m │ ├── Icon.png │ ├── Play With Dock-Info.plist │ ├── Play With Dock-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ ├── main.m │ ├── qq.icns │ └── qqbadge.icns ├── README.markdown ├── RTF2HTML ├── RTF2HTML.xcodeproj │ └── project.pbxproj └── RTF2HTML │ ├── RTF2HTML-Info.plist │ ├── RTF2HTML-Prefix.pch │ ├── RTF2HTMLAppDelegate.h │ ├── RTF2HTMLAppDelegate.m │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── RefreshControl ├── RefreshControl.xcodeproj │ └── project.pbxproj └── RefreshControl │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── DetailViewController.h │ ├── DetailViewController.m │ ├── MasterViewController.h │ ├── MasterViewController.m │ ├── RefreshControl-Info.plist │ ├── RefreshControl-Prefix.pch │ ├── en.lproj │ ├── InfoPlist.strings │ └── MainStoryboard.storyboard │ └── main.m ├── Round Corner Image ├── Round Corner Image.xcodeproj │ └── project.pbxproj └── Round Corner Image │ ├── NSImage+RoundCorner.h │ ├── NSImage+RoundCorner.m │ ├── Round Corner Image-Info.plist │ ├── Round Corner Image-Prefix.pch │ ├── Round_Corner_ImageAppDelegate.h │ ├── Round_Corner_ImageAppDelegate.m │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ ├── image.jpg │ └── main.m ├── Screen Grab ├── Screen Grab.xcodeproj │ └── project.pbxproj └── Screen Grab │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Screen Grab-Info.plist │ ├── Screen Grab-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── TitleBar Addons ├── TitleBar Addons.xcodeproj │ └── project.pbxproj └── TitleBar Addons │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── TitleBar Addons-Info.plist │ ├── TitleBar Addons-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── TwiTable ├── TwiTable.xcodeproj │ └── project.pbxproj └── TwiTable │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── TwiTable-Info.plist │ ├── TwiTable-Prefix.pch │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── main.m ├── Whereami ├── Whereami.xcodeproj │ └── project.pbxproj └── Whereami │ ├── MapPoint.h │ ├── MapPoint.m │ ├── Whereami-Info.plist │ ├── Whereami-Prefix.pch │ ├── WhereamiAppDelegate.h │ ├── WhereamiAppDelegate.m │ ├── en.lproj │ ├── InfoPlist.strings │ └── MainWindow.xib │ └── main.m ├── WikiView ├── WikiView.xcodeproj │ └── project.pbxproj └── WikiView │ ├── BezelsView.h │ ├── BezelsView.m │ ├── SearchViewController.h │ ├── SearchViewController.m │ ├── SearchViewController.xib │ ├── WebViewController.h │ ├── WebViewController.m │ ├── WebViewController.xib │ ├── WikiView-Info.plist │ ├── WikiView-Prefix.pch │ ├── WikiViewAppDelegate.h │ ├── WikiViewAppDelegate.m │ ├── en.lproj │ ├── InfoPlist.strings │ └── MainWindow.xib │ └── main.m └── iPhoneCustomFont ├── iPhoneCustomFont.xcodeproj └── project.pbxproj └── iPhoneCustomFont ├── AppDelegate.h ├── AppDelegate.m ├── ViewController.h ├── ViewController.m ├── en.lproj ├── InfoPlist.strings └── MainStoryboard.storyboard ├── iPhoneCustomFont-Info.plist ├── iPhoneCustomFont-Prefix.pch └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | *.xcuserstate 6 | project.xcworkspace/ 7 | xcuserdata/ 8 | *.framework 9 | *.ttc -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Bounce Icon 4 | // 5 | // Created by 朱 文杰 on 12-3-1. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | - (IBAction)buttonOnceClicked:(id)sender; 15 | - (IBAction)buttonAlwaysClicked:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Bounce Icon 4 | // 5 | // Created by 朱 文杰 on 12-3-1. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | // Insert code here to initialize your application 18 | } 19 | 20 | - (IBAction)buttonOnceClicked:(id)sender { 21 | [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bounceOnce:) userInfo:nil repeats:NO]; 22 | } 23 | 24 | - (IBAction)buttonAlwaysClicked:(id)sender { 25 | [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bounceAlways:) userInfo:nil repeats:NO]; 26 | } 27 | 28 | - (void)bounceOnce:(id)sender { 29 | [NSApp requestUserAttention:NSInformationalRequest]; 30 | } 31 | 32 | - (void)bounceAlways:(id)sender { 33 | [NSApp requestUserAttention:NSCriticalRequest]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/Bounce Icon-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/Bounce Icon-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Bounce Icon' target in the 'Bounce Icon' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Bounce Icon/Bounce Icon/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Bounce Icon 4 | // 5 | // Created by 朱 文杰 on 12-3-1. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Custom Menu 4 | // 5 | // Created by 朱 文杰 on 12-3-24. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | @property (weak) IBOutlet NSMenu *attachedMenu; 15 | @property (strong) NSMenuItem *myMenuItem; 16 | @property (weak) IBOutlet NSButton *menuButton; 17 | @property (strong) NSView *menuView; 18 | - (IBAction)showMenu:(id)sender; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/Custom Menu-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/Custom Menu-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Custom Menu' target in the 'Custom Menu' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/NSImage+RoundCorner.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+RoundCorner.h 3 | // Custom Menu 4 | // 5 | // Created by 朱 文杰 on 12-3-25. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | /* NSImage+RoundCorner.h */ 10 | #import 11 | /* C Prototypes */ 12 | void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight); 13 | 14 | @interface NSImage(RoundCorner) 15 | - (NSImage *)roundCornersImageCornerRadius:(NSInteger)radius; 16 | @end 17 | 18 | 19 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/NSImage+RoundCorner.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+RoundCorner.m 3 | // Custom Menu 4 | // 5 | // Created by 朱 文杰 on 12-3-25. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | /* NSImage+RoundCorner.m */ 10 | #import "NSImage+RoundCorner.h" 11 | 12 | @implementation NSImage (RoundCorner) 13 | 14 | void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) 15 | { 16 | float fw, fh; 17 | if (ovalWidth == 0 || ovalHeight == 0) { 18 | CGContextAddRect(context, rect); 19 | return; 20 | } 21 | CGContextSaveGState(context); 22 | CGContextTranslateCTM (context, CGRectGetMinX(rect), CGRectGetMinY(rect)); 23 | CGContextScaleCTM (context, ovalWidth, ovalHeight); 24 | fw = CGRectGetWidth (rect) / ovalWidth; 25 | fh = CGRectGetHeight (rect) / ovalHeight; 26 | CGContextMoveToPoint(context, fw, fh/2); 27 | CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); 28 | CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); 29 | CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); 30 | CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); 31 | CGContextClosePath(context); 32 | CGContextRestoreGState(context); 33 | } 34 | 35 | - (NSImage *)roundCornersImageCornerRadius:(NSInteger)radius { 36 | int w = (int) self.size.width; 37 | int h = (int) self.size.height; 38 | 39 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 40 | CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); 41 | 42 | CGContextBeginPath(context); 43 | CGRect rect = CGRectMake(0, 0, w, h); 44 | addRoundedRectToPath(context, rect, radius, radius); 45 | CGContextClosePath(context); 46 | CGContextClip(context); 47 | 48 | CGImageRef cgImage = [[NSBitmapImageRep imageRepWithData:[self TIFFRepresentation]] CGImage]; 49 | 50 | CGContextDrawImage(context, CGRectMake(0, 0, w, h), cgImage); 51 | 52 | CGImageRef imageMasked = CGBitmapContextCreateImage(context); 53 | CGContextRelease(context); 54 | CGColorSpaceRelease(colorSpace); 55 | 56 | NSImage *tmpImage = [[NSImage alloc] initWithCGImage:imageMasked size:self.size]; 57 | NSData *imageData = [tmpImage TIFFRepresentation]; 58 | NSImage *image = [[NSImage alloc] initWithData:imageData]; 59 | 60 | return image; 61 | } 62 | @end -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_1.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_1_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_1_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_2.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_2_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_2_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_3.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_3_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_3_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_4.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_4_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_4_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_5.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_5.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_5_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_5_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_6.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_6.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_6_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_6_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_7.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_7.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_7_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_7_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_8.bmp -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/avatars/avatar_small_8_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom Menu/Custom Menu/avatars/avatar_small_8_h.png -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Custom Menu/Custom Menu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Custom Menu 4 | // 5 | // Created by 朱 文杰 on 12-3-24. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) IBOutlet UIWindow *window; 14 | 15 | @property (strong, nonatomic) IBOutlet UINavigationController *navigationController; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "MasterViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize navigationController = _navigationController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | [self.window makeKeyAndVisible]; 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // 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. 27 | // 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. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/Custom NavBar-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | me.venj.${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 | NSMainNibFile 28 | Window 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIStatusBarStyle 40 | UIStatusBarStyleBlackOpaque 41 | 42 | 43 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/Custom NavBar-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Custom NavBar' target in the 'Custom NavBar' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/DetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.h 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DetailViewController : UIViewController 12 | 13 | @property (strong, nonatomic) id detailItem; 14 | 15 | @property (strong, nonatomic) IBOutlet UILabel *detailDescriptionLabel; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/DetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.m 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "DetailViewController.h" 10 | #import "VCTranslucentBarButtonItem.h" 11 | 12 | @interface DetailViewController () 13 | - (void)configureView; 14 | @end 15 | 16 | @implementation DetailViewController 17 | 18 | @synthesize detailItem = _detailItem; 19 | @synthesize detailDescriptionLabel = _detailDescriptionLabel; 20 | 21 | #pragma mark - Managing the detail item 22 | 23 | - (void)setDetailItem:(id)newDetailItem 24 | { 25 | if (_detailItem != newDetailItem) { 26 | _detailItem = newDetailItem; 27 | 28 | // Update the view. 29 | [self configureView]; 30 | } 31 | } 32 | 33 | - (void)configureView 34 | { 35 | // Update the user interface for the detail item. 36 | 37 | if (self.detailItem) { 38 | self.detailDescriptionLabel.text = [self.detailItem description]; 39 | } 40 | 41 | VCTranslucentBarButtonItem *item = [[VCTranslucentBarButtonItem alloc] initWithType:VCTranslucentBarButtonItemTypeBackward title:@"Test Button" target:self action:@selector(buttonClicked)]; 42 | self.navigationItem.leftBarButtonItem = item; 43 | 44 | } 45 | 46 | - (void)buttonClicked { 47 | [self.navigationController popViewControllerAnimated:YES]; 48 | } 49 | 50 | - (void)viewDidLoad 51 | { 52 | [super viewDidLoad]; 53 | // Do any additional setup after loading the view, typically from a nib. 54 | [self configureView]; 55 | } 56 | 57 | - (void)viewDidUnload 58 | { 59 | [super viewDidUnload]; 60 | // Release any retained subviews of the main view. 61 | self.detailDescriptionLabel = nil; 62 | } 63 | 64 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 65 | { 66 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 67 | } 68 | 69 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 70 | { 71 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 72 | if (self) { 73 | self.title = NSLocalizedString(@"Detail", @"Detail"); 74 | } 75 | return self; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/MasterViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.h 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DetailViewController; 12 | 13 | @interface MasterViewController : UITableViewController 14 | 15 | @property (strong, nonatomic) DetailViewController *detailViewController; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/VCCustomNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // VCCustomNavigationBar.h 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface VCCustomNavigationBar : UINavigationBar 12 | @property (nonatomic, strong) UIImageView *navigationBarBackgroundImage; 13 | @property (nonatomic, strong) UIImage *landscapeBarBackground; 14 | @property (nonatomic, strong) UIImage *portraitBarBackground; 15 | - (void)setBackgroundForDeviceOrientation:(UIDeviceOrientation)orientation; 16 | - (void)clearBackground; 17 | @end 18 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/VCCustomNavigationBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // VCCustomNavigationBar.m 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "VCCustomNavigationBar.h" 10 | 11 | @implementation VCCustomNavigationBar 12 | @synthesize navigationBarBackgroundImage = _navigationBarBackgroundImage; 13 | @synthesize landscapeBarBackground = _landscapeBarBackground; 14 | @synthesize portraitBarBackground = _portraitBarBackground; 15 | 16 | - (id)initWithFrame:(CGRect)frame 17 | { 18 | self = [super initWithFrame:frame]; 19 | if (self) { 20 | // Initialization code 21 | } 22 | return self; 23 | } 24 | 25 | - (void)awakeFromNib { 26 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeBackgroundImage:) name:UIDeviceOrientationDidChangeNotification object:NULL]; 27 | } 28 | 29 | - (void)drawRect:(CGRect)rect 30 | { 31 | if (self.navigationBarBackgroundImage) 32 | [self.navigationBarBackgroundImage.image drawInRect:rect]; 33 | else 34 | [super drawRect:rect]; 35 | } 36 | 37 | - (void)setBackgroundForDeviceOrientation:(UIDeviceOrientation)orientation; 38 | { 39 | self.navigationBarBackgroundImage = [[UIImageView alloc] initWithFrame:self.frame]; 40 | if ((orientation == UIDeviceOrientationLandscapeLeft) 41 | || (orientation == UIDeviceOrientationLandscapeRight)) { 42 | self.navigationBarBackgroundImage.image = self.landscapeBarBackground; 43 | } 44 | else if (orientation == UIDeviceOrientationPortrait) { 45 | self.navigationBarBackgroundImage.image = self.portraitBarBackground; 46 | } 47 | [self setNeedsDisplay]; 48 | } 49 | 50 | - (void)clearBackground 51 | { 52 | self.navigationBarBackgroundImage = nil; 53 | [self setNeedsDisplay]; 54 | } 55 | 56 | - (void)dealloc { 57 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 58 | } 59 | 60 | - (void)changeBackgroundImage:(NSNotification *)notification { 61 | UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation]; 62 | if ((currentOrientation == UIDeviceOrientationPortraitUpsideDown) 63 | || (currentOrientation == UIDeviceOrientationFaceUp) 64 | || (currentOrientation == UIDeviceOrientationFaceDown) 65 | || (currentOrientation == UIDeviceOrientationUnknown)) { 66 | return; 67 | } 68 | [self setBackgroundForDeviceOrientation:currentOrientation]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/VCTranslucentBarButtonItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // VCTranslucentBarButtonItem.h 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | VCTranslucentBarButtonItemTypeForward = 0, 13 | VCTranslucentBarButtonItemTypeNormal, 14 | VCTranslucentBarButtonItemTypeBackward 15 | } VCTranslucentBarButtonItemType; 16 | 17 | @interface VCTranslucentBarButtonItem : UIBarButtonItem 18 | @property (nonatomic, assign) VCTranslucentBarButtonItemType type; 19 | 20 | - (id)initWithType:(VCTranslucentBarButtonItemType)theType title:(NSString *)title target:(id)target action:(SEL)action; 21 | @end 22 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/backwardbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/backwardbutton.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/backwardbutton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/backwardbutton@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/backwardbutton_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/backwardbutton_landscape.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/backwardbutton_landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/backwardbutton_landscape@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/forwardbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/forwardbutton.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/forwardbutton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/forwardbutton@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/forwardbutton_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/forwardbutton_landscape.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/forwardbutton_landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/forwardbutton_landscape@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/landscapeBarBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/landscapeBarBackground.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/landscapeBarBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/landscapeBarBackground@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Custom NavBar 4 | // 5 | // Created by 朱 文杰 on 12-2-29. 6 | // Copyright (c) 2012年 Home. 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, nil); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/normalbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/normalbutton.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/normalbutton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/normalbutton@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/normalbutton_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/normalbutton_landscape.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/normalbutton_landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/normalbutton_landscape@2x.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/portraitBarBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/portraitBarBackground.png -------------------------------------------------------------------------------- /Custom NavBar/Custom NavBar/portraitBarBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Custom NavBar/Custom NavBar/portraitBarBackground@2x.png -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CustomURLScheme for iOS 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CustomURLScheme for iOS 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | // Override point for customization after application launch. 19 | self.window.backgroundColor = [UIColor whiteColor]; 20 | [self.window makeKeyAndVisible]; 21 | return YES; 22 | } 23 | 24 | /* For iOS 4.1 and before 25 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { 26 | // Handle url request. 27 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL Request" message:[url absoluteString] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 28 | [alert show]; 29 | 30 | return YES; 31 | } 32 | */ 33 | 34 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 35 | // Handle url request. 36 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL Request" message:[url absoluteString] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 37 | [alert show]; 38 | 39 | return YES; 40 | } 41 | 42 | - (void)applicationWillResignActive:(UIApplication *)application 43 | { 44 | /* 45 | 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. 46 | 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. 47 | */ 48 | } 49 | 50 | - (void)applicationDidEnterBackground:(UIApplication *)application 51 | { 52 | /* 53 | 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. 54 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 55 | */ 56 | } 57 | 58 | - (void)applicationWillEnterForeground:(UIApplication *)application 59 | { 60 | /* 61 | 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. 62 | */ 63 | } 64 | 65 | - (void)applicationDidBecomeActive:(UIApplication *)application 66 | { 67 | /* 68 | 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. 69 | */ 70 | } 71 | 72 | - (void)applicationWillTerminate:(UIApplication *)application 73 | { 74 | /* 75 | Called when the application is about to terminate. 76 | Save data if appropriate. 77 | See also applicationDidEnterBackground:. 78 | */ 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/CustomURLScheme for iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | CFBundleURLTypes 40 | 41 | 42 | CFBundleURLName 43 | me.venj.myapp-ios 44 | CFBundleURLSchemes 45 | 46 | cloud 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/CustomURLScheme for iOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CustomURLScheme for iOS' target in the 'CustomURLScheme for iOS' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CustomURLScheme for iOS/CustomURLScheme for iOS/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CustomURLScheme for iOS 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. 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 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CustomURLScheme 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CustomURLScheme 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | // Insert code here to initialize your application 18 | [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; 19 | } 20 | 21 | - (void)handleURLEvent:(NSAppleEventDescriptor*)theEvent withReplyEvent:(NSAppleEventDescriptor*)replyEvent { 22 | NSString* path = [[theEvent paramDescriptorForKeyword:keyDirectObject] stringValue]; 23 | 24 | [[NSAlert alertWithMessageText:@"URL Request" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", path] runModal]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/CustomURLScheme-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | CFBundleURLTypes 34 | 35 | 36 | CFBundleURLSchemes 37 | 38 | cloud 39 | 40 | CFBundleURLName 41 | me.venj.myapp 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/CustomURLScheme-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CustomURLScheme' target in the 'CustomURLScheme' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CustomURLScheme/CustomURLScheme/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CustomURLScheme 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/Dynamic Dock Icon-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | LSUIElement 28 | 29 | NSHumanReadableCopyright 30 | Copyright © 2011年 Home. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/Dynamic Dock Icon-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Dynamic Dock Icon' target in the 'Dynamic Dock Icon' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/Dynamic_Dock_IconAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Dynamic_Dock_IconAppDelegate.h 3 | // Dynamic Dock Icon 4 | // 5 | // Created by Venj Chu on 11/08/06. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Dynamic_Dock_IconAppDelegate : NSObject { 12 | NSWindow *_window; 13 | NSButton *dockIconSelector; 14 | NSTextField *infoText; 15 | NSStatusItem *trayItem; 16 | NSUserDefaults *defaults; 17 | } 18 | 19 | @property (strong) IBOutlet NSWindow *window; 20 | @property (strong) IBOutlet NSButton *dockIconSelector; 21 | @property (strong) IBOutlet NSTextField *infoText; 22 | 23 | - (IBAction)toggleDockIcon:(id)sender; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/Dynamic_Dock_IconAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // Dynamic_Dock_IconAppDelegate.m 3 | // Dynamic Dock Icon 4 | // 5 | // Created by Venj Chu on 11/08/06. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "Dynamic_Dock_IconAppDelegate.h" 10 | static NSString *kShowDockIcon = @"ShowDockIcon"; 11 | 12 | @implementation Dynamic_Dock_IconAppDelegate 13 | 14 | @synthesize window = _window; 15 | @synthesize dockIconSelector; 16 | @synthesize infoText; 17 | 18 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 19 | { 20 | // Insert code here to initialize your application 21 | 22 | // Set Dock status 23 | defaults = [NSUserDefaults standardUserDefaults]; 24 | BOOL iconInDock = [[NSUserDefaults standardUserDefaults] boolForKey:kShowDockIcon]; 25 | 26 | if (iconInDock) { 27 | ProcessSerialNumber psn = { 0, kCurrentProcess }; 28 | TransformProcessType(&psn, kProcessTransformToForegroundApplication); 29 | [self.dockIconSelector setState:NSOnState]; 30 | } 31 | else { 32 | [self.dockIconSelector setState:NSOffState]; 33 | } 34 | 35 | NSZone *zone = [NSMenu menuZone]; 36 | NSMenu *menu = [[NSMenu allocWithZone:zone] init]; 37 | NSMenuItem *item; 38 | 39 | item = [menu addItemWithTitle:@"Testing" action:@selector(testAction:) keyEquivalent:@""]; 40 | [item setTarget:self]; 41 | 42 | item = [menu addItemWithTitle:@"Quit" action:@selector(quitAction:) keyEquivalent:@""]; 43 | [item setTarget:self]; 44 | 45 | trayItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; 46 | [trayItem setMenu:menu]; 47 | [trayItem setHighlightMode:YES]; 48 | [trayItem setTitle:@"M"]; 49 | } 50 | 51 | - (IBAction)testAction:(id)sender; 52 | { 53 | NSAlert *alert = [NSAlert alertWithMessageText:@"Hello world!" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Hello world from menulet."]; 54 | [alert runModal]; 55 | } 56 | 57 | - (IBAction)quitAction:(id)sender; 58 | { 59 | [NSApp terminate:sender]; 60 | } 61 | 62 | - (IBAction)toggleDockIcon:(id)sender { 63 | NSUInteger state = [sender state]; 64 | 65 | if (state == NSOnState) { 66 | ProcessSerialNumber psn = { 0, kCurrentProcess }; 67 | TransformProcessType(&psn, kProcessTransformToForegroundApplication); 68 | self.infoText.hidden = YES; 69 | 70 | [defaults setBool:YES forKey:kShowDockIcon]; 71 | [defaults synchronize]; 72 | } 73 | else { 74 | [defaults setBool:NO forKey:kShowDockIcon]; 75 | self.infoText.hidden = NO; 76 | [defaults synchronize]; 77 | } 78 | } 79 | @end 80 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Dynamic Dock Icon/Dynamic Dock Icon/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Dynamic Dock Icon 4 | // 5 | // Created by Venj Chu on 11/08/06. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchange-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIFileSharingEnabled 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchange-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FileExchange' target in the 'FileExchange' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchangeAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // FileExchangeAppDelegate.h 3 | // FileExchange 4 | // 5 | // Created by Venj Chu on 11/08/07. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FileExchangeViewController; 12 | 13 | @interface FileExchangeAppDelegate : NSObject 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @property (nonatomic, retain) IBOutlet FileExchangeViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchangeAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // FileExchangeAppDelegate.m 3 | // FileExchange 4 | // 5 | // Created by Venj Chu on 11/08/07. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "FileExchangeAppDelegate.h" 10 | 11 | #import "FileExchangeViewController.h" 12 | 13 | @implementation FileExchangeAppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | // Override point for customization after application launch. 21 | 22 | self.window.rootViewController = self.viewController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | /* 30 | 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. 31 | 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. 32 | */ 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application 36 | { 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 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application 44 | { 45 | /* 46 | 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. 47 | */ 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | /* 53 | 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. 54 | */ 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application 58 | { 59 | /* 60 | Called when the application is about to terminate. 61 | Save data if appropriate. 62 | See also applicationDidEnterBackground:. 63 | */ 64 | } 65 | 66 | - (void)dealloc 67 | { 68 | [_window release]; 69 | [_viewController release]; 70 | [super dealloc]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchangeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FileExchangeViewController.h 3 | // FileExchange 4 | // 5 | // Created by Venj Chu on 11/08/07. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FileExchangeViewController : UIViewController { 12 | UILabel *statusMessage; 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UILabel *statusMessage; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/FileExchangeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FileExchangeViewController.m 3 | // FileExchange 4 | // 5 | // Created by Venj Chu on 11/08/07. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "FileExchangeViewController.h" 10 | 11 | @implementation FileExchangeViewController 12 | @synthesize statusMessage; 13 | 14 | - (void)didReceiveMemoryWarning 15 | { 16 | // Releases the view if it doesn't have a superview. 17 | [super didReceiveMemoryWarning]; 18 | 19 | // Release any cached data, images, etc that aren't in use. 20 | } 21 | 22 | #pragma mark - View lifecycle 23 | 24 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 25 | - (void)viewDidLoad 26 | { 27 | [super viewDidLoad]; 28 | //NSLog(@"%@", NSHomeDirectory()); 29 | 30 | NSFileManager *manager = [NSFileManager defaultManager]; 31 | 32 | NSString *dbPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"db.sqlite"]; 33 | 34 | if ([manager fileExistsAtPath:dbPath]) { 35 | self.statusMessage.text = @"Ready To Go"; 36 | } 37 | else { 38 | self.statusMessage.text = @"No DB File"; 39 | } 40 | } 41 | 42 | 43 | - (void)viewDidUnload 44 | { 45 | [self setStatusMessage:nil]; 46 | [super viewDidUnload]; 47 | // Release any retained subviews of the main view. 48 | // e.g. self.myOutlet = nil; 49 | } 50 | 51 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 52 | { 53 | // Return YES for supported orientations 54 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 55 | } 56 | 57 | - (void)dealloc { 58 | [statusMessage release]; 59 | [super dealloc]; 60 | } 61 | @end 62 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FileExchange/FileExchange/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FileExchange 4 | // 5 | // Created by Venj Chu on 11/08/07. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Growl Test 4 | // 5 | // Created by 朱 文杰 on 12-3-7. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Growl/Growl.h" 11 | 12 | @interface AppDelegate : NSObject 13 | 14 | @property (assign) IBOutlet NSWindow *window; 15 | - (IBAction)postGrowl:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Growl Test 4 | // 5 | // Created by 朱 文杰 on 12-3-7. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | // Insert code here to initialize your application 18 | [GrowlApplicationBridge setGrowlDelegate:self]; 19 | } 20 | 21 | - (BOOL) hasNetworkClientEntitlement { 22 | return NO; 23 | } 24 | 25 | - (IBAction)postGrowl:(id)sender { 26 | [GrowlApplicationBridge 27 | notifyWithTitle:@"Sandboxed!" 28 | description:@"This notification is sent from a sandboxed app." 29 | notificationName:@"GTApplicationNotification" 30 | iconData:nil 31 | priority:0 32 | isSticky:YES 33 | clickContext:nil]; 34 | } 35 | @end 36 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/Growl Registration Ticket.growlRegDict: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TicketVersion 6 | 1 7 | AllNotifications 8 | 9 | GTApplicationNotification 10 | 11 | DefaultNotifications 12 | 13 | GTApplicationNotification 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/Growl Test-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/Growl Test-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Growl Test' target in the 'Growl Test' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/Growl Test.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Growl Test/Growl Test/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Growl Test 4 | // 5 | // Created by 朱 文杰 on 12-3-7. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 11C74 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | com.company.application.GNTPClientService 11 | CFBundleIdentifier 12 | com.company.application.GNTPClientService 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | com.company.application.GNTPClientService 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.3.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.3.1 25 | DTCompiler 26 | com.apple.compilers.llvm.clang.1_0 27 | DTPlatformBuild 28 | 4D199 29 | DTPlatformVersion 30 | GM 31 | DTSDKBuild 32 | 11C63 33 | DTSDKName 34 | macosx10.7 35 | DTXcode 36 | 0420 37 | DTXcodeBuild 38 | 4D199 39 | NSHumanReadableCopyright 40 | Copyright © 2011 The Growl Team. All rights reserved. 41 | XPCService 42 | 43 | ServiceType 44 | Application 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/MacOS/com.company.application.GNTPClientService: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/MacOS/com.company.application.GNTPClientService -------------------------------------------------------------------------------- /Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/Resources/GNTPClientService.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Growl Test/XPC Client/com.company.application.GNTPClientService.xpc/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/GNTPClientService.entitlements 8 | 9 | 8+EEBoWA3eHIZrtJp4fHsRr4HJo= 10 | 11 | Resources/en.lproj/InfoPlist.strings 12 | 13 | hash 14 | 15 | MiLKDDnrUKr4EmuvhS5VQwxHGK8= 16 | 17 | optional 18 | 19 | 20 | 21 | rules 22 | 23 | ^Resources/ 24 | 25 | ^Resources/.*\.lproj/ 26 | 27 | optional 28 | 29 | weight 30 | 1000 31 | 32 | ^Resources/.*\.lproj/locversion.plist$ 33 | 34 | omit 35 | 36 | weight 37 | 1100 38 | 39 | ^version.plist$ 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 11C74 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | me.venj.Growl-Test.GNTPClientService 11 | CFBundleIdentifier 12 | me.venj.Growl-Test.GNTPClientService 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | me.venj.Growl-Test.GNTPClientService 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.3.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.3.1 25 | DTCompiler 26 | com.apple.compilers.llvm.clang.1_0 27 | DTPlatformBuild 28 | 4D199 29 | DTPlatformVersion 30 | GM 31 | DTSDKBuild 32 | 11C63 33 | DTSDKName 34 | macosx10.7 35 | DTXcode 36 | 0420 37 | DTXcodeBuild 38 | 4D199 39 | NSHumanReadableCopyright 40 | Copyright © 2011 The Growl Team. All rights reserved. 41 | XPCService 42 | 43 | ServiceType 44 | Application 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/MacOS/me.venj.Growl-Test.GNTPClientService: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/MacOS/me.venj.Growl-Test.GNTPClientService -------------------------------------------------------------------------------- /Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/Resources/GNTPClientService.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Growl Test/XPC Client/me.venj.Growl-Test.GNTPClientService.xpc/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/GNTPClientService.entitlements 8 | 9 | 8+EEBoWA3eHIZrtJp4fHsRr4HJo= 10 | 11 | Resources/en.lproj/InfoPlist.strings 12 | 13 | hash 14 | 15 | MiLKDDnrUKr4EmuvhS5VQwxHGK8= 16 | 17 | optional 18 | 19 | 20 | 21 | rules 22 | 23 | ^Resources/ 24 | 25 | ^Resources/.*\.lproj/ 26 | 27 | optional 28 | 29 | weight 30 | 1000 31 | 32 | ^Resources/.*\.lproj/locversion.plist$ 33 | 34 | omit 35 | 36 | weight 37 | 1100 38 | 39 | ^version.plist$ 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/Growl Registration Ticket.growlRegDict: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TicketVersion 6 | 1 7 | AllNotifications 8 | 9 | myNotification 10 | myNote 11 | notDefaultNote 12 | 13 | DefaultNotifications 14 | 15 | myNotification 16 | myNote 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/GrowlTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/GrowlTest-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GrowlTest' target in the 'GrowlTest' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/GrowlTestAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlTestAppDelegate.h 3 | // GrowlTest 4 | // 5 | // Created by Chu Venj on 11-5-26. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Growl-WithInstaller/Growl.h" 11 | 12 | @interface GrowlTestAppDelegate : NSObject { 13 | @private 14 | NSWindow *window; 15 | } 16 | 17 | @property (assign) IBOutlet NSWindow *window; 18 | - (IBAction)showGrowl:(id)sender; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/GrowlTestAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlTestAppDelegate.m 3 | // GrowlTest 4 | // 5 | // Created by Chu Venj on 11-5-26. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "GrowlTestAppDelegate.h" 10 | 11 | @implementation GrowlTestAppDelegate 12 | 13 | @synthesize window; 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | // Insert code here to initialize your application 18 | [GrowlApplicationBridge setGrowlDelegate:self]; 19 | if (![GrowlApplicationBridge isGrowlInstalled]) { 20 | NSLog(@"not installed"); 21 | } 22 | } 23 | 24 | - (IBAction)showGrowl:(id)sender { 25 | [GrowlApplicationBridge notifyWithTitle:@"The Title" description:@"This is a notification description." notificationName:@"myNote" iconData:nil priority:0 isSticky:NO clickContext:@"God"]; 26 | } 27 | 28 | # pragma mark - Growl Delegate 29 | 30 | //- (NSDictionary *)registrationDictionaryForGrowl { 31 | // NSArray *allNotes = [NSArray arrayWithObjects:@"myNotification", @"myNote", @"notDefaultNote", nil]; 32 | // NSArray *defaultNotes = [NSArray arrayWithObjects:@"myNotification", @"myNote", nil]; 33 | // 34 | // return [NSDictionary dictionaryWithObjectsAndKeys:allNotes, GROWL_NOTIFICATIONS_ALL, defaultNotes, GROWL_NOTIFICATIONS_DEFAULT, nil]; 35 | //} 36 | 37 | - (void) growlIsReady { 38 | NSLog(@"Growl is up and running."); 39 | [self showGrowl:nil]; 40 | } 41 | 42 | - (void) growlNotificationTimedOut:(id)clickContext { 43 | NSLog(@"%@, I'm disappearing...", clickContext); 44 | } 45 | 46 | - (void) growlNotificationWasClicked:(id)clickContext { 47 | NSLog(@"%@, I'm clicked...", clickContext); 48 | } 49 | 50 | - (NSData *) applicationIconDataForGrowl { 51 | NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"lame"]]; 52 | return data; 53 | } 54 | 55 | - (NSString *) applicationNameForGrowl { 56 | return @"GrowlAppTest"; 57 | } 58 | 59 | # pragma mark - Growl Installer Delegate 60 | 61 | - (NSString *)growlInstallationWindowTitle { 62 | return @"Install Growl"; 63 | } 64 | 65 | - (NSString *)growlUpdateWindowTitle { 66 | return @"Update Growl"; 67 | } 68 | 69 | //- (NSAttributedString *)growlInstallationInformation { 70 | // // Some inplementation 71 | //} 72 | // 73 | //- (NSAttributedString *)growlUpdateInformation { 74 | // // Some inplementation 75 | //} 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/lame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/GrowlTest/GrowlTest/lame.jpg -------------------------------------------------------------------------------- /GrowlTest/GrowlTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GrowlTest 4 | // 5 | // Created by Chu Venj on 11-5-26. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Local Splash 4 | // 5 | // Created by venj on 13-3-8. 6 | // Copyright (c) 2013年 venj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Local Splash 4 | // 5 | // Created by venj on 13-3-8. 6 | // Copyright (c) 2013年 venj. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | // Override point for customization after application launch. 17 | self.window.backgroundColor = [UIColor whiteColor]; 18 | [self.window makeKeyAndVisible]; 19 | sleep(2); 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application 24 | { 25 | // 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. 26 | // 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. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application 30 | { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | - (void)applicationWillEnterForeground:(UIApplication *)application 36 | { 37 | // 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. 38 | } 39 | 40 | - (void)applicationDidBecomeActive:(UIApplication *)application 41 | { 42 | // 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. 43 | } 44 | 45 | - (void)applicationWillTerminate:(UIApplication *)application 46 | { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/Icons/en.lproj/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/Icons/en.lproj/Icon.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/Icons/en.lproj/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/Icons/en.lproj/Icon@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/Local Splash-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | me.venj.${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 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/Local Splash-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Local Splash' target in the 'Local Splash' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/en.lproj/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/en.lproj/Default-568h@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/en.lproj/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/en.lproj/Default.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/en.lproj/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/en.lproj/Default@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Local Splash 4 | // 5 | // Created by venj on 13-3-8. 6 | // Copyright (c) 2013年 venj. 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 | -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/zh-Hans.lproj/Default-568h@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/zh-Hans.lproj/Default.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/zh-Hans.lproj/Default@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/zh-Hans.lproj/Icon.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Local Splash/Local Splash/zh-Hans.lproj/Icon@2x.png -------------------------------------------------------------------------------- /Local Splash/Local Splash/zh-Hans.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Move It/Move It/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Move It 4 | // 5 | // Created by Venj Chu on 11/09/10. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Move It/Move It/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Move It 4 | // 5 | // Created by Venj Chu on 11/09/10. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "PFMoveApplication.h" 11 | 12 | @implementation AppDelegate 13 | 14 | @synthesize window = _window; 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 22 | { 23 | // Insert code here to initialize your application 24 | PFMoveToApplicationsFolderIfNecessary(); 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Move It/Move It/Move It-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Move It/Move It/Move It-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Move It' target in the 'Move It' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Move It/Move It/NSString+SymlinksAndAliases.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+SymlinksAndAliases.h 3 | // ResolvePath 4 | // 5 | // Created by Matt Gallagher on 2010/02/22. 6 | // Copyright 2010 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import 16 | 17 | @interface NSString (SymlinksAndAliases) 18 | 19 | - (NSString *)stringByResolvingSymlinksAndAliases; 20 | - (NSString *)stringByIterativelyResolvingSymlinkOrAlias; 21 | 22 | - (NSString *)stringByResolvingSymlink; 23 | - (NSString *)stringByConditionallyResolvingSymlink; 24 | 25 | - (NSString *)stringByResolvingAlias; 26 | - (NSString *)stringByConditionallyResolvingAlias; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Move It/Move It/PFMoveApplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFMoveApplication.h, version 1.6.2 3 | // LetsMove 4 | // 5 | // Created by Andy Kim at Potion Factory LLC on 9/17/09 6 | // 7 | // The contents of this file are dedicated to the public domain. 8 | 9 | #import 10 | 11 | void PFMoveToApplicationsFolderIfNecessary(); 12 | -------------------------------------------------------------------------------- /Move It/Move It/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Move It/Move It/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Move It/Move It/en.lproj/MoveApplication.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Move It/Move It/en.lproj/MoveApplication.strings -------------------------------------------------------------------------------- /Move It/Move It/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Move It 4 | // 5 | // Created by Venj Chu on 11/09/10. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Move It/Move It/zh-Hans.lproj/MoveApplication.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Move It/Move It/zh-Hans.lproj/MoveApplication.strings -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MySillyAdd.h: -------------------------------------------------------------------------------- 1 | // 2 | // MySillyAdd.h 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MySillyAdd : NSObject 12 | @property (assign) NSInteger numberA; 13 | @property (assign) NSInteger numberB; 14 | 15 | - (NSInteger)addNumberA:(NSInteger)theNumberA ToNumberB:(NSInteger)theNumberB; 16 | @end 17 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MySillyAdd.m: -------------------------------------------------------------------------------- 1 | // 2 | // MySillyAdd.m 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "MySillyAdd.h" 10 | 11 | @implementation MySillyAdd 12 | @synthesize numberA = _numberA; 13 | @synthesize numberB = _numberB; 14 | 15 | - (id)init 16 | { 17 | self = [super init]; 18 | if (self) { 19 | // Initialization code here. 20 | } 21 | 22 | return self; 23 | } 24 | 25 | - (NSInteger)addNumberA:(NSInteger)theNumberA ToNumberB:(NSInteger)theNumberB { 26 | return theNumberA + theNumberB; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestApp-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MyTestApp' target in the 'MyTestApp' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestAppAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppAppDelegate.h 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MyTestAppViewController; 12 | 13 | @interface MyTestAppAppDelegate : NSObject 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @property (nonatomic, retain) IBOutlet MyTestAppViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestAppAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppAppDelegate.m 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "MyTestAppAppDelegate.h" 10 | 11 | #import "MyTestAppViewController.h" 12 | 13 | @implementation MyTestAppAppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | // Override point for customization after application launch. 21 | 22 | self.window.rootViewController = self.viewController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | /* 30 | 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. 31 | 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. 32 | */ 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application 36 | { 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 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application 44 | { 45 | /* 46 | 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. 47 | */ 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | /* 53 | 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. 54 | */ 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application 58 | { 59 | /* 60 | Called when the application is about to terminate. 61 | Save data if appropriate. 62 | See also applicationDidEnterBackground:. 63 | */ 64 | } 65 | 66 | - (void)dealloc 67 | { 68 | [_window release]; 69 | [_viewController release]; 70 | [super dealloc]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestAppViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppViewController.h 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MySillyAdd.h" 11 | 12 | @interface MyTestAppViewController : UIViewController { 13 | UITextField *numberA; 14 | UITextField *numberB; 15 | UILabel *resultLabel; 16 | MySillyAdd *mySillyAdd; 17 | } 18 | 19 | 20 | @property (nonatomic, retain) IBOutlet UITextField *numberA; 21 | @property (nonatomic, retain) IBOutlet UITextField *numberB; 22 | @property (nonatomic, retain) IBOutlet UILabel *resultLabel; 23 | @property (nonatomic, retain) MySillyAdd *mySillyAdd; 24 | 25 | - (IBAction)calc:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/MyTestAppViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppViewController.m 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "MyTestAppViewController.h" 10 | 11 | @implementation MyTestAppViewController 12 | @synthesize numberA; 13 | @synthesize numberB; 14 | @synthesize resultLabel; 15 | @synthesize mySillyAdd; 16 | 17 | - (void)didReceiveMemoryWarning 18 | { 19 | // Releases the view if it doesn't have a superview. 20 | [super didReceiveMemoryWarning]; 21 | 22 | // Release any cached data, images, etc that aren't in use. 23 | } 24 | 25 | #pragma mark - View lifecycle 26 | 27 | 28 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | 33 | mySillyAdd = [[MySillyAdd alloc] init]; 34 | } 35 | 36 | 37 | - (void)viewDidUnload 38 | { 39 | [self setNumberA:nil]; 40 | [self setNumberB:nil]; 41 | [self setResultLabel:nil]; 42 | [self setMySillyAdd:nil]; 43 | [super viewDidUnload]; 44 | // Release any retained subviews of the main view. 45 | // e.g. self.myOutlet = nil; 46 | } 47 | 48 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 49 | { 50 | // Return YES for supported orientations 51 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 52 | } 53 | 54 | - (void)dealloc { 55 | [numberA release]; 56 | [numberB release]; 57 | [resultLabel release]; 58 | [mySillyAdd release]; 59 | [super dealloc]; 60 | } 61 | 62 | - (IBAction)calc:(id)sender { 63 | NSInteger a = [self.numberA.text integerValue]; 64 | NSInteger b = [self.numberB.text integerValue]; 65 | 66 | self.resultLabel.text = [NSString stringWithFormat:@"%d", [mySillyAdd addNumberA:a ToNumberB:b]]; 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MyTestApp/MyTestApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MyTestApp 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppApplicationTests/MyTestAppApplicationTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | me.venj.${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 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppApplicationTests/MyTestAppApplicationTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MyTestAppApplicationTests' target in the 'MyTestAppApplicationTests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppApplicationTests/MyTestAppApplicationTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppApplicationTests.h 3 | // MyTestAppApplicationTests 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "MyTestAppViewController.h" 12 | #import "MyTestAppAppDelegate.h" 13 | 14 | @interface MyTestAppApplicationTests : SenTestCase { 15 | MyTestAppViewController *vc; 16 | MyTestAppAppDelegate *appDelegate; 17 | UIView *view; 18 | } 19 | 20 | - (void)testAddOneToOne; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppApplicationTests/MyTestAppApplicationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppApplicationTests.m 3 | // MyTestAppApplicationTests 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "MyTestAppApplicationTests.h" 10 | 11 | @implementation MyTestAppApplicationTests 12 | 13 | - (void)setUp 14 | { 15 | [super setUp]; 16 | 17 | // Set-up code here. 18 | appDelegate = [[UIApplication sharedApplication] delegate]; 19 | vc = (MyTestAppViewController *)appDelegate.window.rootViewController; 20 | view = vc.view; 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Tear-down code here. 26 | 27 | [super tearDown]; 28 | } 29 | 30 | - (void) testAppDelegate { 31 | STAssertNotNil(appDelegate, @"Cannot find the application delegate"); 32 | } 33 | 34 | - (void)testAddOneToOne { 35 | vc.numberA.text = @"1"; 36 | vc.numberB.text = @"1"; 37 | 38 | [vc calc:[view viewWithTag:3]]; // The Tag Button; 39 | 40 | NSString *resultString = vc.resultLabel.text; 41 | 42 | STAssertEqualObjects(@"2", resultString, @"Expect 2 for result, but got %@", resultString); 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppApplicationTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppLogicTests/MyTestAppLogicTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | me.venj.${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 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppLogicTests/MyTestAppLogicTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MyTestAppLogicTests' target in the 'MyTestAppLogicTests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppLogicTests/MyTestAppLogicTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppLogicTests.h 3 | // MyTestAppLogicTests 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MySillyAdd.h" 11 | 12 | @interface MyTestAppLogicTests : SenTestCase { 13 | MySillyAdd *mySillyAdd; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppLogicTests/MyTestAppLogicTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyTestAppLogicTests.m 3 | // MyTestAppLogicTests 4 | // 5 | // Created by Venj Chu on 11/08/17. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "MyTestAppLogicTests.h" 10 | 11 | @implementation MyTestAppLogicTests 12 | 13 | - (void)setUp 14 | { 15 | [super setUp]; 16 | 17 | // Set-up code here. 18 | mySillyAdd = [[MySillyAdd alloc] init]; 19 | STAssertNotNil(mySillyAdd, @"Can not create MySillyAdd object."); 20 | } 21 | 22 | - (void)tearDown 23 | { 24 | // Tear-down code here. 25 | [mySillyAdd release]; 26 | 27 | [super tearDown]; 28 | } 29 | 30 | - (void)testAddOneToOne { 31 | NSInteger result = [mySillyAdd addNumberA:1 ToNumberB:1]; 32 | STAssertEquals(2, 2, @"Expect 2 for result, but got %d", result); 33 | } 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MyTestApp/MyTestAppLogicTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // NavStatusStyle 4 | // 5 | // Created by Venj Chu on 14/7/24. 6 | // Copyright (c) 2014年 ElitechMedia. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication!) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication!) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication!) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication!) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication!) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/DetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.swift 3 | // NavStatusStyle 4 | // 5 | // Created by Venj Chu on 14/7/24. 6 | // Copyright (c) 2014年 ElitechMedia. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class DetailViewController: UIViewController { 12 | 13 | @IBOutlet weak var detailDescriptionLabel: UILabel! 14 | 15 | 16 | override func preferredStatusBarStyle() -> UIStatusBarStyle { 17 | return .Default 18 | } 19 | 20 | var detailItem: AnyObject? { 21 | didSet { 22 | // Update the view. 23 | self.configureView() 24 | } 25 | } 26 | 27 | func configureView() { 28 | // Update the user interface for the detail item. 29 | if let detail: AnyObject = self.detailItem { 30 | if let label = self.detailDescriptionLabel { 31 | label.text = detail.description 32 | } 33 | } 34 | } 35 | 36 | override func viewDidLoad() { 37 | super.viewDidLoad() 38 | // Do any additional setup after loading the view, typically from a nib. 39 | self.configureView() 40 | } 41 | 42 | override func didReceiveMemoryWarning() { 43 | super.didReceiveMemoryWarning() 44 | // Dispose of any resources that can be recreated. 45 | } 46 | 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/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 | } -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/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 | } -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.elitechmedia.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/MasterViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.swift 3 | // NavStatusStyle 4 | // 5 | // Created by Venj Chu on 14/7/24. 6 | // Copyright (c) 2014年 ElitechMedia. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MasterViewController: UITableViewController { 12 | 13 | var objects = NSMutableArray() 14 | 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | // Do any additional setup after loading the view, typically from a nib. 23 | self.navigationItem.leftBarButtonItem = self.editButtonItem() 24 | 25 | let addButton = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "insertNewObject:") 26 | self.navigationItem.rightBarButtonItem = addButton 27 | } 28 | 29 | override func didReceiveMemoryWarning() { 30 | super.didReceiveMemoryWarning() 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | func insertNewObject(sender: AnyObject) { 35 | if objects == nil { 36 | objects = NSMutableArray() 37 | } 38 | objects.insertObject(NSDate.date(), atIndex: 0) 39 | let indexPath = NSIndexPath(forRow: 0, inSection: 0) 40 | self.tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) 41 | } 42 | 43 | override func preferredStatusBarStyle() -> UIStatusBarStyle { 44 | return .LightContent 45 | } 46 | 47 | // MARK: - Segues 48 | 49 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 50 | if segue.identifier == "showDetail" { 51 | let indexPath = self.tableView.indexPathForSelectedRow() 52 | let object = objects[indexPath.row] as NSDate 53 | (segue.destinationViewController as DetailViewController).detailItem = object 54 | } 55 | } 56 | 57 | // MARK: - Table View 58 | 59 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 60 | return 1 61 | } 62 | 63 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 64 | return objects.count 65 | } 66 | 67 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 68 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 69 | 70 | let object = objects[indexPath.row] as NSDate 71 | cell.textLabel.text = object.description 72 | return cell 73 | } 74 | 75 | override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { 76 | // Return false if you do not want the specified item to be editable. 77 | return true 78 | } 79 | 80 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 81 | if editingStyle == .Delete { 82 | objects.removeObjectAtIndex(indexPath.row) 83 | tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade) 84 | } else if editingStyle == .Insert { 85 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. 86 | } 87 | } 88 | 89 | 90 | } 91 | 92 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyle/UINavigation+StatusBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigation+StatusBar.swift 3 | // NavStatusStyle 4 | // 5 | // Created by Venj Chu on 14/7/24. 6 | // Copyright (c) 2014年 ElitechMedia. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UINavigationController { 12 | override public func preferredStatusBarStyle() -> UIStatusBarStyle { 13 | return self.topViewController.preferredStatusBarStyle(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.elitechmedia.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /NavStatusStyle/NavStatusStyleTests/NavStatusStyleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavStatusStyleTests.swift 3 | // NavStatusStyleTests 4 | // 5 | // Created by Venj Chu on 14/7/24. 6 | // Copyright (c) 2014年 ElitechMedia. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class NavStatusStyleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Paste Button 4 | // 5 | // Created by 朱 文杰 on 12-2-13. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | @property (assign) IBOutlet NSTextField *sourceField; 15 | @property (assign) IBOutlet NSTextField *targetField; 16 | - (IBAction)copyText:(id)sender; 17 | - (IBAction)pasteText:(id)sender; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Paste Button 4 | // 5 | // Created by 朱 文杰 on 12-2-13. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | @synthesize sourceField = _sourceField; 15 | @synthesize targetField = _targetField; 16 | 17 | - (void)dealloc 18 | { 19 | [super dealloc]; 20 | } 21 | 22 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 23 | { 24 | // Insert code here to initialize your application 25 | } 26 | 27 | - (IBAction)copyText:(id)sender { 28 | [self.sourceField becomeFirstResponder]; 29 | NSText *sourceText = [self.window fieldEditor:YES forObject:self.sourceField]; 30 | [sourceText selectAll:nil]; 31 | [sourceText copy:nil]; 32 | } 33 | 34 | - (IBAction)pasteText:(id)sender { 35 | [self.targetField becomeFirstResponder]; 36 | NSText *targetText = [self.window fieldEditor:YES forObject:self.targetField]; 37 | self.targetField.stringValue = @""; 38 | [targetText paste:nil]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/Paste Button-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/Paste Button-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Paste Button' target in the 'Paste Button' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Paste Button/Paste Button/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Paste Button 4 | // 5 | // Created by 朱 文杰 on 12-2-13. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | @property (assign) IBOutlet NSMenu *dynamicMenu; 15 | 16 | 17 | - (IBAction)restoreDockIcon:(id)sender; 18 | - (IBAction)changeDockIcon:(id)sender; 19 | - (IBAction)changeDockIconWithCustomView:(id)sender; 20 | - (IBAction)addBadge:(id)sender; 21 | - (IBAction)addQQStyleBadge:(id)sender; 22 | - (IBAction)removeBadge:(id)sender; 23 | - (IBAction)showMinimizeBadge:(id)sender; 24 | - (IBAction)removeMinimizeBadge:(id)sender; 25 | - (IBAction)staticMenu:(id)sender; 26 | - (IBAction)dynamicDockMenu:(id)sender; 27 | @end 28 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DockIconView.h" 11 | #import "DockIconBadgeView.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize dynamicMenu = _dynamicMenu; 17 | 18 | - (void)dealloc 19 | { 20 | [super dealloc]; 21 | } 22 | 23 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 24 | { 25 | // Insert code here to initialize your application 26 | } 27 | 28 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 29 | return YES; 30 | } 31 | 32 | /* Uncomment to replace static dock menu with dymamic dock menu. 33 | // Dynamic Dock menu. 34 | - (NSMenu *)applicationDockMenu:(NSApplication *)sender { 35 | return self.dynamicMenu; 36 | } 37 | */ 38 | 39 | // Customize Dock Icon 40 | - (IBAction)changeDockIcon:(id)sender { 41 | [NSApp setApplicationIconImage:[NSImage imageNamed:@"Icon"]]; 42 | } 43 | 44 | // Restore Dock Icon 45 | - (IBAction)restoreDockIcon:(id)sender { 46 | [NSApp setApplicationIconImage:nil]; 47 | } 48 | 49 | // Draw Dock Icon with Custom View 50 | - (IBAction)changeDockIconWithCustomView:(id)sender { 51 | DockIconView *dockView = [[[DockIconView alloc] init] autorelease]; 52 | [[NSApp dockTile] setContentView: dockView]; 53 | [[NSApp dockTile] display]; 54 | } 55 | 56 | // Add badge 57 | - (IBAction)addBadge:(id)sender { 58 | [[NSApp dockTile] setBadgeLabel:[NSString stringWithFormat:@"%d", random() % 11]]; 59 | } 60 | 61 | // Remove badge 62 | - (IBAction)removeBadge:(id)sender { 63 | [[NSApp dockTile] setBadgeLabel:nil]; 64 | } 65 | 66 | // Add QQ style badge; 67 | - (IBAction)addQQStyleBadge:(id)sender { 68 | DockIconBadgeView *dockView = [[[DockIconBadgeView alloc] init] autorelease]; 69 | dockView.labelText = [NSString stringWithFormat:@"%2d", random() % 101]; 70 | [[NSApp dockTile] setContentView: dockView]; 71 | [[NSApp dockTile] display]; 72 | } 73 | 74 | // Show minimize icon badge 75 | - (IBAction)showMinimizeBadge:(id)sender { 76 | [[self.window dockTile] setShowsApplicationBadge:YES]; 77 | } 78 | 79 | // Remove minimize icon badge 80 | - (IBAction)removeMinimizeBadge:(id)sender { 81 | [[self.window dockTile] setShowsApplicationBadge:NO]; 82 | } 83 | 84 | // Static menu action 85 | - (IBAction)staticMenu:(id)sender { 86 | NSAlert *alert = [NSAlert alertWithMessageText:@"Static Dock Menu" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Static dock menu clicked: %@", [sender title]]; 87 | [alert runModal]; 88 | } 89 | 90 | // Dynamic menu action 91 | - (IBAction)dynamicDockMenu:(id)sender { 92 | NSAlert *alert = [NSAlert alertWithMessageText:@"Dynamic Dock Menu" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Dynamic dock menu clicked: %@", [sender title]]; 93 | [alert runModal]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/DockIconBadgeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DockIconBadgeView.h 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DockIconBadgeView : NSView 12 | 13 | @property (retain) NSTextField *label; 14 | @property (copy) NSString *labelText; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/DockIconBadgeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DockIconBadgeView.m 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "DockIconBadgeView.h" 10 | 11 | @implementation DockIconBadgeView 12 | @synthesize label = _label; 13 | @synthesize labelText = _labelText; 14 | 15 | - (id)initWithFrame:(NSRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | // Initialization code here. 20 | } 21 | 22 | return self; 23 | } 24 | 25 | - (void)drawRect:(NSRect)dirtyRect 26 | { 27 | // Drawing code here. 28 | 29 | // Draw Dock Icon 30 | NSImage *image = [NSImage imageNamed:@"qqbadge"]; 31 | NSImageView *imageView = [[NSImageView alloc] initWithFrame:self.frame]; 32 | imageView.image = image; 33 | [self addSubview:imageView]; 34 | [imageView release]; 35 | 36 | // Draw Badge Label 37 | NSRect labelFrame; 38 | CGFloat width = self.frame.size.width; 39 | CGFloat height = self.frame.size.height; 40 | labelFrame.origin = CGPointMake(width * 0.62, height * 0.60); 41 | labelFrame.size = CGSizeMake(width * 0.25, height * 0.25); 42 | self.label = [[NSTextField alloc] initWithFrame:labelFrame]; 43 | self.label.backgroundColor = [NSColor clearColor]; 44 | self.label.textColor = [NSColor whiteColor]; 45 | self.label.drawsBackground = NO; 46 | self.label.stringValue = self.labelText; 47 | NSFont *font = [NSFont fontWithName:@"Arial" size:32]; 48 | [self.label setFont:font]; 49 | [self.label sizeToFit]; 50 | [self.label setBordered:NO]; 51 | [self addSubview:self.label]; 52 | [self.label release]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/DockIconView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DockIconView.h 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DockIconView : NSView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/DockIconView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DockIconView.m 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "DockIconView.h" 10 | 11 | @implementation DockIconView 12 | 13 | - (id)initWithFrame:(NSRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | // Initialization code here. 18 | } 19 | 20 | return self; 21 | } 22 | 23 | - (void)drawRect:(NSRect)dirtyRect 24 | { 25 | // Drawing code here. 26 | NSImage *image = [NSImage imageNamed:@"qq"]; 27 | NSImageView *imageView = [[NSImageView alloc] initWithFrame:self.frame]; 28 | imageView.image = image; 29 | [self addSubview:imageView]; 30 | [imageView release]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Play With Dock/Play With Dock/Icon.png -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/Play With Dock-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/Play With Dock-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Play With Dock' target in the 'Play With Dock' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Play With Dock 4 | // 5 | // Created by Venj Chu on 11/09/02. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/qq.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Play With Dock/Play With Dock/qq.icns -------------------------------------------------------------------------------- /Play With Dock/Play With Dock/qqbadge.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Play With Dock/Play With Dock/qqbadge.icns -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Read me 2 | ======= 3 | 4 | This is the repository for sample code for [my blog](http://cocoa.venj.me). 5 | 6 | 7 | Projects & blog link: 8 | --------------------- 9 | 10 | * NavStatusStyle - http://cocoa.venj.me/blog/view-controller-based-status-bar-style-and-uinavigationcontroller/ (UINavigationController和View Controller-based状态栏风格) 11 | * Loading Screen - http://cocoa.venj.me/blog/localized-loading-screen/ (本地化加载屏幕) 12 | * RefreshControl - http://cocoa.venj.me/blog/refresh-control-gochas/ (用代码触发下拉更新) 13 | * Custom Menu - http://cocoa.venj.me/blog/make-a-qq-mac-avatar-menu-clone/ (山寨一下QQ for Mac样式的头像选择菜单) 14 | * Bounce Icon - http://cocoa.venj.me/blog/bounce-dock-icon/ (跳动Dock图标的实现) 15 | * Growl Test - http://cocoa.venj.me/blog/add-growl-to-your-sandboxed-app/ (在Sandbox的程序中加入Growl支持) 16 | * Custom NavBar - http://cocoa.venj.me/blog/custom-barbuttomitem-for-ios4/ (在iOS 4中自定义BarButtonItem) 17 | http://cocoa.venj.me/blog/more-on-navigationbar-customization/ (再谈iOS 4下NavigationBar的自定义) 18 | * TwiTable - http://cocoa.venj.me/blog/twitter-style-sheet-positioning/ (Twitter for Mac风格的Sheet定位) 19 | * Paste Button - http://cocoa.venj.me/blog/copy-and-paste-to-text-field/ (点击按钮复制粘贴到文本框) 20 | * CustomURLScheme, CustomURLScheme for iOS - http://cocoa.venj.me/blog/custom-url-scheme-on-mac-and-ios/ (在Mac和iOS中注册自定义的URL Scheme) 21 | * iPhoneCustomFont - http://cocoa.venj.me/blog/custom-fonts-in-ios-apps/ (在iOS程序中使用自定义字体) 22 | * LetsMove - http://cocoa.venj.me/blog/move-app-to-application-folder-at-runtime/ (把程序移动到/Applications文件夹) 23 | * Play With Dock - http://cocoa.venj.me/blog/play-with-dock-icon/ (在Cocoa里玩转Dock图标) 24 | * Screen Grab - http://cocoa.venj.me/blog/screenshot-in-cocoa-apps/ (在Cocoa程序中进行屏幕截图) 25 | * TitleBar Addon - http://cocoa.venj.me/blog/draw-accessory-view-on-window-title-bar/ (在NSWindow窗口标题栏上绘制辅助视图) 26 | * Round Corner Image - http://cocoa.venj.me/blog/draw-rounded-rectangle-nsimage-with-quartz/ (用Quartz绘制NSImage圆角图像) http://cocoa.venj.me/blog/get-real-size-of-nsimage/ (获取NSImage图片的准确大小) 27 | * MyTestApp - http://cocoa.venj.me/blog/testing-ios-projects/ (iOS项目的测试简介) 28 | * Dynamic Dock Icon - http://cocoa.venj.me/blog/dynamically-show-and-hide-dock-icon/ (在程序中动态设置是否显示Dock图标) 29 | * Wikiview - http://cocoa.venj.me/blog/draw-round-rectangle-with-quartz-on-ios/ (在iOS上用Quartz绘制圆角矩形) 30 | Code mentioned in the blog is in **BezelsView.m** 31 | * FileExchange - http://cocoa.venj.me/blog/ios-and-pc-file-exchange-using-itunes/ (让iOS App通过iTunes进行文件交换) 32 | * Whereami - http://cocoa.venj.me/blog/geocoding-in-ios-5/ (iOS 5的Geocoding) 33 | * RTF2HTML - http://cocoa.venj.me/blog/talk-about-nsattributesstring-to-html-again/ (再谈NSAttributedString转HTML) 34 | * GrowlTest - http://cocoa.venj.me/blog/add-growl-support-in-your-apps-add-growl-framework/ (为应用程序增加Growl支持(上):在项目中加入Growl.Framework) 35 | http://cocoa.venj.me/blog/add-growl-support-in-your-apps-coding-growl/ (为应用程序增加Growl支持(下):在代码中应用Growl) 36 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/RTF2HTML-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/RTF2HTML-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'RTF2HTML' target in the 'RTF2HTML' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/RTF2HTMLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTF2HTMLAppDelegate.h 3 | // RTF2HTML 4 | // 5 | // Created by Chu Venj on 11-4-22. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RTF2HTMLAppDelegate : NSObject { 12 | @private 13 | NSWindow *window; 14 | NSTextView *richView; 15 | NSTextField *htmlView; 16 | NSAttributedString *attrString; 17 | } 18 | 19 | @property (assign) IBOutlet NSWindow *window; 20 | @property (assign) IBOutlet NSTextView *richView; 21 | @property (assign) IBOutlet NSTextField *htmlView; 22 | - (IBAction)convert:(id)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/RTF2HTMLAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTF2HTMLAppDelegate.m 3 | // RTF2HTML 4 | // 5 | // Created by Chu Venj on 11-4-22. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "RTF2HTMLAppDelegate.h" 10 | 11 | @implementation RTF2HTMLAppDelegate 12 | 13 | @synthesize window; 14 | @synthesize richView; 15 | @synthesize htmlView; 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 18 | { 19 | // Insert code here to initialize your application 20 | } 21 | 22 | - (IBAction)convert:(id)sender { 23 | attrString = [richView attributedString]; 24 | NSMutableArray *exclude = [NSMutableArray array]; 25 | [exclude addObject:@"XML"]; 26 | [exclude addObjectsFromArray:[NSArray arrayWithObjects:@"APPLET", @"BASEFONT", @"CENTER", @"DIR", @"FONT", @"ISINDEX", @"MENU", @"S", @"STRIKE", @"U", nil]]; 27 | [exclude addObject:@"STYLE"]; 28 | //[exclude addObject:@"SPAN"]; 29 | //[exclude addObject:@"Apple-converted-space"]; 30 | //[exclude addObject:@"Apple-converted-tab"]; 31 | //[exclude addObject:@"Apple-interchange-newline"]; 32 | //[exclude addObjectsFromArray:[NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body", nil]]; 33 | 34 | NSDictionary *htmlAtt = [NSDictionary dictionaryWithObjectsAndKeys: 35 | NSHTMLTextDocumentType, NSDocumentTypeDocumentAttribute, 36 | exclude, NSExcludedElementsDocumentAttribute, nil]; 37 | NSError *error; 38 | NSData *htmlData = [attrString dataFromRange:NSMakeRange(0,[attrString length]) documentAttributes:htmlAtt error:&error ]; 39 | NSString *htmlString = [[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding]; 40 | [htmlView setStringValue:htmlString]; 41 | NSLog(@"%@",htmlString); 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /RTF2HTML/RTF2HTML/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RTF2HTML 4 | // 5 | // Created by Chu Venj on 11-4-22. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/RefreshControl/RefreshControl/Default-568h@2x.png -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/RefreshControl/RefreshControl/Default.png -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/RefreshControl/RefreshControl/Default@2x.png -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/DetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.h 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DetailViewController : UIViewController 12 | 13 | @property (strong, nonatomic) id detailItem; 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; 16 | @end 17 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/DetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.m 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. All rights reserved. 7 | // 8 | 9 | #import "DetailViewController.h" 10 | 11 | @interface DetailViewController () 12 | - (void)configureView; 13 | @end 14 | 15 | @implementation DetailViewController 16 | 17 | #pragma mark - Managing the detail item 18 | 19 | - (void)setDetailItem:(id)newDetailItem 20 | { 21 | if (_detailItem != newDetailItem) { 22 | _detailItem = newDetailItem; 23 | 24 | // Update the view. 25 | [self configureView]; 26 | } 27 | } 28 | 29 | - (void)configureView 30 | { 31 | // Update the user interface for the detail item. 32 | 33 | if (self.detailItem) { 34 | self.detailDescriptionLabel.text = [self.detailItem description]; 35 | } 36 | } 37 | 38 | - (void)viewDidLoad 39 | { 40 | [super viewDidLoad]; 41 | // Do any additional setup after loading the view, typically from a nib. 42 | [self configureView]; 43 | } 44 | 45 | - (void)didReceiveMemoryWarning 46 | { 47 | [super didReceiveMemoryWarning]; 48 | // Dispose of any resources that can be recreated. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/MasterViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.h 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasterViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/RefreshControl-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | me.venj.${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 | UIMainStoryboardFile 28 | MainStoryboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/RefreshControl-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'RefreshControl' target in the 'RefreshControl' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /RefreshControl/RefreshControl/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RefreshControl 4 | // 5 | // Created by venj on 12-12-20. 6 | // Copyright (c) 2012年 venj. 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 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/NSImage+RoundCorner.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+RoundCorner.h 3 | // Round Corner Image 4 | // 5 | // Created by Venj Chu on 11/08/20. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | /* C Prototypes */ 11 | void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight); 12 | 13 | @interface NSImage(RoundCorner) 14 | - (NSImage *)roundCornersImageCornerRadius:(NSInteger)radius; 15 | @end 16 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/NSImage+RoundCorner.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+RoundCorner.m 3 | // Round Corner Image 4 | // 5 | // Created by Venj Chu on 11/08/20. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "NSImage+RoundCorner.h" 10 | 11 | @implementation NSImage (RoundCorner) 12 | 13 | void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) 14 | { 15 | float fw, fh; 16 | if (ovalWidth == 0 || ovalHeight == 0) { 17 | CGContextAddRect(context, rect); 18 | return; 19 | } 20 | CGContextSaveGState(context); 21 | CGContextTranslateCTM (context, CGRectGetMinX(rect), CGRectGetMinY(rect)); 22 | CGContextScaleCTM (context, ovalWidth, ovalHeight); 23 | fw = CGRectGetWidth (rect) / ovalWidth; 24 | fh = CGRectGetHeight (rect) / ovalHeight; 25 | CGContextMoveToPoint(context, fw, fh/2); 26 | CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); 27 | CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); 28 | CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); 29 | CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); 30 | CGContextClosePath(context); 31 | CGContextRestoreGState(context); 32 | } 33 | 34 | - (NSImage *)roundCornersImageCornerRadius:(NSInteger)radius { 35 | int w = (int) self.size.width; 36 | int h = (int) self.size.height; 37 | 38 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 39 | CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); 40 | 41 | CGContextBeginPath(context); 42 | CGRect rect = CGRectMake(0, 0, w, h); 43 | addRoundedRectToPath(context, rect, radius, radius); 44 | CGContextClosePath(context); 45 | CGContextClip(context); 46 | 47 | CGImageRef cgImage = [[NSBitmapImageRep imageRepWithData:[self TIFFRepresentation]] CGImage]; 48 | 49 | CGContextDrawImage(context, CGRectMake(0, 0, w, h), cgImage); 50 | 51 | CGImageRef imageMasked = CGBitmapContextCreateImage(context); 52 | CGContextRelease(context); 53 | CGColorSpaceRelease(colorSpace); 54 | 55 | NSImage *tmpImage = [[NSImage alloc] initWithCGImage:imageMasked size:self.size]; 56 | NSData *imageData = [tmpImage TIFFRepresentation]; 57 | NSImage *image = [[NSImage alloc] initWithData:imageData]; 58 | [tmpImage release]; 59 | 60 | return [image autorelease]; 61 | } 62 | @end 63 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/Round Corner Image-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/Round Corner Image-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Round Corner Image' target in the 'Round Corner Image' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/Round_Corner_ImageAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Round_Corner_ImageAppDelegate.h 3 | // Round Corner Image 4 | // 5 | // Created by Venj Chu on 11/08/19. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Round_Corner_ImageAppDelegate : NSObject { 12 | NSWindow *window; 13 | NSImageView *imageView; 14 | } 15 | 16 | @property (assign) IBOutlet NSWindow *window; 17 | @property (assign) IBOutlet NSImageView *imageView; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/Round_Corner_ImageAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // Round_Corner_ImageAppDelegate.m 3 | // Round Corner Image 4 | // 5 | // Created by Venj Chu on 11/08/19. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "Round_Corner_ImageAppDelegate.h" 10 | #import "NSImage+RoundCorner.h" 11 | 12 | @implementation Round_Corner_ImageAppDelegate 13 | 14 | @synthesize window; 15 | @synthesize imageView; 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 18 | { 19 | // Insert code here to initialize your application 20 | NSImage *image = [NSImage imageNamed:@"image"]; 21 | NSLog(@"Before: %f, %f", image.size.width, image.size.height); 22 | // Set the 'real' size of NSImage. 23 | NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; 24 | NSSize size = NSMakeSize([rep pixelsWide], [rep pixelsHigh]); 25 | image.size = size; 26 | NSLog(@"After: %f, %f", image.size.width, image.size.height); 27 | 28 | [self.imageView setImage:[image roundCornersImageCornerRadius:8]]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/venj/Cocoa-blog-code/66e5f8bd30d6bbd84ada77117e4ed5e461bbe9f1/Round Corner Image/Round Corner Image/image.jpg -------------------------------------------------------------------------------- /Round Corner Image/Round Corner Image/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Round Corner Image 4 | // 5 | // Created by Venj Chu on 11/08/19. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Screen Grab 4 | // 5 | // Created by Venj Chu on 11/09/01. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | @property (assign) IBOutlet NSImageView *imageView; 15 | 16 | - (IBAction)grabScreen:(id)sender; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Screen Grab 4 | // 5 | // Created by Venj Chu on 11/09/01. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | @synthesize imageView = _imageView; 15 | 16 | - (void)dealloc 17 | { 18 | [super dealloc]; 19 | } 20 | 21 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 22 | { 23 | // Insert code here to initialize your application 24 | } 25 | 26 | -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 27 | return YES; 28 | } 29 | 30 | - (IBAction)grabScreen:(id)sender { 31 | NSTask *capture = [[[NSTask alloc] init] autorelease]; 32 | capture.launchPath = @"/usr/sbin/screencapture"; 33 | capture.arguments = [NSArray arrayWithObjects:@"-i", @"-c", nil]; 34 | 35 | [capture setTerminationHandler: ^(NSTask *t) { 36 | NSPasteboard *pboard = [NSPasteboard generalPasteboard]; 37 | NSPasteboardItem *pboardItem = [[pboard pasteboardItems] objectAtIndex:0]; 38 | NSString *pboardItemType = [[pboard types] objectAtIndex:0]; 39 | NSData *imageData = [pboardItem dataForType:pboardItemType]; 40 | NSImage *image = [[NSImage alloc] initWithData:imageData]; 41 | [self.imageView setImage:image]; 42 | [image release]; 43 | }]; 44 | 45 | [capture launch]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/Screen Grab-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/Screen Grab-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Screen Grab' target in the 'Screen Grab' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Screen Grab/Screen Grab/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Screen Grab 4 | // 5 | // Created by Venj Chu on 11/09/01. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TitleBar Addons 4 | // 5 | // Created by Venj Chu on 11/08/27. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (strong) IBOutlet NSWindow *window; 14 | @property (assign) IBOutlet NSView *accessoryView; 15 | 16 | - (IBAction)buttonClicked:(id)sender; 17 | - (void)composeInterface; 18 | @end 19 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TitleBar Addons 4 | // 5 | // Created by Venj Chu on 11/08/27. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | @synthesize accessoryView = _accessoryView; 15 | 16 | - (void)dealloc 17 | { 18 | [_window release]; 19 | [super dealloc]; 20 | } 21 | 22 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 23 | { 24 | // Insert code here to initialize your application 25 | } 26 | 27 | - (void)awakeFromNib { 28 | [self composeInterface]; 29 | } 30 | 31 | - (void)composeInterface { 32 | NSView *themeFrame = [[self.window contentView] superview]; 33 | 34 | NSRect themeFrameRect = [themeFrame frame]; 35 | NSRect accessoryViewFrame = [self.accessoryView frame]; 36 | NSRect newFrame = NSMakeRect(themeFrameRect.size.width - accessoryViewFrame.size.width, 37 | themeFrameRect.size.height - accessoryViewFrame.size.height, 38 | accessoryViewFrame.size.width, 39 | accessoryViewFrame.size.height); 40 | [self.accessoryView setFrame:newFrame]; 41 | 42 | [themeFrame addSubview:self.accessoryView]; 43 | } 44 | 45 | - (IBAction)buttonClicked:(id)sender { 46 | NSAlert *alert = [NSAlert alertWithMessageText:@"Button Clicked" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Botton on the titlebar was clicked!"]; 47 | [alert runModal]; 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/TitleBar Addons-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/TitleBar Addons-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'TitleBar Addons' target in the 'TitleBar Addons' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TitleBar Addons/TitleBar Addons/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TitleBar Addons 4 | // 5 | // Created by Venj Chu on 11/08/27. 6 | // Copyright (c) 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TwiTable 4 | // 5 | // Created by 朱 文杰 on 12-2-15. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (retain, nonatomic) NSMutableArray *values; 14 | @property (assign) IBOutlet NSWindow *window; 15 | @property (assign) IBOutlet NSTableView *tableView; 16 | 17 | - (IBAction)removeRow:(id)sender; 18 | @end 19 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TwiTable 4 | // 5 | // Created by 朱 文杰 on 12-2-15. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | static NSString *arr[] = {@"This is just an example 1.", 12 | @"This is just an example 2.", @"This is just an example 3.", 13 | @"This is just an example 4.", @"This is just an example 5.", 14 | @"This is just an example 6.", @"This is just an example 7.", 15 | @"This is just an example 8.", @"This is just an example 9.", 16 | @"This is just an example 10.", @"This is just an example 11.", 17 | @"This is just an example 12.", @"This is just an example 13.", 18 | @"This is just an example 14.", @"This is just an example 15.", 19 | @"This is just an example 16.", @"This is just an example 17.", 20 | @"This is just an example 18.", @"This is just an example 19.", 21 | @"This is just an example 20.", @"This is just an example 21.", 22 | @"This is just an example 22."}; 23 | 24 | @implementation AppDelegate 25 | 26 | @synthesize window = _window; 27 | @synthesize tableView = _tableView; 28 | @synthesize values = _values; 29 | 30 | - (void)dealloc 31 | { 32 | [_values release]; 33 | [super dealloc]; 34 | } 35 | 36 | - (void)awakeFromNib { 37 | if (!self.values) { 38 | self.values = [NSMutableArray array]; 39 | for (NSInteger i; i < 22; ++i) { 40 | [self.values addObject:arr[i]]; 41 | } 42 | } 43 | } 44 | 45 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 46 | { 47 | // Insert code here to initialize your application 48 | } 49 | 50 | - (IBAction)removeRow:(id)sender { 51 | NSAlert *alert = [NSAlert alertWithMessageText:@"Are you sure?" defaultButton:@"Yes" alternateButton:@"No" otherButton:nil informativeTextWithFormat:@"Deleting a table cell is not reversable."]; 52 | [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:NULL]; 53 | } 54 | 55 | - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { 56 | if (returnCode == NSAlertDefaultReturn) { 57 | [[self.tableView selectedRowIndexes] enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop){ 58 | [self.values removeObjectAtIndex:idx]; 59 | }]; 60 | 61 | [self.tableView removeRowsAtIndexes:[self.tableView selectedRowIndexes] withAnimation:NSTableViewAnimationSlideUp]; 62 | } 63 | } 64 | 65 | - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect { 66 | // There are many ways to get the cellRect. 67 | // Solution 1: 68 | // id cell = [self.tableView rowViewAtRow:[self.tableView selectedRow] makeIfNecessary:YES]; 69 | // NSRect cellRect = [cell frame]; 70 | // 71 | // Solution 2: (A little different to other two. See doc for detail. Not recommended.) 72 | // NSRect cellRect = [self.tableView frameOfCellAtColumn:[self.tableView selectedColumn] row:[self.tableView selectedRow]]; 73 | // 74 | // Solution 3: (Recommend!) 75 | NSRect cellRect = [self.tableView rectOfRow:[self.tableView selectedRow]]; 76 | 77 | NSRect scrollViewRect = [self.tableView.superview frame]; 78 | cellRect.origin.y = scrollViewRect.size.height - cellRect.origin.y; // View based table view is flipped. 79 | cellRect.size.height = 0; 80 | return cellRect; 81 | } 82 | 83 | #pragma mark Pop up table view 84 | 85 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { 86 | return [self.values count]; 87 | } 88 | 89 | - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { 90 | NSTableCellView *cellView = [self.tableView makeViewWithIdentifier:@"MyView" owner:self]; 91 | cellView.textField.stringValue = [self.values objectAtIndex:row]; 92 | return cellView; 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/TwiTable-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | me.venj.${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 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2012年 Home. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/TwiTable-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'TwiTable' target in the 'TwiTable' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TwiTable/TwiTable/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TwiTable 4 | // 5 | // Created by 朱 文杰 on 12-2-15. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Whereami/Whereami/MapPoint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MapPoint.h 3 | // Whereami 4 | // 5 | // Created by Venj Chu on 11/07/06. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface MapPoint : NSObject 14 | 15 | @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; 16 | @property (copy, nonatomic) NSString * title; 17 | 18 | - (id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)title; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Whereami/Whereami/MapPoint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MapPoint.m 3 | // Whereami 4 | // 5 | // Created by Venj Chu on 11/07/06. 6 | // Copyright 2011 Home. All rights reserved. 7 | // 8 | 9 | #import "MapPoint.h" 10 | 11 | @implementation MapPoint 12 | 13 | @synthesize title = _title; 14 | @synthesize coordinate = _coordinate; 15 | 16 | - (id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t { 17 | if (([super init])) { 18 | _coordinate = c; 19 | self.title = t; 20 | } 21 | return self; 22 | } 23 | 24 | - (void)dealloc { 25 | [self.title release]; 26 | 27 | [super dealloc]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Whereami/Whereami/Whereami-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Whereami/Whereami/Whereami-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Whereami' target in the 'Whereami' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Whereami/Whereami/WhereamiAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WhereamiAppDelegate.h 3 | // Whereami 4 | // 5 | // Created by Chu Venj on 11-6-3. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface WhereamiAppDelegate : NSObject 15 | { 16 | @private 17 | CLLocationManager *_locationManager; 18 | MKMapView *_mapView; 19 | UITextField *_locationTextField; 20 | UIActivityIndicatorView *_activityIndicator; 21 | UISegmentedControl *_mapTypeButton; 22 | } 23 | 24 | @property (nonatomic, retain) IBOutlet UIWindow *window; 25 | @property (nonatomic, retain) IBOutlet MKMapView *mapView; 26 | @property (nonatomic, retain) IBOutlet UITextField *locationTextField; 27 | @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator; 28 | @property (nonatomic, retain) IBOutlet UISegmentedControl *mapTypeButton; 29 | 30 | - (void)findLocation:(NSString *)locationString; 31 | - (void)foundLocation; 32 | - (IBAction)segmentChanged:(id)sender; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Whereami/Whereami/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Whereami/Whereami/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Whereami 4 | // 5 | // Created by Chu Venj on 11-6-3. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /WikiView/WikiView/BezelsView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BezelsView.h 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BezelsView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WikiView/WikiView/BezelsView.m: -------------------------------------------------------------------------------- 1 | // 2 | // BezelsView.m 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "BezelsView.h" 10 | 11 | @implementation BezelsView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | 23 | // Only override drawRect: if you perform custom drawing. 24 | // An empty implementation adversely affects performance during animation. 25 | - (void)drawRect:(CGRect)rect 26 | { 27 | // Drawing code 28 | CGFloat width = rect.size.width; 29 | CGFloat height = rect.size.height; 30 | CGFloat radius = (width + height) * 0.05; 31 | 32 | assert(radius <= (width < height ? width : height)); 33 | 34 | CGContextRef context = UIGraphicsGetCurrentContext(); 35 | CGContextMoveToPoint(context, radius, 0); 36 | 37 | CGContextAddLineToPoint(context, width - radius, 0); 38 | CGContextAddArc(context, width - radius, radius, radius, -0.5 * M_PI, 0.0, 0); 39 | 40 | CGContextAddLineToPoint(context, width, height - radius); 41 | CGContextAddArc(context, width - radius, height - radius, radius, 0.0, 0.5 * M_PI, 0); 42 | 43 | CGContextAddLineToPoint(context, radius, height); 44 | CGContextAddArc(context, radius, height - radius, radius, 0.5 * M_PI, M_PI, 0); 45 | 46 | CGContextAddLineToPoint(context, 0, radius); 47 | CGContextAddArc(context, radius, radius, radius, M_PI, 1.5 * M_PI, 0); 48 | 49 | CGContextClosePath(context); 50 | CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 0.5); 51 | CGContextDrawPath(context, kCGPathFill); 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /WikiView/WikiView/SearchViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SearchViewController.h 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WebViewController; 12 | @interface SearchViewController : UIViewController { 13 | UITextField *searchTermField; 14 | WebViewController *webViewController; 15 | } 16 | 17 | @property (nonatomic, retain) IBOutlet UITextField *searchTermField; 18 | @property (nonatomic, retain) IBOutlet WebViewController *webViewController; 19 | 20 | - (IBAction)searchWiki:(id)sender; 21 | @end 22 | -------------------------------------------------------------------------------- /WikiView/WikiView/SearchViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SearchViewController.m 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "SearchViewController.h" 10 | #import "WebViewController.h" 11 | 12 | @implementation SearchViewController 13 | @synthesize searchTermField; 14 | @synthesize webViewController; 15 | 16 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 17 | { 18 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 19 | if (self) { 20 | // Custom initialization 21 | } 22 | return self; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning 26 | { 27 | // Releases the view if it doesn't have a superview. 28 | [super didReceiveMemoryWarning]; 29 | 30 | // Release any cached data, images, etc that aren't in use. 31 | } 32 | 33 | #pragma mark - View lifecycle 34 | 35 | - (void)viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | // Do any additional setup after loading the view from its nib. 39 | } 40 | 41 | - (void)viewDidUnload 42 | { 43 | [self setSearchTermField:nil]; 44 | [self setWebViewController:nil]; 45 | [super viewDidUnload]; 46 | // Release any retained subviews of the main view. 47 | // e.g. self.myOutlet = nil; 48 | } 49 | 50 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 51 | { 52 | // Return YES for supported orientations 53 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 54 | } 55 | 56 | - (IBAction)searchWiki:(id)sender { 57 | [self.searchTermField resignFirstResponder]; 58 | [self presentModalViewController:self.webViewController animated:YES]; 59 | [self.webViewController loadWikiEntry: self.searchTermField.text]; 60 | } 61 | 62 | - (void)dealloc { 63 | [searchTermField release]; 64 | [webViewController release]; 65 | [super dealloc]; 66 | } 67 | @end 68 | -------------------------------------------------------------------------------- /WikiView/WikiView/WebViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewController.h 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WebViewController : UIViewController { 12 | UINavigationBar *navBar; 13 | UIWebView *webView; 14 | UIActivityIndicatorView *activeIndicator; 15 | UIBarButtonItem *barButton; 16 | UIView *maskView; 17 | UIView *bgView; 18 | } 19 | 20 | 21 | @property (nonatomic, retain) IBOutlet UIBarButtonItem *barButton; 22 | @property (nonatomic, retain) IBOutlet UINavigationBar *navBar; 23 | @property (nonatomic, retain) IBOutlet UIWebView *webView; 24 | @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activeIndicator; 25 | 26 | - (IBAction)dismissWebView:(id)sender; 27 | - (void)loadWikiEntry:(NSString *)entry; 28 | @end 29 | -------------------------------------------------------------------------------- /WikiView/WikiView/WikiView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /WikiView/WikiView/WikiView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'WikiView' target in the 'WikiView' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /WikiView/WikiView/WikiViewAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WikiViewAppDelegate.h 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SearchViewController; 12 | @interface WikiViewAppDelegate : NSObject { 13 | SearchViewController *_searchView; 14 | } 15 | 16 | 17 | @property (nonatomic, retain) IBOutlet UIWindow *window; 18 | @property (nonatomic, retain) IBOutlet SearchViewController *searchView; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WikiView/WikiView/WikiViewAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // WikiViewAppDelegate.m 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import "WikiViewAppDelegate.h" 10 | #import "SearchViewController.h" 11 | 12 | @implementation WikiViewAppDelegate 13 | 14 | @synthesize window = _window; 15 | @synthesize searchView = _searchView; 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | // Override point for customization after application launch. 20 | self.window.rootViewController = self.searchView; 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | /* 28 | 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. 29 | 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. 30 | */ 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application 34 | { 35 | /* 36 | 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. 37 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | */ 39 | } 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application 42 | { 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 | 48 | - (void)applicationDidBecomeActive:(UIApplication *)application 49 | { 50 | /* 51 | 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. 52 | */ 53 | } 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application 56 | { 57 | /* 58 | Called when the application is about to terminate. 59 | Save data if appropriate. 60 | See also applicationDidEnterBackground:. 61 | */ 62 | } 63 | 64 | - (void)dealloc 65 | { 66 | [_window release]; 67 | [_searchView release]; 68 | [super dealloc]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /WikiView/WikiView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /WikiView/WikiView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WikiView 4 | // 5 | // Created by Venj Chu on 11/08/05. 6 | // Copyright 2011年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iPhoneCustomFont 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iPhoneCustomFont 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | @synthesize window = _window; 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | // Override point for customization after application launch. 18 | return YES; 19 | } 20 | 21 | - (void)applicationWillResignActive:(UIApplication *)application 22 | { 23 | /* 24 | 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. 25 | 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. 26 | */ 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application 30 | { 31 | /* 32 | 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. 33 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | */ 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | /* 40 | 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. 41 | */ 42 | } 43 | 44 | - (void)applicationDidBecomeActive:(UIApplication *)application 45 | { 46 | /* 47 | 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. 48 | */ 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application 52 | { 53 | /* 54 | Called when the application is about to terminate. 55 | Save data if appropriate. 56 | See also applicationDidEnterBackground:. 57 | */ 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // iPhoneCustomFont 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | @property (weak, nonatomic) IBOutlet UITextView *tv; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // iPhoneCustomFont 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @implementation ViewController 12 | @synthesize tv; 13 | 14 | - (void)didReceiveMemoryWarning 15 | { 16 | [super didReceiveMemoryWarning]; 17 | // Release any cached data, images, etc that aren't in use. 18 | } 19 | 20 | #pragma mark - View lifecycle 21 | 22 | - (void)viewDidLoad 23 | { 24 | [super viewDidLoad]; 25 | // Do any additional setup after loading the view, typically from a nib. 26 | self.tv.font = [UIFont fontWithName:@"PT Sans" size:20]; 27 | } 28 | 29 | - (void)viewDidUnload 30 | { 31 | [self setTv:nil]; 32 | [super viewDidUnload]; 33 | // Release any retained subviews of the main view. 34 | // e.g. self.myOutlet = nil; 35 | } 36 | 37 | - (void)viewWillAppear:(BOOL)animated 38 | { 39 | [super viewWillAppear:animated]; 40 | } 41 | 42 | - (void)viewDidAppear:(BOOL)animated 43 | { 44 | [super viewDidAppear:animated]; 45 | } 46 | 47 | - (void)viewWillDisappear:(BOOL)animated 48 | { 49 | [super viewWillDisappear:animated]; 50 | } 51 | 52 | - (void)viewDidDisappear:(BOOL)animated 53 | { 54 | [super viewDidDisappear:animated]; 55 | } 56 | 57 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 58 | { 59 | // Return YES for supported orientations 60 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/en.lproj/MainStoryboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/iPhoneCustomFont-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | me.venj.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIMainStoryboardFile 30 | MainStoryboard 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIAppFonts 42 | 43 | PTSans.ttc 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/iPhoneCustomFont-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'iPhoneCustomFont' target in the 'iPhoneCustomFont' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /iPhoneCustomFont/iPhoneCustomFont/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iPhoneCustomFont 4 | // 5 | // Created by Venj Chu on 12/01/10. 6 | // Copyright (c) 2012年 Home. 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 | --------------------------------------------------------------------------------