diff --git a/.gitmodules b/.gitmodules index 2d1da9f2..3757d635 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Vendor/curry"] path = Vendor/curry - url = git@github.com:devinross/curry.git + url = https://github.com/devinross/curry.git diff --git a/Examples/Assets/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/Assets/Images.xcassets/AppIcon.appiconset/Contents.json index 0e88df66..1bb1d1b0 100644 --- a/Examples/Assets/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Examples/Assets/Images.xcassets/AppIcon.appiconset/Contents.json @@ -100,9 +100,9 @@ "scale" : "2x" }, { - "idiom" : "car", - "size" : "120x120", - "scale" : "1x" + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" }, { "size" : "24x24", @@ -158,6 +158,11 @@ "role" : "quickLook", "subtype" : "42mm" }, + { + "idiom" : "car", + "size" : "120x120", + "scale" : "1x" + }, { "size" : "40x40", "idiom" : "watch", diff --git a/Examples/Classes/AlertsViewController.h b/Examples/Classes/AlertsViewController.h index 76705f49..58bfb88d 100644 --- a/Examples/Classes/AlertsViewController.h +++ b/Examples/Classes/AlertsViewController.h @@ -30,9 +30,6 @@ */ @import UIKit; -@import tapku; - -//@import tapku; @interface AlertsViewController : UIViewController diff --git a/Examples/Classes/AppDelegate.h b/Examples/Classes/AppDelegate.h index 43503f98..cac5a3bc 100644 --- a/Examples/Classes/AppDelegate.h +++ b/Examples/Classes/AppDelegate.h @@ -31,7 +31,7 @@ @import UIKit; -@import tapku; + @class LeftTableViewController, DetailViewController; @class RootViewController; diff --git a/Examples/Classes/CalendarDayViewController.h b/Examples/Classes/CalendarDayViewController.h index 6af26dbb..35ead92c 100644 --- a/Examples/Classes/CalendarDayViewController.h +++ b/Examples/Classes/CalendarDayViewController.h @@ -29,7 +29,6 @@ */ -@import tapku; @import UIKit; @interface CalendarDayViewController : TKCalendarDayViewController diff --git a/Examples/Classes/CalendarMonthViewController.h b/Examples/Classes/CalendarMonthViewController.h index 0f3a8c0a..fb98baf8 100755 --- a/Examples/Classes/CalendarMonthViewController.h +++ b/Examples/Classes/CalendarMonthViewController.h @@ -29,7 +29,6 @@ */ -@import tapku; @import UIKit; #pragma mark - CalendarMonthViewController diff --git a/Examples/Classes/CoverflowViewController.h b/Examples/Classes/CoverflowViewController.h index ae2f05b0..c0e5e22f 100755 --- a/Examples/Classes/CoverflowViewController.h +++ b/Examples/Classes/CoverflowViewController.h @@ -29,7 +29,6 @@ */ @import UIKit; -@import tapku; #pragma mark - CoverflowViewController @interface CoverflowViewController : UIViewController diff --git a/Examples/Classes/DetailViewController.h b/Examples/Classes/DetailViewController.h index a6244f13..3305979e 100644 --- a/Examples/Classes/DetailViewController.h +++ b/Examples/Classes/DetailViewController.h @@ -31,7 +31,7 @@ @import UIKit; -@import tapku; + @interface DetailViewController : UIViewController diff --git a/Examples/Classes/EmptyViewController.h b/Examples/Classes/EmptyViewController.h index d86e9938..f2ff62b6 100755 --- a/Examples/Classes/EmptyViewController.h +++ b/Examples/Classes/EmptyViewController.h @@ -30,8 +30,6 @@ */ -@import tapku; - @interface EmptyViewController : UIViewController @property (nonatomic,strong) TKEmptyView *emptyView; diff --git a/Examples/Classes/ImageCenterViewController.h b/Examples/Classes/ImageCenterViewController.h index f7ca297b..843ffc3d 100755 --- a/Examples/Classes/ImageCenterViewController.h +++ b/Examples/Classes/ImageCenterViewController.h @@ -30,7 +30,6 @@ */ @import UIKit; -@import tapku; @interface ImageCenterViewController : TKTableViewController diff --git a/Examples/Classes/IndicatorsViewController.h b/Examples/Classes/IndicatorsViewController.h index 0b5f7458..fd5c613b 100755 --- a/Examples/Classes/IndicatorsViewController.h +++ b/Examples/Classes/IndicatorsViewController.h @@ -29,9 +29,6 @@ */ - -@import tapku; - @interface IndicatorsViewController : UIViewController @property (nonatomic,strong) TKProgressBarView *progressBar; diff --git a/Examples/Classes/LabelViewController.h b/Examples/Classes/LabelViewController.h index 810ff8eb..9777f1b9 100755 --- a/Examples/Classes/LabelViewController.h +++ b/Examples/Classes/LabelViewController.h @@ -29,9 +29,6 @@ */ - -@import tapku; - @interface LabelViewController : UITableViewController @property (nonatomic,strong) NSArray *cells; diff --git a/Examples/Classes/MoreCellsViewController.h b/Examples/Classes/MoreCellsViewController.h index 98a4d6ae..29ea9a5f 100755 --- a/Examples/Classes/MoreCellsViewController.h +++ b/Examples/Classes/MoreCellsViewController.h @@ -30,7 +30,6 @@ */ @import UIKit; -@import tapku; #pragma mark - MoreCellsViewController @interface MoreCellsViewController : UITableViewController diff --git a/Examples/Classes/NetworkRequestProgressViewController.h b/Examples/Classes/NetworkRequestProgressViewController.h index 2f96d846..e38163b3 100644 --- a/Examples/Classes/NetworkRequestProgressViewController.h +++ b/Examples/Classes/NetworkRequestProgressViewController.h @@ -30,7 +30,6 @@ */ @import UIKit; -@import tapku; @interface NetworkRequestProgressViewController : TKViewController diff --git a/Examples/Classes/RootViewController.h b/Examples/Classes/RootViewController.h index d270a26e..2879e9e7 100755 --- a/Examples/Classes/RootViewController.h +++ b/Examples/Classes/RootViewController.h @@ -30,7 +30,7 @@ */ @import UIKit; -@import tapku; + @class DetailViewController; @interface RootViewController : TKTableViewController diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index c6a3d9f3..f1aaebd9 100755 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -44,59 +44,33 @@ 2052AFC9168B840B00A49526 /* cover_9.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 2052AFAE168B840B00A49526 /* cover_9.jpeg */; }; 20CAEA9216F4EE6400D347E1 /* CalendarDayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 20CAEA9116F4EE6400D347E1 /* CalendarDayViewController.m */; }; 20DAFB071814BB0D00EF525B /* ButtonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 20DAFB061814BB0D00EF525B /* ButtonViewController.m */; }; - 20F156441B44A81400D49391 /* curry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20F156431B44A81400D49391 /* curry.framework */; }; - 20F156451B44A81400D49391 /* curry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 20F156431B44A81400D49391 /* curry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 20F156481B44A81400D49391 /* tapku.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 200B63461AD808260049E35C /* tapku.framework */; }; - 20F156491B44A81400D49391 /* tapku.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 200B63461AD808260049E35C /* tapku.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 3BF88C1B11E547BE00C9FC43 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF88BEB11E547A000C9FC43 /* QuartzCore.framework */; }; + 6B839B521CF53B95002B1009 /* TapkuLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B839B4F1CF53B86002B1009 /* TapkuLibrary.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 200B63451AD808260049E35C /* PBXContainerItemProxy */ = { + 6B839B4E1CF53B86002B1009 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 200B633D1AD808260049E35C /* tapku.xcodeproj */; + containerPortal = 6B839B4A1CF53B86002B1009 /* TapkuLibrary.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 204C73E11ABA0EA600A68988; - remoteInfo = tapku; + remoteGlobalIDString = 6B6D79431CF53575000753C1; + remoteInfo = TapkuLibrary; }; - 200B63471AD808260049E35C /* PBXContainerItemProxy */ = { + 6B839B571CF53BD6002B1009 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 200B633D1AD808260049E35C /* tapku.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3B45DDF1134C736600D24C1A; - remoteInfo = LogicTests; - }; - 20F1564A1B44A81400D49391 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 200B633D1AD808260049E35C /* tapku.xcodeproj */; + containerPortal = 6B839B4A1CF53B86002B1009 /* TapkuLibrary.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 204C73E01ABA0EA600A68988; - remoteInfo = tapku; + remoteGlobalIDString = 6B6D79421CF53575000753C1; + remoteInfo = TapkuLibrary; }; /* End PBXContainerItemProxy section */ -/* Begin PBXCopyFilesBuildPhase section */ - 204C74051ABA0EBD00A68988 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 20F156491B44A81400D49391 /* tapku.framework in Embed Frameworks */, - 20F156451B44A81400D49391 /* curry.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - /* Begin PBXFileReference section */ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* unviersaldemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = unviersaldemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 200B63391AD807B60049E35C /* TapkuLibrary.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = TapkuLibrary.bundle; path = ../../TapkuLibrary.bundle; sourceTree = ""; }; - 200B633D1AD808260049E35C /* tapku.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tapku.xcodeproj; path = ../tapku.xcodeproj; sourceTree = ""; }; 200B634F1AD808E20049E35C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 2052AF6B168B83C600A49526 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 2052AF6E168B83E900A49526 /* AlertsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlertsViewController.h; sourceTree = ""; }; @@ -145,10 +119,10 @@ 20CAEA9116F4EE6400D347E1 /* CalendarDayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CalendarDayViewController.m; sourceTree = ""; }; 20DAFB051814BB0D00EF525B /* ButtonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonViewController.h; sourceTree = ""; }; 20DAFB061814BB0D00EF525B /* ButtonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ButtonViewController.m; sourceTree = ""; }; - 20F156431B44A81400D49391 /* curry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = curry.framework; path = "/Users/devinross/Library/Developer/Xcode/DerivedData/Examples-etjsrqeqzrntgvblytwmtovcigmm/Build/Products/Debug-iphoneos/curry.framework"; sourceTree = ""; }; 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32CA4F630368D1EE00C91783 /* Examples_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Examples_Prefix.pch; sourceTree = ""; }; 3BF88BEB11E547A000C9FC43 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 6B839B4A1CF53B86002B1009 /* TapkuLibrary.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TapkuLibrary.xcodeproj; path = ../TapkuLibrary.xcodeproj; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Examples-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Examples-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -157,11 +131,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 20F156481B44A81400D49391 /* tapku.framework in Frameworks */, + 6B839B521CF53B95002B1009 /* TapkuLibrary.framework in Frameworks */, 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, - 20F156441B44A81400D49391 /* curry.framework in Frameworks */, 3BF88C1B11E547BE00C9FC43 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -177,15 +150,6 @@ name = Products; sourceTree = ""; }; - 200B633E1AD808260049E35C /* Products */ = { - isa = PBXGroup; - children = ( - 200B63461AD808260049E35C /* tapku.framework */, - 200B63481AD808260049E35C /* LogicTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; 2052AF6D168B83E900A49526 /* Classes */ = { isa = PBXGroup; children = ( @@ -307,7 +271,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( - 200B633D1AD808260049E35C /* tapku.xcodeproj */, + 6B839B4A1CF53B86002B1009 /* TapkuLibrary.xcodeproj */, 2052AF6D168B83E900A49526 /* Classes */, 2052AF95168B840B00A49526 /* Assets */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -330,7 +294,6 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - 20F156431B44A81400D49391 /* curry.framework */, 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 1D30AB110D05D00D00671497 /* Foundation.framework */, 288765FC0DF74451002DB57D /* CoreGraphics.framework */, @@ -339,6 +302,14 @@ name = Frameworks; sourceTree = ""; }; + 6B839B4B1CF53B86002B1009 /* Products */ = { + isa = PBXGroup; + children = ( + 6B839B4F1CF53B86002B1009 /* TapkuLibrary.framework */, + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -349,12 +320,11 @@ 1D60588D0D05DD3D006BFB54 /* Resources */, 1D60588E0D05DD3D006BFB54 /* Sources */, 1D60588F0D05DD3D006BFB54 /* Frameworks */, - 204C74051ABA0EBD00A68988 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( - 20F1564B1B44A81400D49391 /* PBXTargetDependency */, + 6B839B581CF53BD6002B1009 /* PBXTargetDependency */, ); name = Examples; productName = unviersaldemo; @@ -368,6 +338,11 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0700; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = XHCY9U39JW; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Examples" */; compatibilityVersion = "Xcode 3.2"; @@ -383,8 +358,8 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = 200B633E1AD808260049E35C /* Products */; - ProjectRef = 200B633D1AD808260049E35C /* tapku.xcodeproj */; + ProductGroup = 6B839B4B1CF53B86002B1009 /* Products */; + ProjectRef = 6B839B4A1CF53B86002B1009 /* TapkuLibrary.xcodeproj */; }, ); projectRoot = ""; @@ -395,18 +370,11 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 200B63461AD808260049E35C /* tapku.framework */ = { + 6B839B4F1CF53B86002B1009 /* TapkuLibrary.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = tapku.framework; - remoteRef = 200B63451AD808260049E35C /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 200B63481AD808260049E35C /* LogicTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = LogicTests.xctest; - remoteRef = 200B63471AD808260049E35C /* PBXContainerItemProxy */; + path = TapkuLibrary.framework; + remoteRef = 6B839B4E1CF53B86002B1009 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -467,10 +435,10 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 20F1564B1B44A81400D49391 /* PBXTargetDependency */ = { + 6B839B581CF53BD6002B1009 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = tapku; - targetProxy = 20F1564A1B44A81400D49391 /* PBXContainerItemProxy */; + name = TapkuLibrary; + targetProxy = 6B839B571CF53BD6002B1009 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -483,18 +451,19 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/Examples-etjsrqeqzrntgvblytwmtovcigmm/Build/Products/Debug-iphoneos", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Examples_Prefix.pch; GCC_VERSION = ""; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../TapkuLibrary", + ); INFOPLIST_FILE = "Examples-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -516,17 +485,18 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = YES; DEFINES_MODULE = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/Examples-etjsrqeqzrntgvblytwmtovcigmm/Build/Products/Debug-iphoneos", - ); + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Examples_Prefix.pch; GCC_VERSION = ""; - HEADER_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../TapkuLibrary", + ); INFOPLIST_FILE = "Examples-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/Examples/Examples_Prefix.pch b/Examples/Examples_Prefix.pch index 1df325bc..f2284355 100644 --- a/Examples/Examples_Prefix.pch +++ b/Examples/Examples_Prefix.pch @@ -5,6 +5,6 @@ #ifdef __OBJC__ @import Foundation; @import UIKit; - @import tapku; - //#import + + #import "TapkuLibrary.h" #endif diff --git a/STapkuLibrary.podspec b/STapkuLibrary.podspec new file mode 100755 index 00000000..bd0e457e --- /dev/null +++ b/STapkuLibrary.podspec @@ -0,0 +1,37 @@ + + +Pod::Spec.new do |s| + + s.name = "STapkuLibrary" + s.version = "1.1.0" + s.summary = "Sjw change adaptation iPad" + + s.description = <<-DESC +TODO: Add long description of the pod here.Sjw change adaptation iPad + DESC + + s.homepage = "https://github.com/devinross/tapkulibrary" + + s.license = { :type => "MIT", :file => "License.txt" } + + + s.author = { "sujiewen" => "sujiewen@qq.com" } + + s.platform = :ios, "7.0" + + s.source = { :git => "https://github.com/sujiewen/STapkuLibrary.git", :tag => "1.1.0" } + + s.source_files = "TapkuLibrary/**/*.{h,m}" + + s.public_header_files = "TapkuLibrary/**/*.h" + + s.resource = "TapkuLibrary.bundle" + + s.frameworks = "UIKit", "Foundation","QuartzCore" + + s.requires_arc = true + + # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } + # s.dependency "JSONKit", "~> 1.4" + +end diff --git a/STapkuLibrary.xcodeproj/project.pbxproj b/STapkuLibrary.xcodeproj/project.pbxproj new file mode 100644 index 00000000..5d1efc4f --- /dev/null +++ b/STapkuLibrary.xcodeproj/project.pbxproj @@ -0,0 +1,926 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 6B6D79AC1CF535FC000753C1 /* NSArray+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D794E1CF535FC000753C1 /* NSArray+TKCategory.h */; }; + 6B6D79AD1CF535FC000753C1 /* NSArray+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D794F1CF535FC000753C1 /* NSArray+TKCategory.m */; }; + 6B6D79AE1CF535FC000753C1 /* NSDate+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79501CF535FC000753C1 /* NSDate+TKCategory.h */; }; + 6B6D79AF1CF535FC000753C1 /* NSDate+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79511CF535FC000753C1 /* NSDate+TKCategory.m */; }; + 6B6D79B01CF535FC000753C1 /* NSMutableArray+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79521CF535FC000753C1 /* NSMutableArray+TKCategory.h */; }; + 6B6D79B11CF535FC000753C1 /* NSMutableArray+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79531CF535FC000753C1 /* NSMutableArray+TKCategory.m */; }; + 6B6D79B21CF535FC000753C1 /* NSObject+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79541CF535FC000753C1 /* NSObject+TKCategory.h */; }; + 6B6D79B31CF535FC000753C1 /* NSObject+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79551CF535FC000753C1 /* NSObject+TKCategory.m */; }; + 6B6D79B41CF535FC000753C1 /* NSString+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79561CF535FC000753C1 /* NSString+TKCategory.h */; }; + 6B6D79B51CF535FC000753C1 /* NSString+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79571CF535FC000753C1 /* NSString+TKCategory.m */; }; + 6B6D79B81CF535FC000753C1 /* TKCardModalViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D795A1CF535FC000753C1 /* TKCardModalViewController.h */; }; + 6B6D79B91CF535FC000753C1 /* TKCardModalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D795B1CF535FC000753C1 /* TKCardModalViewController.m */; }; + 6B6D79BA1CF535FC000753C1 /* TKDecimalInputView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D795C1CF535FC000753C1 /* TKDecimalInputView.h */; }; + 6B6D79BB1CF535FC000753C1 /* TKDecimalInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D795D1CF535FC000753C1 /* TKDecimalInputView.m */; }; + 6B6D79BC1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D795E1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.h */; }; + 6B6D79BD1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D795F1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.m */; }; + 6B6D79BE1CF535FC000753C1 /* TKGlowButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79601CF535FC000753C1 /* TKGlowButton.h */; }; + 6B6D79BF1CF535FC000753C1 /* TKGlowButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79611CF535FC000753C1 /* TKGlowButton.m */; }; + 6B6D79C01CF535FC000753C1 /* TKGradientView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79621CF535FC000753C1 /* TKGradientView.h */; }; + 6B6D79C11CF535FC000753C1 /* TKGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79631CF535FC000753C1 /* TKGradientView.m */; }; + 6B6D79C21CF535FC000753C1 /* TKInputKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79641CF535FC000753C1 /* TKInputKey.h */; }; + 6B6D79C31CF535FC000753C1 /* TKInputKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79651CF535FC000753C1 /* TKInputKey.m */; }; + 6B6D79C41CF535FC000753C1 /* TKInputView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79661CF535FC000753C1 /* TKInputView.h */; }; + 6B6D79C51CF535FC000753C1 /* TKInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79671CF535FC000753C1 /* TKInputView.m */; }; + 6B6D79C61CF535FC000753C1 /* TKKeyboardTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79681CF535FC000753C1 /* TKKeyboardTableViewController.h */; }; + 6B6D79C71CF535FC000753C1 /* TKKeyboardTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79691CF535FC000753C1 /* TKKeyboardTableViewController.m */; }; + 6B6D79C81CF535FC000753C1 /* TKLoadingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D796A1CF535FC000753C1 /* TKLoadingView.h */; }; + 6B6D79C91CF535FC000753C1 /* TKLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D796B1CF535FC000753C1 /* TKLoadingView.m */; }; + 6B6D79CA1CF535FC000753C1 /* TKMultiSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D796C1CF535FC000753C1 /* TKMultiSwitch.h */; }; + 6B6D79CB1CF535FC000753C1 /* TKMultiSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D796D1CF535FC000753C1 /* TKMultiSwitch.m */; }; + 6B6D79CC1CF535FC000753C1 /* TKNumberInputView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D796E1CF535FC000753C1 /* TKNumberInputView.h */; }; + 6B6D79CD1CF535FC000753C1 /* TKNumberInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D796F1CF535FC000753C1 /* TKNumberInputView.m */; }; + 6B6D79CE1CF535FC000753C1 /* TKNumberInputWithNextKeyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79701CF535FC000753C1 /* TKNumberInputWithNextKeyView.h */; }; + 6B6D79CF1CF535FC000753C1 /* TKNumberInputWithNextKeyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79711CF535FC000753C1 /* TKNumberInputWithNextKeyView.m */; }; + 6B6D79D01CF535FC000753C1 /* TKPegSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79721CF535FC000753C1 /* TKPegSlider.h */; }; + 6B6D79D11CF535FC000753C1 /* TKPegSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79731CF535FC000753C1 /* TKPegSlider.m */; }; + 6B6D79D21CF535FC000753C1 /* TKShapeView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79741CF535FC000753C1 /* TKShapeView.h */; }; + 6B6D79D31CF535FC000753C1 /* TKShapeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79751CF535FC000753C1 /* TKShapeView.m */; }; + 6B6D79D41CF535FC000753C1 /* TKShimmerLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79761CF535FC000753C1 /* TKShimmerLabel.h */; }; + 6B6D79D51CF535FC000753C1 /* TKShimmerLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79771CF535FC000753C1 /* TKShimmerLabel.m */; }; + 6B6D79D61CF535FC000753C1 /* TKSlideToUnlockView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79781CF535FC000753C1 /* TKSlideToUnlockView.h */; }; + 6B6D79D71CF535FC000753C1 /* TKSlideToUnlockView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79791CF535FC000753C1 /* TKSlideToUnlockView.m */; }; + 6B6D79D81CF535FC000753C1 /* TKSoundAlertController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D797A1CF535FC000753C1 /* TKSoundAlertController.h */; }; + 6B6D79D91CF535FC000753C1 /* TKSoundAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D797B1CF535FC000753C1 /* TKSoundAlertController.m */; }; + 6B6D79DA1CF535FC000753C1 /* TKStepperCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D797C1CF535FC000753C1 /* TKStepperCell.h */; }; + 6B6D79DB1CF535FC000753C1 /* TKStepperCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D797D1CF535FC000753C1 /* TKStepperCell.m */; }; + 6B6D79DC1CF535FC000753C1 /* TKSwitchCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D797E1CF535FC000753C1 /* TKSwitchCell.h */; }; + 6B6D79DD1CF535FC000753C1 /* TKSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D797F1CF535FC000753C1 /* TKSwitchCell.m */; }; + 6B6D79DE1CF535FC000753C1 /* TKTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79801CF535FC000753C1 /* TKTableViewController.h */; }; + 6B6D79DF1CF535FC000753C1 /* TKTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79811CF535FC000753C1 /* TKTableViewController.m */; }; + 6B6D79E01CF535FC000753C1 /* TKTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79821CF535FC000753C1 /* TKTextFieldCell.h */; }; + 6B6D79E11CF535FC000753C1 /* TKTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79831CF535FC000753C1 /* TKTextFieldCell.m */; }; + 6B6D79E21CF535FC000753C1 /* TKTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79841CF535FC000753C1 /* TKTextView.h */; }; + 6B6D79E31CF535FC000753C1 /* TKTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79851CF535FC000753C1 /* TKTextView.m */; }; + 6B6D79E41CF535FC000753C1 /* TKWebViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79861CF535FC000753C1 /* TKWebViewController.h */; }; + 6B6D79E51CF535FC000753C1 /* TKWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79871CF535FC000753C1 /* TKWebViewController.m */; }; + 6B6D79E61CF535FC000753C1 /* TKWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79881CF535FC000753C1 /* TKWindow.h */; }; + 6B6D79E71CF535FC000753C1 /* TKWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79891CF535FC000753C1 /* TKWindow.m */; }; + 6B6D79E81CF535FC000753C1 /* UIActionSheet+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D798A1CF535FC000753C1 /* UIActionSheet+TKCategory.h */; }; + 6B6D79E91CF535FC000753C1 /* UIActionSheet+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D798B1CF535FC000753C1 /* UIActionSheet+TKCategory.m */; }; + 6B6D79EA1CF535FC000753C1 /* UIAlertView+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D798C1CF535FC000753C1 /* UIAlertView+TKCategory.h */; }; + 6B6D79EB1CF535FC000753C1 /* UIAlertView+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D798D1CF535FC000753C1 /* UIAlertView+TKCategory.m */; }; + 6B6D79EC1CF535FC000753C1 /* UIBarButtonItem+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D798E1CF535FC000753C1 /* UIBarButtonItem+TKCategory.h */; }; + 6B6D79ED1CF535FC000753C1 /* UIBarButtonItem+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D798F1CF535FC000753C1 /* UIBarButtonItem+TKCategory.m */; }; + 6B6D79EE1CF535FC000753C1 /* UIButton+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79901CF535FC000753C1 /* UIButton+TKCategory.h */; }; + 6B6D79EF1CF535FC000753C1 /* UIButton+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79911CF535FC000753C1 /* UIButton+TKCategory.m */; }; + 6B6D79F01CF535FC000753C1 /* UIColor+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79921CF535FC000753C1 /* UIColor+TKCategory.h */; }; + 6B6D79F11CF535FC000753C1 /* UIColor+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79931CF535FC000753C1 /* UIColor+TKCategory.m */; }; + 6B6D79F21CF535FC000753C1 /* UIDevice+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79941CF535FC000753C1 /* UIDevice+TKCategory.h */; }; + 6B6D79F31CF535FC000753C1 /* UIDevice+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79951CF535FC000753C1 /* UIDevice+TKCategory.m */; }; + 6B6D79F41CF535FC000753C1 /* UIFont+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79961CF535FC000753C1 /* UIFont+TKCategory.h */; }; + 6B6D79F51CF535FC000753C1 /* UIFont+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79971CF535FC000753C1 /* UIFont+TKCategory.m */; }; + 6B6D79F61CF535FC000753C1 /* UIGestureRecognizer+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79981CF535FC000753C1 /* UIGestureRecognizer+TKCategory.h */; }; + 6B6D79F71CF535FC000753C1 /* UIGestureRecognizer+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79991CF535FC000753C1 /* UIGestureRecognizer+TKCategory.m */; }; + 6B6D79F81CF535FC000753C1 /* UIImagePickerController+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D799A1CF535FC000753C1 /* UIImagePickerController+TKCategory.h */; }; + 6B6D79F91CF535FC000753C1 /* UIImagePickerController+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D799B1CF535FC000753C1 /* UIImagePickerController+TKCategory.m */; }; + 6B6D79FA1CF535FC000753C1 /* UIImageView+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D799C1CF535FC000753C1 /* UIImageView+TKCategory.h */; }; + 6B6D79FB1CF535FC000753C1 /* UIImageView+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D799D1CF535FC000753C1 /* UIImageView+TKCategory.m */; }; + 6B6D79FC1CF535FC000753C1 /* UILabel+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D799E1CF535FC000753C1 /* UILabel+TKCategory.h */; }; + 6B6D79FD1CF535FC000753C1 /* UILabel+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D799F1CF535FC000753C1 /* UILabel+TKCategory.m */; }; + 6B6D79FE1CF535FC000753C1 /* UINavigationBar+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79A01CF535FC000753C1 /* UINavigationBar+TKCategory.h */; }; + 6B6D79FF1CF535FC000753C1 /* UINavigationBar+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79A11CF535FC000753C1 /* UINavigationBar+TKCategory.m */; }; + 6B6D7A001CF535FC000753C1 /* UIScreen+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79A21CF535FC000753C1 /* UIScreen+TKCategory.h */; }; + 6B6D7A011CF535FC000753C1 /* UIScreen+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79A31CF535FC000753C1 /* UIScreen+TKCategory.m */; }; + 6B6D7A021CF535FC000753C1 /* UIScrollview+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79A41CF535FC000753C1 /* UIScrollview+TKCategory.h */; }; + 6B6D7A031CF535FC000753C1 /* UIScrollview+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79A51CF535FC000753C1 /* UIScrollview+TKCategory.m */; }; + 6B6D7A041CF535FC000753C1 /* UITextField+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79A61CF535FC000753C1 /* UITextField+TKCategory.h */; }; + 6B6D7A051CF535FC000753C1 /* UITextField+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79A71CF535FC000753C1 /* UITextField+TKCategory.m */; }; + 6B6D7A061CF535FC000753C1 /* UIView+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79A81CF535FC000753C1 /* UIView+TKCategory.h */; }; + 6B6D7A071CF535FC000753C1 /* UIView+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79A91CF535FC000753C1 /* UIView+TKCategory.m */; }; + 6B6D7A081CF535FC000753C1 /* UIViewController+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D79AA1CF535FC000753C1 /* UIViewController+TKCategory.h */; }; + 6B6D7A091CF535FC000753C1 /* UIViewController+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D79AB1CF535FC000753C1 /* UIViewController+TKCategory.m */; }; + 6B6D7A0D1CF5363F000753C1 /* STapkuLibrary_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A0B1CF5363F000753C1 /* STapkuLibrary_Prefix.pch */; }; + 6B6D7A0E1CF5363F000753C1 /* TapkuLibrary.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 6B6D7A0C1CF5363F000753C1 /* TapkuLibrary.bundle */; }; + 6B6D7A501CF538D8000753C1 /* NSDate+CalendarGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A0F1CF538D8000753C1 /* NSDate+CalendarGrid.h */; }; + 6B6D7A511CF538D8000753C1 /* NSDate+CalendarGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A101CF538D8000753C1 /* NSDate+CalendarGrid.m */; }; + 6B6D7A521CF538D8000753C1 /* TapkuLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A111CF538D8000753C1 /* TapkuLibrary.h */; }; + 6B6D7A531CF538D8000753C1 /* TKAlertCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A121CF538D8000753C1 /* TKAlertCenter.h */; }; + 6B6D7A541CF538D8000753C1 /* TKAlertCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A131CF538D8000753C1 /* TKAlertCenter.m */; }; + 6B6D7A551CF538D8000753C1 /* TKAlertViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A141CF538D8000753C1 /* TKAlertViewController.h */; }; + 6B6D7A561CF538D8000753C1 /* TKAlertViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A151CF538D8000753C1 /* TKAlertViewController.m */; }; + 6B6D7A571CF538D8000753C1 /* TKAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A161CF538D8000753C1 /* TKAppDelegate.h */; }; + 6B6D7A581CF538D8000753C1 /* TKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A171CF538D8000753C1 /* TKAppDelegate.m */; }; + 6B6D7A591CF538D8000753C1 /* TKButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A181CF538D8000753C1 /* TKButtonCell.h */; }; + 6B6D7A5A1CF538D8000753C1 /* TKButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A191CF538D8000753C1 /* TKButtonCell.m */; }; + 6B6D7A5B1CF538D8000753C1 /* TKCalendarDayEventView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A1A1CF538D8000753C1 /* TKCalendarDayEventView.h */; }; + 6B6D7A5C1CF538D8000753C1 /* TKCalendarDayEventView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A1B1CF538D8000753C1 /* TKCalendarDayEventView.m */; }; + 6B6D7A5D1CF538D8000753C1 /* TKCalendarDayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A1C1CF538D8000753C1 /* TKCalendarDayView.h */; }; + 6B6D7A5E1CF538D8000753C1 /* TKCalendarDayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A1D1CF538D8000753C1 /* TKCalendarDayView.m */; }; + 6B6D7A611CF538D8000753C1 /* TKCalendarDayViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A201CF538D8000753C1 /* TKCalendarDayViewController.h */; }; + 6B6D7A621CF538D8000753C1 /* TKCalendarDayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A211CF538D8000753C1 /* TKCalendarDayViewController.m */; }; + 6B6D7A631CF538D8000753C1 /* TKCalendarMonthTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A221CF538D8000753C1 /* TKCalendarMonthTableViewController.h */; }; + 6B6D7A641CF538D8000753C1 /* TKCalendarMonthTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A231CF538D8000753C1 /* TKCalendarMonthTableViewController.m */; }; + 6B6D7A651CF538D8000753C1 /* TKCalendarMonthView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A241CF538D8000753C1 /* TKCalendarMonthView.h */; }; + 6B6D7A661CF538D8000753C1 /* TKCalendarMonthView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A251CF538D8000753C1 /* TKCalendarMonthView.m */; }; + 6B6D7A671CF538D8000753C1 /* TKCalendarMonthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A261CF538D8000753C1 /* TKCalendarMonthViewController.h */; }; + 6B6D7A681CF538D8000753C1 /* TKCalendarMonthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A271CF538D8000753C1 /* TKCalendarMonthViewController.m */; }; + 6B6D7A691CF538D8000753C1 /* TKCoverflowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A281CF538D8000753C1 /* TKCoverflowView.h */; }; + 6B6D7A6A1CF538D8000753C1 /* TKCoverflowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A291CF538D8000753C1 /* TKCoverflowView.m */; }; + 6B6D7A6B1CF538D8000753C1 /* TKEmptyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A2A1CF538D8000753C1 /* TKEmptyView.h */; }; + 6B6D7A6C1CF538D8000753C1 /* TKEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A2B1CF538D8000753C1 /* TKEmptyView.m */; }; + 6B6D7A6D1CF538D8000753C1 /* TKGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A2C1CF538D8000753C1 /* TKGlobal.h */; }; + 6B6D7A6E1CF538D8000753C1 /* TKGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A2D1CF538D8000753C1 /* TKGlobal.m */; }; + 6B6D7A6F1CF538D8000753C1 /* TKHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A2E1CF538D8000753C1 /* TKHTTPRequest.h */; }; + 6B6D7A701CF538D8000753C1 /* TKHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A2F1CF538D8000753C1 /* TKHTTPRequest.m */; }; + 6B6D7A711CF538D8000753C1 /* TKImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A301CF538D8000753C1 /* TKImageCache.h */; }; + 6B6D7A721CF538D8000753C1 /* TKImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A311CF538D8000753C1 /* TKImageCache.m */; }; + 6B6D7A731CF538D8000753C1 /* TKLabelCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A321CF538D8000753C1 /* TKLabelCell.h */; }; + 6B6D7A741CF538D8000753C1 /* TKLabelCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A331CF538D8000753C1 /* TKLabelCell.m */; }; + 6B6D7A751CF538D8000753C1 /* TKLabelFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A341CF538D8000753C1 /* TKLabelFieldCell.h */; }; + 6B6D7A761CF538D8000753C1 /* TKLabelFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A351CF538D8000753C1 /* TKLabelFieldCell.m */; }; + 6B6D7A771CF538D8000753C1 /* TKLabelSwitchCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A361CF538D8000753C1 /* TKLabelSwitchCell.h */; }; + 6B6D7A781CF538D8000753C1 /* TKLabelSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A371CF538D8000753C1 /* TKLabelSwitchCell.m */; }; + 6B6D7A791CF538D8000753C1 /* TKLabelTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A381CF538D8000753C1 /* TKLabelTextFieldCell.h */; }; + 6B6D7A7A1CF538D8000753C1 /* TKLabelTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A391CF538D8000753C1 /* TKLabelTextFieldCell.m */; }; + 6B6D7A7B1CF538D8000753C1 /* TKLabelTextViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A3A1CF538D8000753C1 /* TKLabelTextViewCell.h */; }; + 6B6D7A7C1CF538D8000753C1 /* TKLabelTextViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A3B1CF538D8000753C1 /* TKLabelTextViewCell.m */; }; + 6B6D7A7D1CF538D8000753C1 /* TKNetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A3C1CF538D8000753C1 /* TKNetworkQueue.h */; }; + 6B6D7A7E1CF538D8000753C1 /* TKNetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A3D1CF538D8000753C1 /* TKNetworkQueue.m */; }; + 6B6D7A7F1CF538D8000753C1 /* TKProgressAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A3E1CF538D8000753C1 /* TKProgressAlertView.h */; }; + 6B6D7A801CF538D8000753C1 /* TKProgressAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A3F1CF538D8000753C1 /* TKProgressAlertView.m */; }; + 6B6D7A811CF538D8000753C1 /* TKProgressBarView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A401CF538D8000753C1 /* TKProgressBarView.h */; }; + 6B6D7A821CF538D8000753C1 /* TKProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A411CF538D8000753C1 /* TKProgressBarView.m */; }; + 6B6D7A831CF538D8000753C1 /* TKProgressCircleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A421CF538D8000753C1 /* TKProgressCircleView.h */; }; + 6B6D7A841CF538D8000753C1 /* TKProgressCircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A431CF538D8000753C1 /* TKProgressCircleView.m */; }; + 6B6D7A851CF538D8000753C1 /* TKReorderTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A441CF538D8000753C1 /* TKReorderTableView.h */; }; + 6B6D7A861CF538D8000753C1 /* TKReorderTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A451CF538D8000753C1 /* TKReorderTableView.m */; }; + 6B6D7A871CF538D8000753C1 /* TKRetroButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A461CF538D8000753C1 /* TKRetroButton.h */; }; + 6B6D7A881CF538D8000753C1 /* TKRetroButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A471CF538D8000753C1 /* TKRetroButton.m */; }; + 6B6D7A891CF538D8000753C1 /* TKTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A481CF538D8000753C1 /* TKTableViewCell.h */; }; + 6B6D7A8A1CF538D8000753C1 /* TKTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A491CF538D8000753C1 /* TKTableViewCell.m */; }; + 6B6D7A8B1CF538D8000753C1 /* TKTextViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A4A1CF538D8000753C1 /* TKTextViewCell.h */; }; + 6B6D7A8C1CF538D8000753C1 /* TKTextViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A4B1CF538D8000753C1 /* TKTextViewCell.m */; }; + 6B6D7A8D1CF538D8000753C1 /* TKViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A4C1CF538D8000753C1 /* TKViewController.h */; }; + 6B6D7A8E1CF538D8000753C1 /* TKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A4D1CF538D8000753C1 /* TKViewController.m */; }; + 6B6D7A8F1CF538D8000753C1 /* UIImage+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B6D7A4E1CF538D8000753C1 /* UIImage+TKCategory.h */; }; + 6B6D7A901CF538D8000753C1 /* UIImage+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6D7A4F1CF538D8000753C1 /* UIImage+TKCategory.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 6B6D79431CF53575000753C1 /* STapkuLibrary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = STapkuLibrary.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B6D79481CF53575000753C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6B6D794E1CF535FC000753C1 /* NSArray+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+TKCategory.h"; sourceTree = ""; }; + 6B6D794F1CF535FC000753C1 /* NSArray+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+TKCategory.m"; sourceTree = ""; }; + 6B6D79501CF535FC000753C1 /* NSDate+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+TKCategory.h"; sourceTree = ""; }; + 6B6D79511CF535FC000753C1 /* NSDate+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+TKCategory.m"; sourceTree = ""; }; + 6B6D79521CF535FC000753C1 /* NSMutableArray+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+TKCategory.h"; sourceTree = ""; }; + 6B6D79531CF535FC000753C1 /* NSMutableArray+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+TKCategory.m"; sourceTree = ""; }; + 6B6D79541CF535FC000753C1 /* NSObject+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+TKCategory.h"; sourceTree = ""; }; + 6B6D79551CF535FC000753C1 /* NSObject+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+TKCategory.m"; sourceTree = ""; }; + 6B6D79561CF535FC000753C1 /* NSString+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+TKCategory.h"; sourceTree = ""; }; + 6B6D79571CF535FC000753C1 /* NSString+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+TKCategory.m"; sourceTree = ""; }; + 6B6D795A1CF535FC000753C1 /* TKCardModalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCardModalViewController.h; sourceTree = ""; }; + 6B6D795B1CF535FC000753C1 /* TKCardModalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCardModalViewController.m; sourceTree = ""; }; + 6B6D795C1CF535FC000753C1 /* TKDecimalInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKDecimalInputView.h; sourceTree = ""; }; + 6B6D795D1CF535FC000753C1 /* TKDecimalInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKDecimalInputView.m; sourceTree = ""; }; + 6B6D795E1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKDecimalInputWithNextKeyView.h; sourceTree = ""; }; + 6B6D795F1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKDecimalInputWithNextKeyView.m; sourceTree = ""; }; + 6B6D79601CF535FC000753C1 /* TKGlowButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGlowButton.h; sourceTree = ""; }; + 6B6D79611CF535FC000753C1 /* TKGlowButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGlowButton.m; sourceTree = ""; }; + 6B6D79621CF535FC000753C1 /* TKGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGradientView.h; sourceTree = ""; }; + 6B6D79631CF535FC000753C1 /* TKGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGradientView.m; sourceTree = ""; }; + 6B6D79641CF535FC000753C1 /* TKInputKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKInputKey.h; sourceTree = ""; }; + 6B6D79651CF535FC000753C1 /* TKInputKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKInputKey.m; sourceTree = ""; }; + 6B6D79661CF535FC000753C1 /* TKInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKInputView.h; sourceTree = ""; }; + 6B6D79671CF535FC000753C1 /* TKInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKInputView.m; sourceTree = ""; }; + 6B6D79681CF535FC000753C1 /* TKKeyboardTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKKeyboardTableViewController.h; sourceTree = ""; }; + 6B6D79691CF535FC000753C1 /* TKKeyboardTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKKeyboardTableViewController.m; sourceTree = ""; }; + 6B6D796A1CF535FC000753C1 /* TKLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLoadingView.h; sourceTree = ""; }; + 6B6D796B1CF535FC000753C1 /* TKLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLoadingView.m; sourceTree = ""; }; + 6B6D796C1CF535FC000753C1 /* TKMultiSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKMultiSwitch.h; sourceTree = ""; }; + 6B6D796D1CF535FC000753C1 /* TKMultiSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKMultiSwitch.m; sourceTree = ""; }; + 6B6D796E1CF535FC000753C1 /* TKNumberInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKNumberInputView.h; sourceTree = ""; }; + 6B6D796F1CF535FC000753C1 /* TKNumberInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKNumberInputView.m; sourceTree = ""; }; + 6B6D79701CF535FC000753C1 /* TKNumberInputWithNextKeyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKNumberInputWithNextKeyView.h; sourceTree = ""; }; + 6B6D79711CF535FC000753C1 /* TKNumberInputWithNextKeyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKNumberInputWithNextKeyView.m; sourceTree = ""; }; + 6B6D79721CF535FC000753C1 /* TKPegSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKPegSlider.h; sourceTree = ""; }; + 6B6D79731CF535FC000753C1 /* TKPegSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKPegSlider.m; sourceTree = ""; }; + 6B6D79741CF535FC000753C1 /* TKShapeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKShapeView.h; sourceTree = ""; }; + 6B6D79751CF535FC000753C1 /* TKShapeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKShapeView.m; sourceTree = ""; }; + 6B6D79761CF535FC000753C1 /* TKShimmerLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKShimmerLabel.h; sourceTree = ""; }; + 6B6D79771CF535FC000753C1 /* TKShimmerLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKShimmerLabel.m; sourceTree = ""; }; + 6B6D79781CF535FC000753C1 /* TKSlideToUnlockView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKSlideToUnlockView.h; sourceTree = ""; }; + 6B6D79791CF535FC000753C1 /* TKSlideToUnlockView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKSlideToUnlockView.m; sourceTree = ""; }; + 6B6D797A1CF535FC000753C1 /* TKSoundAlertController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKSoundAlertController.h; sourceTree = ""; }; + 6B6D797B1CF535FC000753C1 /* TKSoundAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKSoundAlertController.m; sourceTree = ""; }; + 6B6D797C1CF535FC000753C1 /* TKStepperCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKStepperCell.h; sourceTree = ""; }; + 6B6D797D1CF535FC000753C1 /* TKStepperCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKStepperCell.m; sourceTree = ""; }; + 6B6D797E1CF535FC000753C1 /* TKSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKSwitchCell.h; sourceTree = ""; }; + 6B6D797F1CF535FC000753C1 /* TKSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKSwitchCell.m; sourceTree = ""; }; + 6B6D79801CF535FC000753C1 /* TKTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTableViewController.h; sourceTree = ""; }; + 6B6D79811CF535FC000753C1 /* TKTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTableViewController.m; sourceTree = ""; }; + 6B6D79821CF535FC000753C1 /* TKTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTextFieldCell.h; sourceTree = ""; }; + 6B6D79831CF535FC000753C1 /* TKTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTextFieldCell.m; sourceTree = ""; }; + 6B6D79841CF535FC000753C1 /* TKTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTextView.h; sourceTree = ""; }; + 6B6D79851CF535FC000753C1 /* TKTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTextView.m; sourceTree = ""; }; + 6B6D79861CF535FC000753C1 /* TKWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKWebViewController.h; sourceTree = ""; }; + 6B6D79871CF535FC000753C1 /* TKWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKWebViewController.m; sourceTree = ""; }; + 6B6D79881CF535FC000753C1 /* TKWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKWindow.h; sourceTree = ""; }; + 6B6D79891CF535FC000753C1 /* TKWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKWindow.m; sourceTree = ""; }; + 6B6D798A1CF535FC000753C1 /* UIActionSheet+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIActionSheet+TKCategory.h"; sourceTree = ""; }; + 6B6D798B1CF535FC000753C1 /* UIActionSheet+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActionSheet+TKCategory.m"; sourceTree = ""; }; + 6B6D798C1CF535FC000753C1 /* UIAlertView+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertView+TKCategory.h"; sourceTree = ""; }; + 6B6D798D1CF535FC000753C1 /* UIAlertView+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+TKCategory.m"; sourceTree = ""; }; + 6B6D798E1CF535FC000753C1 /* UIBarButtonItem+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+TKCategory.h"; sourceTree = ""; }; + 6B6D798F1CF535FC000753C1 /* UIBarButtonItem+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+TKCategory.m"; sourceTree = ""; }; + 6B6D79901CF535FC000753C1 /* UIButton+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+TKCategory.h"; sourceTree = ""; }; + 6B6D79911CF535FC000753C1 /* UIButton+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+TKCategory.m"; sourceTree = ""; }; + 6B6D79921CF535FC000753C1 /* UIColor+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+TKCategory.h"; sourceTree = ""; }; + 6B6D79931CF535FC000753C1 /* UIColor+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+TKCategory.m"; sourceTree = ""; }; + 6B6D79941CF535FC000753C1 /* UIDevice+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+TKCategory.h"; sourceTree = ""; }; + 6B6D79951CF535FC000753C1 /* UIDevice+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+TKCategory.m"; sourceTree = ""; }; + 6B6D79961CF535FC000753C1 /* UIFont+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+TKCategory.h"; sourceTree = ""; }; + 6B6D79971CF535FC000753C1 /* UIFont+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+TKCategory.m"; sourceTree = ""; }; + 6B6D79981CF535FC000753C1 /* UIGestureRecognizer+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+TKCategory.h"; sourceTree = ""; }; + 6B6D79991CF535FC000753C1 /* UIGestureRecognizer+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIGestureRecognizer+TKCategory.m"; sourceTree = ""; }; + 6B6D799A1CF535FC000753C1 /* UIImagePickerController+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImagePickerController+TKCategory.h"; sourceTree = ""; }; + 6B6D799B1CF535FC000753C1 /* UIImagePickerController+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImagePickerController+TKCategory.m"; sourceTree = ""; }; + 6B6D799C1CF535FC000753C1 /* UIImageView+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+TKCategory.h"; sourceTree = ""; }; + 6B6D799D1CF535FC000753C1 /* UIImageView+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+TKCategory.m"; sourceTree = ""; }; + 6B6D799E1CF535FC000753C1 /* UILabel+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+TKCategory.h"; sourceTree = ""; }; + 6B6D799F1CF535FC000753C1 /* UILabel+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+TKCategory.m"; sourceTree = ""; }; + 6B6D79A01CF535FC000753C1 /* UINavigationBar+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+TKCategory.h"; sourceTree = ""; }; + 6B6D79A11CF535FC000753C1 /* UINavigationBar+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+TKCategory.m"; sourceTree = ""; }; + 6B6D79A21CF535FC000753C1 /* UIScreen+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreen+TKCategory.h"; sourceTree = ""; }; + 6B6D79A31CF535FC000753C1 /* UIScreen+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScreen+TKCategory.m"; sourceTree = ""; }; + 6B6D79A41CF535FC000753C1 /* UIScrollview+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollview+TKCategory.h"; sourceTree = ""; }; + 6B6D79A51CF535FC000753C1 /* UIScrollview+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollview+TKCategory.m"; sourceTree = ""; }; + 6B6D79A61CF535FC000753C1 /* UITextField+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+TKCategory.h"; sourceTree = ""; }; + 6B6D79A71CF535FC000753C1 /* UITextField+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+TKCategory.m"; sourceTree = ""; }; + 6B6D79A81CF535FC000753C1 /* UIView+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+TKCategory.h"; sourceTree = ""; }; + 6B6D79A91CF535FC000753C1 /* UIView+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+TKCategory.m"; sourceTree = ""; }; + 6B6D79AA1CF535FC000753C1 /* UIViewController+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+TKCategory.h"; sourceTree = ""; }; + 6B6D79AB1CF535FC000753C1 /* UIViewController+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+TKCategory.m"; sourceTree = ""; }; + 6B6D7A0B1CF5363F000753C1 /* STapkuLibrary_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STapkuLibrary_Prefix.pch; sourceTree = ""; }; + 6B6D7A0C1CF5363F000753C1 /* TapkuLibrary.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TapkuLibrary.bundle; sourceTree = ""; }; + 6B6D7A0F1CF538D8000753C1 /* NSDate+CalendarGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+CalendarGrid.h"; sourceTree = ""; }; + 6B6D7A101CF538D8000753C1 /* NSDate+CalendarGrid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+CalendarGrid.m"; sourceTree = ""; }; + 6B6D7A111CF538D8000753C1 /* TapkuLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TapkuLibrary.h; sourceTree = ""; }; + 6B6D7A121CF538D8000753C1 /* TKAlertCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAlertCenter.h; sourceTree = ""; }; + 6B6D7A131CF538D8000753C1 /* TKAlertCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAlertCenter.m; sourceTree = ""; }; + 6B6D7A141CF538D8000753C1 /* TKAlertViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAlertViewController.h; sourceTree = ""; }; + 6B6D7A151CF538D8000753C1 /* TKAlertViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAlertViewController.m; sourceTree = ""; }; + 6B6D7A161CF538D8000753C1 /* TKAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAppDelegate.h; sourceTree = ""; }; + 6B6D7A171CF538D8000753C1 /* TKAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAppDelegate.m; sourceTree = ""; }; + 6B6D7A181CF538D8000753C1 /* TKButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKButtonCell.h; sourceTree = ""; }; + 6B6D7A191CF538D8000753C1 /* TKButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKButtonCell.m; sourceTree = ""; }; + 6B6D7A1A1CF538D8000753C1 /* TKCalendarDayEventView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayEventView.h; sourceTree = ""; }; + 6B6D7A1B1CF538D8000753C1 /* TKCalendarDayEventView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayEventView.m; sourceTree = ""; }; + 6B6D7A1C1CF538D8000753C1 /* TKCalendarDayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayView.h; sourceTree = ""; }; + 6B6D7A1D1CF538D8000753C1 /* TKCalendarDayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayView.m; sourceTree = ""; }; + 6B6D7A1E1CF538D8000753C1 /* TKCalendarDayView.m.orig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TKCalendarDayView.m.orig; sourceTree = ""; }; + 6B6D7A1F1CF538D8000753C1 /* TKCalendarDayView.m.patch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TKCalendarDayView.m.patch; sourceTree = ""; }; + 6B6D7A201CF538D8000753C1 /* TKCalendarDayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayViewController.h; sourceTree = ""; }; + 6B6D7A211CF538D8000753C1 /* TKCalendarDayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayViewController.m; sourceTree = ""; }; + 6B6D7A221CF538D8000753C1 /* TKCalendarMonthTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthTableViewController.h; sourceTree = ""; }; + 6B6D7A231CF538D8000753C1 /* TKCalendarMonthTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthTableViewController.m; sourceTree = ""; }; + 6B6D7A241CF538D8000753C1 /* TKCalendarMonthView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthView.h; sourceTree = ""; }; + 6B6D7A251CF538D8000753C1 /* TKCalendarMonthView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthView.m; sourceTree = ""; }; + 6B6D7A261CF538D8000753C1 /* TKCalendarMonthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthViewController.h; sourceTree = ""; }; + 6B6D7A271CF538D8000753C1 /* TKCalendarMonthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthViewController.m; sourceTree = ""; }; + 6B6D7A281CF538D8000753C1 /* TKCoverflowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCoverflowView.h; sourceTree = ""; }; + 6B6D7A291CF538D8000753C1 /* TKCoverflowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCoverflowView.m; sourceTree = ""; }; + 6B6D7A2A1CF538D8000753C1 /* TKEmptyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKEmptyView.h; sourceTree = ""; }; + 6B6D7A2B1CF538D8000753C1 /* TKEmptyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKEmptyView.m; sourceTree = ""; }; + 6B6D7A2C1CF538D8000753C1 /* TKGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGlobal.h; sourceTree = ""; }; + 6B6D7A2D1CF538D8000753C1 /* TKGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGlobal.m; sourceTree = ""; }; + 6B6D7A2E1CF538D8000753C1 /* TKHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKHTTPRequest.h; sourceTree = ""; }; + 6B6D7A2F1CF538D8000753C1 /* TKHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKHTTPRequest.m; sourceTree = ""; }; + 6B6D7A301CF538D8000753C1 /* TKImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKImageCache.h; sourceTree = ""; }; + 6B6D7A311CF538D8000753C1 /* TKImageCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKImageCache.m; sourceTree = ""; }; + 6B6D7A321CF538D8000753C1 /* TKLabelCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelCell.h; sourceTree = ""; }; + 6B6D7A331CF538D8000753C1 /* TKLabelCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelCell.m; sourceTree = ""; }; + 6B6D7A341CF538D8000753C1 /* TKLabelFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelFieldCell.h; sourceTree = ""; }; + 6B6D7A351CF538D8000753C1 /* TKLabelFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelFieldCell.m; sourceTree = ""; }; + 6B6D7A361CF538D8000753C1 /* TKLabelSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelSwitchCell.h; sourceTree = ""; }; + 6B6D7A371CF538D8000753C1 /* TKLabelSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelSwitchCell.m; sourceTree = ""; }; + 6B6D7A381CF538D8000753C1 /* TKLabelTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelTextFieldCell.h; sourceTree = ""; }; + 6B6D7A391CF538D8000753C1 /* TKLabelTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelTextFieldCell.m; sourceTree = ""; }; + 6B6D7A3A1CF538D8000753C1 /* TKLabelTextViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelTextViewCell.h; sourceTree = ""; }; + 6B6D7A3B1CF538D8000753C1 /* TKLabelTextViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelTextViewCell.m; sourceTree = ""; }; + 6B6D7A3C1CF538D8000753C1 /* TKNetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKNetworkQueue.h; sourceTree = ""; }; + 6B6D7A3D1CF538D8000753C1 /* TKNetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKNetworkQueue.m; sourceTree = ""; }; + 6B6D7A3E1CF538D8000753C1 /* TKProgressAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressAlertView.h; sourceTree = ""; }; + 6B6D7A3F1CF538D8000753C1 /* TKProgressAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressAlertView.m; sourceTree = ""; }; + 6B6D7A401CF538D8000753C1 /* TKProgressBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressBarView.h; sourceTree = ""; }; + 6B6D7A411CF538D8000753C1 /* TKProgressBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressBarView.m; sourceTree = ""; }; + 6B6D7A421CF538D8000753C1 /* TKProgressCircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressCircleView.h; sourceTree = ""; }; + 6B6D7A431CF538D8000753C1 /* TKProgressCircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressCircleView.m; sourceTree = ""; }; + 6B6D7A441CF538D8000753C1 /* TKReorderTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKReorderTableView.h; sourceTree = ""; }; + 6B6D7A451CF538D8000753C1 /* TKReorderTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKReorderTableView.m; sourceTree = ""; }; + 6B6D7A461CF538D8000753C1 /* TKRetroButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRetroButton.h; sourceTree = ""; }; + 6B6D7A471CF538D8000753C1 /* TKRetroButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRetroButton.m; sourceTree = ""; }; + 6B6D7A481CF538D8000753C1 /* TKTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTableViewCell.h; sourceTree = ""; }; + 6B6D7A491CF538D8000753C1 /* TKTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTableViewCell.m; sourceTree = ""; }; + 6B6D7A4A1CF538D8000753C1 /* TKTextViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTextViewCell.h; sourceTree = ""; }; + 6B6D7A4B1CF538D8000753C1 /* TKTextViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTextViewCell.m; sourceTree = ""; }; + 6B6D7A4C1CF538D8000753C1 /* TKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKViewController.h; sourceTree = ""; }; + 6B6D7A4D1CF538D8000753C1 /* TKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKViewController.m; sourceTree = ""; }; + 6B6D7A4E1CF538D8000753C1 /* UIImage+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TKCategory.h"; sourceTree = ""; }; + 6B6D7A4F1CF538D8000753C1 /* UIImage+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TKCategory.m"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6B6D793F1CF53575000753C1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6B6D79391CF53575000753C1 = { + isa = PBXGroup; + children = ( + 6B6D79451CF53575000753C1 /* STapkuLibrary */, + 6B6D7A0A1CF53620000753C1 /* Other Source */, + 6B6D79441CF53575000753C1 /* Products */, + ); + sourceTree = ""; + }; + 6B6D79441CF53575000753C1 /* Products */ = { + isa = PBXGroup; + children = ( + 6B6D79431CF53575000753C1 /* STapkuLibrary.framework */, + ); + name = Products; + sourceTree = ""; + }; + 6B6D79451CF53575000753C1 /* STapkuLibrary */ = { + isa = PBXGroup; + children = ( + 6B6D7A0F1CF538D8000753C1 /* NSDate+CalendarGrid.h */, + 6B6D7A101CF538D8000753C1 /* NSDate+CalendarGrid.m */, + 6B6D7A111CF538D8000753C1 /* TapkuLibrary.h */, + 6B6D7A121CF538D8000753C1 /* TKAlertCenter.h */, + 6B6D7A131CF538D8000753C1 /* TKAlertCenter.m */, + 6B6D7A141CF538D8000753C1 /* TKAlertViewController.h */, + 6B6D7A151CF538D8000753C1 /* TKAlertViewController.m */, + 6B6D7A161CF538D8000753C1 /* TKAppDelegate.h */, + 6B6D7A171CF538D8000753C1 /* TKAppDelegate.m */, + 6B6D7A181CF538D8000753C1 /* TKButtonCell.h */, + 6B6D7A191CF538D8000753C1 /* TKButtonCell.m */, + 6B6D7A1A1CF538D8000753C1 /* TKCalendarDayEventView.h */, + 6B6D7A1B1CF538D8000753C1 /* TKCalendarDayEventView.m */, + 6B6D7A1C1CF538D8000753C1 /* TKCalendarDayView.h */, + 6B6D7A1D1CF538D8000753C1 /* TKCalendarDayView.m */, + 6B6D7A1E1CF538D8000753C1 /* TKCalendarDayView.m.orig */, + 6B6D7A1F1CF538D8000753C1 /* TKCalendarDayView.m.patch */, + 6B6D7A201CF538D8000753C1 /* TKCalendarDayViewController.h */, + 6B6D7A211CF538D8000753C1 /* TKCalendarDayViewController.m */, + 6B6D7A221CF538D8000753C1 /* TKCalendarMonthTableViewController.h */, + 6B6D7A231CF538D8000753C1 /* TKCalendarMonthTableViewController.m */, + 6B6D7A241CF538D8000753C1 /* TKCalendarMonthView.h */, + 6B6D7A251CF538D8000753C1 /* TKCalendarMonthView.m */, + 6B6D7A261CF538D8000753C1 /* TKCalendarMonthViewController.h */, + 6B6D7A271CF538D8000753C1 /* TKCalendarMonthViewController.m */, + 6B6D7A281CF538D8000753C1 /* TKCoverflowView.h */, + 6B6D7A291CF538D8000753C1 /* TKCoverflowView.m */, + 6B6D7A2A1CF538D8000753C1 /* TKEmptyView.h */, + 6B6D7A2B1CF538D8000753C1 /* TKEmptyView.m */, + 6B6D7A2C1CF538D8000753C1 /* TKGlobal.h */, + 6B6D7A2D1CF538D8000753C1 /* TKGlobal.m */, + 6B6D7A2E1CF538D8000753C1 /* TKHTTPRequest.h */, + 6B6D7A2F1CF538D8000753C1 /* TKHTTPRequest.m */, + 6B6D7A301CF538D8000753C1 /* TKImageCache.h */, + 6B6D7A311CF538D8000753C1 /* TKImageCache.m */, + 6B6D7A321CF538D8000753C1 /* TKLabelCell.h */, + 6B6D7A331CF538D8000753C1 /* TKLabelCell.m */, + 6B6D7A341CF538D8000753C1 /* TKLabelFieldCell.h */, + 6B6D7A351CF538D8000753C1 /* TKLabelFieldCell.m */, + 6B6D7A361CF538D8000753C1 /* TKLabelSwitchCell.h */, + 6B6D7A371CF538D8000753C1 /* TKLabelSwitchCell.m */, + 6B6D7A381CF538D8000753C1 /* TKLabelTextFieldCell.h */, + 6B6D7A391CF538D8000753C1 /* TKLabelTextFieldCell.m */, + 6B6D7A3A1CF538D8000753C1 /* TKLabelTextViewCell.h */, + 6B6D7A3B1CF538D8000753C1 /* TKLabelTextViewCell.m */, + 6B6D7A3C1CF538D8000753C1 /* TKNetworkQueue.h */, + 6B6D7A3D1CF538D8000753C1 /* TKNetworkQueue.m */, + 6B6D7A3E1CF538D8000753C1 /* TKProgressAlertView.h */, + 6B6D7A3F1CF538D8000753C1 /* TKProgressAlertView.m */, + 6B6D7A401CF538D8000753C1 /* TKProgressBarView.h */, + 6B6D7A411CF538D8000753C1 /* TKProgressBarView.m */, + 6B6D7A421CF538D8000753C1 /* TKProgressCircleView.h */, + 6B6D7A431CF538D8000753C1 /* TKProgressCircleView.m */, + 6B6D7A441CF538D8000753C1 /* TKReorderTableView.h */, + 6B6D7A451CF538D8000753C1 /* TKReorderTableView.m */, + 6B6D7A461CF538D8000753C1 /* TKRetroButton.h */, + 6B6D7A471CF538D8000753C1 /* TKRetroButton.m */, + 6B6D7A481CF538D8000753C1 /* TKTableViewCell.h */, + 6B6D7A491CF538D8000753C1 /* TKTableViewCell.m */, + 6B6D7A4A1CF538D8000753C1 /* TKTextViewCell.h */, + 6B6D7A4B1CF538D8000753C1 /* TKTextViewCell.m */, + 6B6D7A4C1CF538D8000753C1 /* TKViewController.h */, + 6B6D7A4D1CF538D8000753C1 /* TKViewController.m */, + 6B6D7A4E1CF538D8000753C1 /* UIImage+TKCategory.h */, + 6B6D7A4F1CF538D8000753C1 /* UIImage+TKCategory.m */, + 6B6D794E1CF535FC000753C1 /* NSArray+TKCategory.h */, + 6B6D794F1CF535FC000753C1 /* NSArray+TKCategory.m */, + 6B6D79501CF535FC000753C1 /* NSDate+TKCategory.h */, + 6B6D79511CF535FC000753C1 /* NSDate+TKCategory.m */, + 6B6D79521CF535FC000753C1 /* NSMutableArray+TKCategory.h */, + 6B6D79531CF535FC000753C1 /* NSMutableArray+TKCategory.m */, + 6B6D79541CF535FC000753C1 /* NSObject+TKCategory.h */, + 6B6D79551CF535FC000753C1 /* NSObject+TKCategory.m */, + 6B6D79561CF535FC000753C1 /* NSString+TKCategory.h */, + 6B6D79571CF535FC000753C1 /* NSString+TKCategory.m */, + 6B6D795A1CF535FC000753C1 /* TKCardModalViewController.h */, + 6B6D795B1CF535FC000753C1 /* TKCardModalViewController.m */, + 6B6D795C1CF535FC000753C1 /* TKDecimalInputView.h */, + 6B6D795D1CF535FC000753C1 /* TKDecimalInputView.m */, + 6B6D795E1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.h */, + 6B6D795F1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.m */, + 6B6D79601CF535FC000753C1 /* TKGlowButton.h */, + 6B6D79611CF535FC000753C1 /* TKGlowButton.m */, + 6B6D79621CF535FC000753C1 /* TKGradientView.h */, + 6B6D79631CF535FC000753C1 /* TKGradientView.m */, + 6B6D79641CF535FC000753C1 /* TKInputKey.h */, + 6B6D79651CF535FC000753C1 /* TKInputKey.m */, + 6B6D79661CF535FC000753C1 /* TKInputView.h */, + 6B6D79671CF535FC000753C1 /* TKInputView.m */, + 6B6D79681CF535FC000753C1 /* TKKeyboardTableViewController.h */, + 6B6D79691CF535FC000753C1 /* TKKeyboardTableViewController.m */, + 6B6D796A1CF535FC000753C1 /* TKLoadingView.h */, + 6B6D796B1CF535FC000753C1 /* TKLoadingView.m */, + 6B6D796C1CF535FC000753C1 /* TKMultiSwitch.h */, + 6B6D796D1CF535FC000753C1 /* TKMultiSwitch.m */, + 6B6D796E1CF535FC000753C1 /* TKNumberInputView.h */, + 6B6D796F1CF535FC000753C1 /* TKNumberInputView.m */, + 6B6D79701CF535FC000753C1 /* TKNumberInputWithNextKeyView.h */, + 6B6D79711CF535FC000753C1 /* TKNumberInputWithNextKeyView.m */, + 6B6D79721CF535FC000753C1 /* TKPegSlider.h */, + 6B6D79731CF535FC000753C1 /* TKPegSlider.m */, + 6B6D79741CF535FC000753C1 /* TKShapeView.h */, + 6B6D79751CF535FC000753C1 /* TKShapeView.m */, + 6B6D79761CF535FC000753C1 /* TKShimmerLabel.h */, + 6B6D79771CF535FC000753C1 /* TKShimmerLabel.m */, + 6B6D79781CF535FC000753C1 /* TKSlideToUnlockView.h */, + 6B6D79791CF535FC000753C1 /* TKSlideToUnlockView.m */, + 6B6D797A1CF535FC000753C1 /* TKSoundAlertController.h */, + 6B6D797B1CF535FC000753C1 /* TKSoundAlertController.m */, + 6B6D797C1CF535FC000753C1 /* TKStepperCell.h */, + 6B6D797D1CF535FC000753C1 /* TKStepperCell.m */, + 6B6D797E1CF535FC000753C1 /* TKSwitchCell.h */, + 6B6D797F1CF535FC000753C1 /* TKSwitchCell.m */, + 6B6D79801CF535FC000753C1 /* TKTableViewController.h */, + 6B6D79811CF535FC000753C1 /* TKTableViewController.m */, + 6B6D79821CF535FC000753C1 /* TKTextFieldCell.h */, + 6B6D79831CF535FC000753C1 /* TKTextFieldCell.m */, + 6B6D79841CF535FC000753C1 /* TKTextView.h */, + 6B6D79851CF535FC000753C1 /* TKTextView.m */, + 6B6D79861CF535FC000753C1 /* TKWebViewController.h */, + 6B6D79871CF535FC000753C1 /* TKWebViewController.m */, + 6B6D79881CF535FC000753C1 /* TKWindow.h */, + 6B6D79891CF535FC000753C1 /* TKWindow.m */, + 6B6D798A1CF535FC000753C1 /* UIActionSheet+TKCategory.h */, + 6B6D798B1CF535FC000753C1 /* UIActionSheet+TKCategory.m */, + 6B6D798C1CF535FC000753C1 /* UIAlertView+TKCategory.h */, + 6B6D798D1CF535FC000753C1 /* UIAlertView+TKCategory.m */, + 6B6D798E1CF535FC000753C1 /* UIBarButtonItem+TKCategory.h */, + 6B6D798F1CF535FC000753C1 /* UIBarButtonItem+TKCategory.m */, + 6B6D79901CF535FC000753C1 /* UIButton+TKCategory.h */, + 6B6D79911CF535FC000753C1 /* UIButton+TKCategory.m */, + 6B6D79921CF535FC000753C1 /* UIColor+TKCategory.h */, + 6B6D79931CF535FC000753C1 /* UIColor+TKCategory.m */, + 6B6D79941CF535FC000753C1 /* UIDevice+TKCategory.h */, + 6B6D79951CF535FC000753C1 /* UIDevice+TKCategory.m */, + 6B6D79961CF535FC000753C1 /* UIFont+TKCategory.h */, + 6B6D79971CF535FC000753C1 /* UIFont+TKCategory.m */, + 6B6D79981CF535FC000753C1 /* UIGestureRecognizer+TKCategory.h */, + 6B6D79991CF535FC000753C1 /* UIGestureRecognizer+TKCategory.m */, + 6B6D799A1CF535FC000753C1 /* UIImagePickerController+TKCategory.h */, + 6B6D799B1CF535FC000753C1 /* UIImagePickerController+TKCategory.m */, + 6B6D799C1CF535FC000753C1 /* UIImageView+TKCategory.h */, + 6B6D799D1CF535FC000753C1 /* UIImageView+TKCategory.m */, + 6B6D799E1CF535FC000753C1 /* UILabel+TKCategory.h */, + 6B6D799F1CF535FC000753C1 /* UILabel+TKCategory.m */, + 6B6D79A01CF535FC000753C1 /* UINavigationBar+TKCategory.h */, + 6B6D79A11CF535FC000753C1 /* UINavigationBar+TKCategory.m */, + 6B6D79A21CF535FC000753C1 /* UIScreen+TKCategory.h */, + 6B6D79A31CF535FC000753C1 /* UIScreen+TKCategory.m */, + 6B6D79A41CF535FC000753C1 /* UIScrollview+TKCategory.h */, + 6B6D79A51CF535FC000753C1 /* UIScrollview+TKCategory.m */, + 6B6D79A61CF535FC000753C1 /* UITextField+TKCategory.h */, + 6B6D79A71CF535FC000753C1 /* UITextField+TKCategory.m */, + 6B6D79A81CF535FC000753C1 /* UIView+TKCategory.h */, + 6B6D79A91CF535FC000753C1 /* UIView+TKCategory.m */, + 6B6D79AA1CF535FC000753C1 /* UIViewController+TKCategory.h */, + 6B6D79AB1CF535FC000753C1 /* UIViewController+TKCategory.m */, + 6B6D79481CF53575000753C1 /* Info.plist */, + ); + name = STapkuLibrary; + path = TapkuLibrary; + sourceTree = ""; + }; + 6B6D7A0A1CF53620000753C1 /* Other Source */ = { + isa = PBXGroup; + children = ( + 6B6D7A0B1CF5363F000753C1 /* STapkuLibrary_Prefix.pch */, + 6B6D7A0C1CF5363F000753C1 /* TapkuLibrary.bundle */, + ); + name = "Other Source"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6B6D79401CF53575000753C1 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B6D7A571CF538D8000753C1 /* TKAppDelegate.h in Headers */, + 6B6D7A651CF538D8000753C1 /* TKCalendarMonthView.h in Headers */, + 6B6D79D61CF535FC000753C1 /* TKSlideToUnlockView.h in Headers */, + 6B6D7A6B1CF538D8000753C1 /* TKEmptyView.h in Headers */, + 6B6D7A041CF535FC000753C1 /* UITextField+TKCategory.h in Headers */, + 6B6D7A891CF538D8000753C1 /* TKTableViewCell.h in Headers */, + 6B6D79E81CF535FC000753C1 /* UIActionSheet+TKCategory.h in Headers */, + 6B6D79C21CF535FC000753C1 /* TKInputKey.h in Headers */, + 6B6D7A731CF538D8000753C1 /* TKLabelCell.h in Headers */, + 6B6D79C41CF535FC000753C1 /* TKInputView.h in Headers */, + 6B6D79DE1CF535FC000753C1 /* TKTableViewController.h in Headers */, + 6B6D7A691CF538D8000753C1 /* TKCoverflowView.h in Headers */, + 6B6D79F81CF535FC000753C1 /* UIImagePickerController+TKCategory.h in Headers */, + 6B6D79FE1CF535FC000753C1 /* UINavigationBar+TKCategory.h in Headers */, + 6B6D7A811CF538D8000753C1 /* TKProgressBarView.h in Headers */, + 6B6D79F01CF535FC000753C1 /* UIColor+TKCategory.h in Headers */, + 6B6D79FA1CF535FC000753C1 /* UIImageView+TKCategory.h in Headers */, + 6B6D79D41CF535FC000753C1 /* TKShimmerLabel.h in Headers */, + 6B6D79B41CF535FC000753C1 /* NSString+TKCategory.h in Headers */, + 6B6D7A521CF538D8000753C1 /* TapkuLibrary.h in Headers */, + 6B6D7A851CF538D8000753C1 /* TKReorderTableView.h in Headers */, + 6B6D79D01CF535FC000753C1 /* TKPegSlider.h in Headers */, + 6B6D79BE1CF535FC000753C1 /* TKGlowButton.h in Headers */, + 6B6D7A081CF535FC000753C1 /* UIViewController+TKCategory.h in Headers */, + 6B6D79CA1CF535FC000753C1 /* TKMultiSwitch.h in Headers */, + 6B6D79E21CF535FC000753C1 /* TKTextView.h in Headers */, + 6B6D7A751CF538D8000753C1 /* TKLabelFieldCell.h in Headers */, + 6B6D7A0D1CF5363F000753C1 /* STapkuLibrary_Prefix.pch in Headers */, + 6B6D79E61CF535FC000753C1 /* TKWindow.h in Headers */, + 6B6D79DA1CF535FC000753C1 /* TKStepperCell.h in Headers */, + 6B6D79D81CF535FC000753C1 /* TKSoundAlertController.h in Headers */, + 6B6D7A5D1CF538D8000753C1 /* TKCalendarDayView.h in Headers */, + 6B6D7A831CF538D8000753C1 /* TKProgressCircleView.h in Headers */, + 6B6D79AE1CF535FC000753C1 /* NSDate+TKCategory.h in Headers */, + 6B6D7A7F1CF538D8000753C1 /* TKProgressAlertView.h in Headers */, + 6B6D79BC1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.h in Headers */, + 6B6D7A6F1CF538D8000753C1 /* TKHTTPRequest.h in Headers */, + 6B6D79B81CF535FC000753C1 /* TKCardModalViewController.h in Headers */, + 6B6D7A8D1CF538D8000753C1 /* TKViewController.h in Headers */, + 6B6D7A871CF538D8000753C1 /* TKRetroButton.h in Headers */, + 6B6D7A531CF538D8000753C1 /* TKAlertCenter.h in Headers */, + 6B6D7A001CF535FC000753C1 /* UIScreen+TKCategory.h in Headers */, + 6B6D79F41CF535FC000753C1 /* UIFont+TKCategory.h in Headers */, + 6B6D7A8F1CF538D8000753C1 /* UIImage+TKCategory.h in Headers */, + 6B6D7A7D1CF538D8000753C1 /* TKNetworkQueue.h in Headers */, + 6B6D7A551CF538D8000753C1 /* TKAlertViewController.h in Headers */, + 6B6D7A771CF538D8000753C1 /* TKLabelSwitchCell.h in Headers */, + 6B6D79F21CF535FC000753C1 /* UIDevice+TKCategory.h in Headers */, + 6B6D79E41CF535FC000753C1 /* TKWebViewController.h in Headers */, + 6B6D7A611CF538D8000753C1 /* TKCalendarDayViewController.h in Headers */, + 6B6D79F61CF535FC000753C1 /* UIGestureRecognizer+TKCategory.h in Headers */, + 6B6D7A7B1CF538D8000753C1 /* TKLabelTextViewCell.h in Headers */, + 6B6D7A671CF538D8000753C1 /* TKCalendarMonthViewController.h in Headers */, + 6B6D79B01CF535FC000753C1 /* NSMutableArray+TKCategory.h in Headers */, + 6B6D7A5B1CF538D8000753C1 /* TKCalendarDayEventView.h in Headers */, + 6B6D79C01CF535FC000753C1 /* TKGradientView.h in Headers */, + 6B6D7A6D1CF538D8000753C1 /* TKGlobal.h in Headers */, + 6B6D79C61CF535FC000753C1 /* TKKeyboardTableViewController.h in Headers */, + 6B6D7A791CF538D8000753C1 /* TKLabelTextFieldCell.h in Headers */, + 6B6D7A021CF535FC000753C1 /* UIScrollview+TKCategory.h in Headers */, + 6B6D79BA1CF535FC000753C1 /* TKDecimalInputView.h in Headers */, + 6B6D79CC1CF535FC000753C1 /* TKNumberInputView.h in Headers */, + 6B6D79E01CF535FC000753C1 /* TKTextFieldCell.h in Headers */, + 6B6D79EE1CF535FC000753C1 /* UIButton+TKCategory.h in Headers */, + 6B6D7A501CF538D8000753C1 /* NSDate+CalendarGrid.h in Headers */, + 6B6D79EC1CF535FC000753C1 /* UIBarButtonItem+TKCategory.h in Headers */, + 6B6D79FC1CF535FC000753C1 /* UILabel+TKCategory.h in Headers */, + 6B6D7A8B1CF538D8000753C1 /* TKTextViewCell.h in Headers */, + 6B6D79D21CF535FC000753C1 /* TKShapeView.h in Headers */, + 6B6D7A591CF538D8000753C1 /* TKButtonCell.h in Headers */, + 6B6D7A061CF535FC000753C1 /* UIView+TKCategory.h in Headers */, + 6B6D79AC1CF535FC000753C1 /* NSArray+TKCategory.h in Headers */, + 6B6D79CE1CF535FC000753C1 /* TKNumberInputWithNextKeyView.h in Headers */, + 6B6D7A711CF538D8000753C1 /* TKImageCache.h in Headers */, + 6B6D7A631CF538D8000753C1 /* TKCalendarMonthTableViewController.h in Headers */, + 6B6D79DC1CF535FC000753C1 /* TKSwitchCell.h in Headers */, + 6B6D79EA1CF535FC000753C1 /* UIAlertView+TKCategory.h in Headers */, + 6B6D79B21CF535FC000753C1 /* NSObject+TKCategory.h in Headers */, + 6B6D79C81CF535FC000753C1 /* TKLoadingView.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 6B6D79421CF53575000753C1 /* STapkuLibrary */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6B6D794B1CF53575000753C1 /* Build configuration list for PBXNativeTarget "STapkuLibrary" */; + buildPhases = ( + 6B6D793E1CF53575000753C1 /* Sources */, + 6B6D793F1CF53575000753C1 /* Frameworks */, + 6B6D79401CF53575000753C1 /* Headers */, + 6B6D79411CF53575000753C1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = STapkuLibrary; + productName = TapkuLibrary; + productReference = 6B6D79431CF53575000753C1 /* STapkuLibrary.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6B6D793A1CF53575000753C1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0730; + ORGANIZATIONNAME = " Sjw"; + TargetAttributes = { + 6B6D79421CF53575000753C1 = { + CreatedOnToolsVersion = 7.3.1; + }; + }; + }; + buildConfigurationList = 6B6D793D1CF53575000753C1 /* Build configuration list for PBXProject "STapkuLibrary" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 6B6D79391CF53575000753C1; + productRefGroup = 6B6D79441CF53575000753C1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6B6D79421CF53575000753C1 /* STapkuLibrary */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6B6D79411CF53575000753C1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B6D7A0E1CF5363F000753C1 /* TapkuLibrary.bundle in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6B6D793E1CF53575000753C1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B6D7A8A1CF538D8000753C1 /* TKTableViewCell.m in Sources */, + 6B6D7A511CF538D8000753C1 /* NSDate+CalendarGrid.m in Sources */, + 6B6D7A6A1CF538D8000753C1 /* TKCoverflowView.m in Sources */, + 6B6D79D11CF535FC000753C1 /* TKPegSlider.m in Sources */, + 6B6D79E31CF535FC000753C1 /* TKTextView.m in Sources */, + 6B6D79E71CF535FC000753C1 /* TKWindow.m in Sources */, + 6B6D79DB1CF535FC000753C1 /* TKStepperCell.m in Sources */, + 6B6D79E11CF535FC000753C1 /* TKTextFieldCell.m in Sources */, + 6B6D79E51CF535FC000753C1 /* TKWebViewController.m in Sources */, + 6B6D7A641CF538D8000753C1 /* TKCalendarMonthTableViewController.m in Sources */, + 6B6D7A7E1CF538D8000753C1 /* TKNetworkQueue.m in Sources */, + 6B6D79EF1CF535FC000753C1 /* UIButton+TKCategory.m in Sources */, + 6B6D79B51CF535FC000753C1 /* NSString+TKCategory.m in Sources */, + 6B6D7A861CF538D8000753C1 /* TKReorderTableView.m in Sources */, + 6B6D7A071CF535FC000753C1 /* UIView+TKCategory.m in Sources */, + 6B6D7A841CF538D8000753C1 /* TKProgressCircleView.m in Sources */, + 6B6D79CD1CF535FC000753C1 /* TKNumberInputView.m in Sources */, + 6B6D7A5C1CF538D8000753C1 /* TKCalendarDayEventView.m in Sources */, + 6B6D79D71CF535FC000753C1 /* TKSlideToUnlockView.m in Sources */, + 6B6D79C11CF535FC000753C1 /* TKGradientView.m in Sources */, + 6B6D7A761CF538D8000753C1 /* TKLabelFieldCell.m in Sources */, + 6B6D7A7A1CF538D8000753C1 /* TKLabelTextFieldCell.m in Sources */, + 6B6D7A581CF538D8000753C1 /* TKAppDelegate.m in Sources */, + 6B6D79D91CF535FC000753C1 /* TKSoundAlertController.m in Sources */, + 6B6D79C91CF535FC000753C1 /* TKLoadingView.m in Sources */, + 6B6D79BB1CF535FC000753C1 /* TKDecimalInputView.m in Sources */, + 6B6D7A091CF535FC000753C1 /* UIViewController+TKCategory.m in Sources */, + 6B6D79F91CF535FC000753C1 /* UIImagePickerController+TKCategory.m in Sources */, + 6B6D79CB1CF535FC000753C1 /* TKMultiSwitch.m in Sources */, + 6B6D7A561CF538D8000753C1 /* TKAlertViewController.m in Sources */, + 6B6D79F51CF535FC000753C1 /* UIFont+TKCategory.m in Sources */, + 6B6D7A741CF538D8000753C1 /* TKLabelCell.m in Sources */, + 6B6D79FB1CF535FC000753C1 /* UIImageView+TKCategory.m in Sources */, + 6B6D79DD1CF535FC000753C1 /* TKSwitchCell.m in Sources */, + 6B6D7A661CF538D8000753C1 /* TKCalendarMonthView.m in Sources */, + 6B6D79D51CF535FC000753C1 /* TKShimmerLabel.m in Sources */, + 6B6D7A8C1CF538D8000753C1 /* TKTextViewCell.m in Sources */, + 6B6D79FF1CF535FC000753C1 /* UINavigationBar+TKCategory.m in Sources */, + 6B6D79C31CF535FC000753C1 /* TKInputKey.m in Sources */, + 6B6D7A721CF538D8000753C1 /* TKImageCache.m in Sources */, + 6B6D79C71CF535FC000753C1 /* TKKeyboardTableViewController.m in Sources */, + 6B6D79B31CF535FC000753C1 /* NSObject+TKCategory.m in Sources */, + 6B6D7A011CF535FC000753C1 /* UIScreen+TKCategory.m in Sources */, + 6B6D79AD1CF535FC000753C1 /* NSArray+TKCategory.m in Sources */, + 6B6D79EB1CF535FC000753C1 /* UIAlertView+TKCategory.m in Sources */, + 6B6D79F11CF535FC000753C1 /* UIColor+TKCategory.m in Sources */, + 6B6D7A821CF538D8000753C1 /* TKProgressBarView.m in Sources */, + 6B6D79B11CF535FC000753C1 /* NSMutableArray+TKCategory.m in Sources */, + 6B6D79AF1CF535FC000753C1 /* NSDate+TKCategory.m in Sources */, + 6B6D79B91CF535FC000753C1 /* TKCardModalViewController.m in Sources */, + 6B6D7A541CF538D8000753C1 /* TKAlertCenter.m in Sources */, + 6B6D79BD1CF535FC000753C1 /* TKDecimalInputWithNextKeyView.m in Sources */, + 6B6D79D31CF535FC000753C1 /* TKShapeView.m in Sources */, + 6B6D79F31CF535FC000753C1 /* UIDevice+TKCategory.m in Sources */, + 6B6D79C51CF535FC000753C1 /* TKInputView.m in Sources */, + 6B6D7A6E1CF538D8000753C1 /* TKGlobal.m in Sources */, + 6B6D7A781CF538D8000753C1 /* TKLabelSwitchCell.m in Sources */, + 6B6D7A6C1CF538D8000753C1 /* TKEmptyView.m in Sources */, + 6B6D79F71CF535FC000753C1 /* UIGestureRecognizer+TKCategory.m in Sources */, + 6B6D7A701CF538D8000753C1 /* TKHTTPRequest.m in Sources */, + 6B6D79E91CF535FC000753C1 /* UIActionSheet+TKCategory.m in Sources */, + 6B6D79BF1CF535FC000753C1 /* TKGlowButton.m in Sources */, + 6B6D7A7C1CF538D8000753C1 /* TKLabelTextViewCell.m in Sources */, + 6B6D7A8E1CF538D8000753C1 /* TKViewController.m in Sources */, + 6B6D7A801CF538D8000753C1 /* TKProgressAlertView.m in Sources */, + 6B6D79ED1CF535FC000753C1 /* UIBarButtonItem+TKCategory.m in Sources */, + 6B6D79FD1CF535FC000753C1 /* UILabel+TKCategory.m in Sources */, + 6B6D7A031CF535FC000753C1 /* UIScrollview+TKCategory.m in Sources */, + 6B6D79DF1CF535FC000753C1 /* TKTableViewController.m in Sources */, + 6B6D7A901CF538D8000753C1 /* UIImage+TKCategory.m in Sources */, + 6B6D7A5E1CF538D8000753C1 /* TKCalendarDayView.m in Sources */, + 6B6D7A5A1CF538D8000753C1 /* TKButtonCell.m in Sources */, + 6B6D7A051CF535FC000753C1 /* UITextField+TKCategory.m in Sources */, + 6B6D7A621CF538D8000753C1 /* TKCalendarDayViewController.m in Sources */, + 6B6D79CF1CF535FC000753C1 /* TKNumberInputWithNextKeyView.m in Sources */, + 6B6D7A881CF538D8000753C1 /* TKRetroButton.m in Sources */, + 6B6D7A681CF538D8000753C1 /* TKCalendarMonthViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6B6D79491CF53575000753C1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 6B6D794A1CF53575000753C1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 6B6D794C1CF53575000753C1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = STapkuLibrary_Prefix.pch; + INFOPLIST_FILE = TapkuLibrary/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.yunya365.TapkuLibrary; + PRODUCT_NAME = STapkuLibrary; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 6B6D794D1CF53575000753C1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = STapkuLibrary_Prefix.pch; + INFOPLIST_FILE = TapkuLibrary/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.yunya365.TapkuLibrary; + PRODUCT_NAME = STapkuLibrary; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6B6D793D1CF53575000753C1 /* Build configuration list for PBXProject "STapkuLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6B6D79491CF53575000753C1 /* Debug */, + 6B6D794A1CF53575000753C1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6B6D794B1CF53575000753C1 /* Build configuration list for PBXNativeTarget "STapkuLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6B6D794C1CF53575000753C1 /* Debug */, + 6B6D794D1CF53575000753C1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6B6D793A1CF53575000753C1 /* Project object */; +} diff --git a/tapku.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/STapkuLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 55% rename from tapku.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to STapkuLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 8ca8f02e..70537be8 100644 --- a/tapku.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/STapkuLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:/Users/Sjw/Code/Github/STapkuLibrary/STapkuLibrary.xcodeproj"> diff --git a/tapku_Prefix.pch b/STapkuLibrary_Prefix.pch similarity index 91% rename from tapku_Prefix.pch rename to STapkuLibrary_Prefix.pch index 7626f6f1..9475e171 100755 --- a/tapku_Prefix.pch +++ b/STapkuLibrary_Prefix.pch @@ -16,5 +16,7 @@ @import Foundation; @import UIKit; @import QuartzCore; - @import curry; + + #import "TapkuLibrary.h" + #endif diff --git a/tapku/Info.plist b/TapkuLibrary/Extends/Info.plist similarity index 100% rename from tapku/Info.plist rename to TapkuLibrary/Extends/Info.plist diff --git a/TapkuLibrary/Extends/Patch/TKCalendarDayView.m.patch b/TapkuLibrary/Extends/Patch/TKCalendarDayView.m.patch new file mode 100644 index 00000000..341299d1 --- /dev/null +++ b/TapkuLibrary/Extends/Patch/TKCalendarDayView.m.patch @@ -0,0 +1,39 @@ +--- old/TKCalendarDayView.m 2016-05-03 14:08:09.000000000 +0800 ++++ new/TKCalendarDayView.m 2016-05-03 14:46:58.000000000 +0800 +@@ -33,7 +33,7 @@ + #import "TKGlobal.h" + + #define NOB_SIZE 6.0f +-#define TOP_BAR_HEIGHT 84.0 ++#define TOP_BAR_HEIGHT 64.0 + #define EVENT_SAME_HOUR 3.0 + #define HORIZONTAL_PAD 5.0f + #define RIGHT_EVENT_INSET 10.0 +@@ -177,7 +177,7 @@ + self.currentDay = [self _timelineAtIndex:1].date; + [self _updateDateLabel]; + [self addSubview:self.daysBackgroundView]; +- [self addSubview:self.monthYearLabel]; ++ //[self addSubview:self.monthYearLabel]; + + + NSInteger cnt = 0; +@@ -1004,7 +1004,8 @@ + } + - (UIScrollView*) daysScrollView{ + if(_daysScrollView) return _daysScrollView; +- _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetMinY(self.monthYearLabel.frame))]; ++// _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetMinY(self.monthYearLabel.frame))]; ++ _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), 64)]; + _daysScrollView.pagingEnabled = YES; + _daysScrollView.delegate = self; + _daysScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.daysScrollView.frame)*3.0, 0); +@@ -1118,7 +1119,7 @@ + @"13:00",@"14:00",@"15:00",@"16:00",@"17:00",@"18:00",@"19:00",@"20:00",@"21:00",@"22:00",@"23:00",@"00:00"]; + else + _times = @[@"12",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11", +- @"Noon",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"]; ++ @"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24"]; + + return _times; + } diff --git a/TapkuLibrary/Extends/Patch/new.patch b/TapkuLibrary/Extends/Patch/new.patch new file mode 100644 index 00000000..7455164b --- /dev/null +++ b/TapkuLibrary/Extends/Patch/new.patch @@ -0,0 +1,234 @@ +Binary files old/.DS_Store and new/.DS_Store differ +diff -uN old/TKCalendarDayView.m new/TKCalendarDayView.m +--- old/TKCalendarDayView.m 2016-05-04 16:56:58.000000000 +0800 ++++ new/TKCalendarDayView.m 2016-05-10 13:42:07.000000000 +0800 +@@ -497,116 +497,122 @@ + + } + - (void) _realignEventsAtIndex:(NSInteger)index{ +- +- UIScrollView *sv = self.pages[index]; +- TKTimelineView *timeline = [self _timelineAtIndex:index]; +- +- +- NSMutableArray *sameTimeEvents = [[NSMutableArray alloc] init]; +- NSInteger offsetCount = 0; +- NSInteger repeatNumber = 0; // number of nested appointments +- CGFloat horizOffset = 0.0f; // number of pixels to offset horizontally when they are nested +- CGFloat startMarker = -100.0f; // starting point to check if they match +- CGFloat endMarker = -100.0f; +- +- +- CGFloat topOrigin = -1; +- +- for (TKCalendarDayEventView *event in timeline.events) { +- +- +- if(event.gestureRecognizers.count<1){ +- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewWasTapped:)]; +- [event addGestureRecognizer:tap]; +- } +- +- +- BOOL startSameDay = [event.startDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; +- +- if(!startSameDay && (([event.startDate compare:timeline.date] == NSOrderedAscending && [event.endDate compare:timeline.date] == NSOrderedAscending) || ([event.startDate compare:timeline.date] == NSOrderedDescending))) continue; +- +- BOOL endSameDay = [event.endDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; +- NSDateComponents *startComp = [event.startDate dateComponentsWithTimeZone:self.calendar.timeZone]; +- NSDateComponents *endComp = [event.endDate dateComponentsWithTimeZone:self.calendar.timeZone]; +- +- NSInteger hourStart = startSameDay ? startComp.hour : 0; +- CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; +- +- NSInteger minuteStart = startSameDay ? round(startComp.minute / 5.0) * 5 : 0; +- CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); +- +- NSInteger hourEnd = endSameDay ? endComp.hour : 23; +- CGFloat hourEndPosition = hourEnd * VERTICAL_DIFF + VERTICAL_INSET; +- +- NSInteger minuteEnd = endSameDay ? round(endComp.minute / 5.0) * 5 : 60; +- CGFloat minuteEndPosition = roundf((CGFloat)minuteEnd / 60.0f * VERTICAL_DIFF); +- +- CGFloat eventHeight = hourEndPosition + minuteEndPosition - hourStartPosition - minuteStartPosition; +- eventHeight = MAX(roundf(VERTICAL_DIFF/2), eventHeight); +- +- +- +- +- // nobre additions - split control and offset control +- // split control - adjusts balloon widths so their times/titles don't overlap +- // offset control - adjusts starting balloon position so you can see all starts/ends +- if ((hourStartPosition + minuteStartPosition) - startMarker < 1) { +- repeatNumber++; +- } else { +- repeatNumber = 0; +- [sameTimeEvents removeAllObjects]; +- //if this event starts before the last event's end, we have to offset it! +- if (hourStartPosition + minuteStartPosition < endMarker) { +- horizOffset = EVENT_SAME_HOUR * ++offsetCount; +- } +- else { +- horizOffset = 0.0f; +- offsetCount = 0; +- } +- } +- +- +- +- +- +- CGFloat eventWidth = (CGRectGetWidth(self.bounds) - LEFT_INSET - RIGHT_EVENT_INSET)/(repeatNumber+1); +- CGFloat eventOriginX = LEFT_INSET + 2.0f + horizOffset; +- CGRect eventFrame = CGRectMake(eventOriginX + (repeatNumber*eventWidth), hourStartPosition + minuteStartPosition, eventWidth, eventHeight); +- event.frame = CGRectIntegral(eventFrame); +- [event setNeedsLayout]; +- [sv addSubview:event]; +- +- for (NSInteger i = [sameTimeEvents count]-1; i >= 0; i--) { +- TKCalendarDayEventView *sameTimeEvent = sameTimeEvents[i]; +- CGRect newFrame = sameTimeEvent.frame; +- newFrame.size.width = eventWidth; +- newFrame.origin.x = eventOriginX + (i*(eventWidth)); +- sameTimeEvent.frame = CGRectIntegral(newFrame); +- [sameTimeEvent setNeedsLayout]; +- } +- [sameTimeEvents addObject:event]; +- +- [event setNeedsLayout]; +- +- +- startMarker = hourStartPosition + minuteStartPosition; +- endMarker = MAX(endMarker,hourEndPosition + minuteEndPosition); +- +- if(topOrigin<0) +- topOrigin = startMarker; +- +- topOrigin = MIN(topOrigin,startMarker); +- +- } +- +- if(topOrigin>0) +- timeline.startY = topOrigin; +- if(sv == self.nowLineView.superview) +- [sv bringSubviewToFront:self.nowLineView]; +- ++ ++ UIScrollView *sv = self.pages[index]; ++ TKTimelineView *timeline = [self _timelineAtIndex:index]; ++ ++ ++ NSMutableArray *sameTimeEvents = [[NSMutableArray alloc] init]; ++ NSInteger offsetCount = 0; ++ NSInteger repeatNumber = 0; // number of nested appointments ++ CGFloat horizOffset = 0.0f; // number of pixels to offset horizontally when they are nested ++ CGFloat startMarker = -100.0f; // starting point to check if they match ++ CGFloat endMarker = -100.0f; ++ ++ ++ CGFloat topOrigin = -1; ++ ++#pragma 为了事件条宽度设个变量 ++ int event_i = 0; ++ for (TKCalendarDayEventView *event in timeline.events) { ++ ++ ++ if(event.gestureRecognizers.count<1){ ++ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewWasTapped:)]; ++ [event addGestureRecognizer:tap]; ++ } ++ ++ ++ BOOL startSameDay = [event.startDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; ++ ++ if(!startSameDay && (([event.startDate compare:timeline.date] == NSOrderedAscending && [event.endDate compare:timeline.date] == NSOrderedAscending) || ([event.startDate compare:timeline.date] == NSOrderedDescending))) continue; ++ ++ BOOL endSameDay = [event.endDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; ++ NSDateComponents *startComp = [event.startDate dateComponentsWithTimeZone:self.calendar.timeZone]; ++ NSDateComponents *endComp = [event.endDate dateComponentsWithTimeZone:self.calendar.timeZone]; ++ ++ NSInteger hourStart = startSameDay ? startComp.hour : 0; ++ CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; ++ ++ NSInteger minuteStart = startSameDay ? round(startComp.minute / 5.0) * 5 : 0; ++ CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); ++ ++ NSInteger hourEnd = endSameDay ? endComp.hour : 23; ++ CGFloat hourEndPosition = hourEnd * VERTICAL_DIFF + VERTICAL_INSET; ++ ++ NSInteger minuteEnd = endSameDay ? round(endComp.minute / 5.0) * 5 : 60; ++ CGFloat minuteEndPosition = roundf((CGFloat)minuteEnd / 60.0f * VERTICAL_DIFF); ++ ++ CGFloat eventHeight = hourEndPosition + minuteEndPosition - hourStartPosition - minuteStartPosition; ++ eventHeight = MAX(roundf(VERTICAL_DIFF/2), eventHeight); ++ ++ ++ ++ ++ // nobre additions - split control and offset control ++ // split control - adjusts balloon widths so their times/titles don't overlap ++ // offset control - adjusts starting balloon position so you can see all starts/ends ++ if ((hourStartPosition + minuteStartPosition) - startMarker < 1) { ++ repeatNumber++; ++ } else { ++ repeatNumber = 0; ++ [sameTimeEvents removeAllObjects]; ++ //if this event starts before the last event's end, we have to offset it! ++ if (hourStartPosition + minuteStartPosition < endMarker) { ++ horizOffset = EVENT_SAME_HOUR * ++offsetCount; ++ } ++ else { ++ horizOffset = 0.0f; ++ offsetCount = 0; ++ } ++ } ++ ++ ++ ++#pragma 事件条宽度 ++ CGFloat eventWidth = ([UIScreen mainScreen].bounds.size.width / 3 * 2 - 50) / timeline.events.count; ++ CGFloat eventOriginX = LEFT_INSET + eventWidth * event_i; ++ event_i++; ++ // CGFloat eventWidth = (CGRectGetWidth(self.bounds) - LEFT_INSET - RIGHT_EVENT_INSET)/(repeatNumber+1); ++ // CGFloat eventOriginX = LEFT_INSET + 2.0f + horizOffset; ++ // CGRect eventFrame = CGRectMake(eventOriginX + (repeatNumber*eventWidth), hourStartPosition + minuteStartPosition, eventWidth, eventHeight); ++ CGRect eventFrame = CGRectMake(eventOriginX, hourStartPosition + minuteStartPosition, eventWidth, eventHeight); ++ event.frame = CGRectIntegral(eventFrame); ++ [event setNeedsLayout]; ++ [sv addSubview:event]; ++ ++ // for (NSInteger i = [sameTimeEvents count]-1; i >= 0; i--) { ++ // TKCalendarDayEventView *sameTimeEvent = sameTimeEvents[i]; ++ // CGRect newFrame = sameTimeEvent.frame; ++ // newFrame.size.width = eventWidth; ++ // newFrame.origin.x = eventOriginX + (i*(eventWidth)); ++ // sameTimeEvent.frame = CGRectIntegral(newFrame); ++ // [sameTimeEvent setNeedsLayout]; ++ // } ++ // [sameTimeEvents addObject:event]; ++ // ++ // [event setNeedsLayout]; ++ ++ ++ startMarker = hourStartPosition + minuteStartPosition; ++ endMarker = MAX(endMarker,hourEndPosition + minuteEndPosition); ++ ++ if(topOrigin<0) ++ topOrigin = startMarker; ++ ++ topOrigin = MIN(topOrigin,startMarker); ++ ++ } ++ ++ if(topOrigin>0) ++ timeline.startY = topOrigin; ++ if(sv == self.nowLineView.superview) ++ [sv bringSubviewToFront:self.nowLineView]; ++ + } + + ++ + #pragma mark WeekDay + - (void) _advanceWeekToIndex:(NSInteger)index animated:(BOOL)animated{ + self.userInteractionEnabled = NO; diff --git a/TapkuLibrary/Extends/PrefixHeader.pch b/TapkuLibrary/Extends/PrefixHeader.pch new file mode 100644 index 00000000..1ae1993d --- /dev/null +++ b/TapkuLibrary/Extends/PrefixHeader.pch @@ -0,0 +1,23 @@ +// +// PrefixHeader.pch +// TapkuLibrary +// +// Created by Sjw on 16/5/4. +// Copyright © 2016年 Yunya. All rights reserved. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +#ifdef __OBJC__ + +@import Foundation; +@import UIKit; +@import QuartzCore; + +#import "Headers.h" +#import "TapkuLibraryAll.h" + +#endif + +#endif /* PrefixHeader_pch */ diff --git a/TapkuLibrary/Extends/TapkuLibraryAll.h b/TapkuLibrary/Extends/TapkuLibraryAll.h new file mode 100644 index 00000000..0a6a23f1 --- /dev/null +++ b/TapkuLibrary/Extends/TapkuLibraryAll.h @@ -0,0 +1,9 @@ +// +// TapkuLibrary+S.h +// tapku +// +// Created by Sjw on 16/4/26. +// +// + +#import "TapkuLibrary.h" \ No newline at end of file diff --git a/LogicTests-Info.plist b/TapkuLibrary/Info.plist similarity index 66% rename from LogicTests-Info.plist rename to TapkuLibrary/Info.plist index 460a7d93..d3de8eef 100644 --- a/LogicTests-Info.plist +++ b/TapkuLibrary/Info.plist @@ -3,18 +3,24 @@ CFBundleDevelopmentRegion - English + en CFBundleExecutable - ${EXECUTABLE_NAME} + $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 + CFBundleName + $(PRODUCT_NAME) CFBundlePackageType - BNDL + FMWK + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion - 1.0 + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + diff --git a/TapkuLibrary/NSArray+TKCategory.h b/TapkuLibrary/NSArray+TKCategory.h new file mode 100644 index 00000000..b1deb48a --- /dev/null +++ b/TapkuLibrary/NSArray+TKCategory.h @@ -0,0 +1,47 @@ +// +// NSArray+TKCategory.h +// Created by Devin Ross on 11/9/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; + +/** Additional functionality for `NSArray`. */ +@interface NSArray (TKCategory) + +/** Returns the object in the array with the lowest index value. +@return The object in the array with the lowest index value. If the array is empty, returns nil. +*/ +@property (nonatomic, readonly, strong) id firstObject; + +/** Returns a random object in the array. + @return The object in the array with the lowest index value. If the array is empty, returns nil. + */ +@property (nonatomic, readonly, strong) id randomObject; + +@end diff --git a/TapkuLibrary/NSArray+TKCategory.m b/TapkuLibrary/NSArray+TKCategory.m new file mode 100644 index 00000000..dfc088a6 --- /dev/null +++ b/TapkuLibrary/NSArray+TKCategory.m @@ -0,0 +1,47 @@ +// +// NSArray+TKCategory.m +// Created by Devin Ross on 11/9/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "NSArray+TKCategory.h" + +@implementation NSArray (TKCategory) + +- (id) firstObject{ + if(self.count<1) return nil; + return self[0]; +} + +- (id) randomObject{ + if(self.count<1) return nil; + + return self[arc4random() % [self count]]; +} + +@end diff --git a/TapkuLibrary/NSDate+CalendarGrid.m b/TapkuLibrary/NSDate+CalendarGrid.m index b9384304..871bc8e2 100644 --- a/TapkuLibrary/NSDate+CalendarGrid.m +++ b/TapkuLibrary/NSDate+CalendarGrid.m @@ -30,6 +30,7 @@ */ #import "NSDate+CalendarGrid.h" +#import "NSDate+TKCategory.h" @implementation NSDate (CalendarGrid) @@ -80,9 +81,9 @@ - (NSDate*) previousMonthWithTimeZone:(NSTimeZone*)timeZone{ } - (NSDate*) lastOfMonthDateWithTimeZone:(NSTimeZone*)timeZone{ - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; gregorian.timeZone = timeZone; - NSDateComponents *comp = [gregorian components:(NSCalendarUnitYear | NSCalendarUnitMonth) fromDate:self]; + NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:self]; comp.timeZone = timeZone; [comp setDay:0]; [comp setMonth:comp.month+1]; @@ -92,16 +93,16 @@ - (NSDate*) lastOfMonthDateWithTimeZone:(NSTimeZone*)timeZone{ + (NSDate*) lastofMonthDateWithTimeZone:(NSTimeZone*)timeZone{ NSDate *day = [NSDate date]; - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - NSDateComponents *comp = [gregorian components:(NSCalendarUnitYear | NSCalendarUnitMonth) fromDate:day]; + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:day]; [comp setDay:0]; [comp setMonth:comp.month+1]; return [gregorian dateFromComponents:comp]; } + (NSDate*) lastOfCurrentMonthWithTimeZone:(NSTimeZone*)timeZone{ NSDate *day = [NSDate date]; - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - NSDateComponents *comp = [gregorian components:(NSCalendarUnitYear | NSCalendarUnitMonth) fromDate:day]; + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:day]; [comp setDay:0]; [comp setMonth:comp.month+1]; return [gregorian dateFromComponents:comp]; diff --git a/TapkuLibrary/NSDate+TKCategory.h b/TapkuLibrary/NSDate+TKCategory.h new file mode 100755 index 00000000..b183dbb9 --- /dev/null +++ b/TapkuLibrary/NSDate+TKCategory.h @@ -0,0 +1,258 @@ +// +// NSDateAdditions.h +// Created by Devin Ross on 7/28/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; + +#pragma mark - NSDate + TKCategory +/** Additional functionality for `NSDate`. */ +@interface NSDate (TKCategory) + + +#pragma mark Yesterday +/** Creates and returns a new date set to the previous day and current time. + @return A `NSDate` object set to yesterday. + */ ++ (NSDate *) yesterday; + +/** Creates and returns a new date set to the previous day and current time. + Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results. + @param timeZone The time zone to repect. + @return A `NSDate` object set to yesterday. + */ ++ (NSDate*) yesterdayWithTimeZone:(NSTimeZone*)timeZone; + + + +/** Creates and returns a new date set to tomorrow's day and current time. + @return A `NSDate` object set to tomorrow. + */ ++ (NSDate*) tomorrow; + +/** Creates and returns a new date set to the tomorrow's day and current time. + Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results. + + @param timeZone The time zone to repect. + @return A `NSDate` object set to tomorrow. + */ ++ (NSDate*) tomorrowWithTimeZone:(NSTimeZone*)timeZone; + + +#pragma mark Month +/** Creates and returns a new date set to the current month date. + @return A `NSDate` object set to the current month. + */ ++ (NSDate *) month; + +/** Creates and returns a new date set to the current month date. + Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results. + + @param timeZone The time zone to repect. + @return A `NSDate` object set to the current month. + */ ++ (NSDate*) monthWithTimeZone:(NSTimeZone*)timeZone; + +/** Creates and returns a new date set to the first day of the month from the date object. + @return A `NSDate` object set to the same month as the date object. The day will be the first of the month. + */ +@property (nonatomic, readonly, copy) NSDate *monthDate; + +/** Creates and returns a new date set to the first day of the month from the date object. + Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results. + + @param timeZone Time Zone for month. + @return A `NSDate` object set to the same month as the date object. The day will be the first of the month. + */ +- (NSDate *) monthDateWithTimeZone:(NSTimeZone*)timeZone; + + +#pragma mark Same Day +/** Returns whether the compared date shares the date with respect to the default time zone. + @param anotherDate The date to compare. + @return YES if the two dates share the same year, month and day. Otherwise NO. + */ +- (BOOL) isSameDay:(NSDate*)anotherDate; + +/** Returns whether the compared date shares the date with respect to the given time zone. + @param anotherDate The date to compare. + @param timeZone The time zone used to determine the current day. + @return YES if the two dates share the same year, month and day. Otherwise NO. + */ +- (BOOL) isSameDay:(NSDate*)anotherDate timeZone:(NSTimeZone*)timeZone; + + + +#pragma mark Same Month +/** Returns whether the compared date shares the month with respect to the given time zone. + @param anotherDate The date to compare. + @return YES if the two dates share the same year, month. Otherwise NO. + */ +- (BOOL) isSameMonth:(NSDate *)anotherDate; + +/** Returns whether the compared date shares the month with respect to the given time zone. + @param anotherDate The date to compare. + @param timeZone The time zone used to determine the current day. + @return YES if the two dates share the same year, month. Otherwise NO. + */ +- (BOOL) isSameMonth:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone; + +#pragma mark Same Year +/** Returns whether the compared date shares the year with respect to the given time zone. + @param anotherDate The date to compare. + @return YES if the two dates share the same year. Otherwise NO. + */ +- (BOOL) isSameYear:(NSDate *)anotherDate; + +/** Returns whether the compared date shares the year with respect to the given time zone. + @param anotherDate The date to compare. + @param timeZone The time zone used to determine the current day. + @return YES if the two dates share the same year. Otherwise NO. + */ +- (BOOL) isSameYear:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone; + + + +#pragma mark Month and Days Between + +/** Returns number of months between two dates. + @param date The other date to compare. + @return Returns number of months between two dates. + */ +- (NSInteger) monthsBetweenDate:(NSDate *)date; + + + +/** Returns number of months between two dates. + @param toDate The other date to compare. + @param timeZone The time zone to respect. + @return Returns number of months between two dates. + */ +- (NSInteger) monthsBetweenDate:(NSDate *)toDate timeZone:(NSTimeZone*)timeZone; + +- (NSInteger) daysBetweenDate:(NSDate*)date; + + +#pragma mark Is Today +/** Returns a Boolean value that indicates whether the date object is that same date information as the current day. + @return YES if the date object represents the current date, otherwise NO. + */ +@property (nonatomic, getter=isToday, readonly) BOOL today; + +/** Returns a Boolean value that indicates whether the date object is that same date information as the current day. + @param timeZone The time zone to respect. + @return YES if the date object represents the current date, otherwise NO. + */ +- (BOOL) isTodayWithTimeZone:(NSTimeZone*)timeZone; + + +/** Returns a Boolean value that indicates whether the date object is that same date information as tomorrow. + @return YES if the date object represents tomorrow's date, otherwise NO. + */ +@property (nonatomic, getter=isTomorrow, readonly) BOOL tomorrow; + +/** Returns a Boolean value that indicates whether the date object is that same date information as tomorrow. + @param timeZone The time zone to respect. + @return YES if the date object represents tomorrow's date, otherwise NO. + */ +- (BOOL) isTomorrowWithTimeZone:(NSTimeZone*)timeZone; + + +/** Returns a Boolean value that indicates whether the date object is that same date information as yesterday. + @return YES if the date object represents yesterday's date, otherwise NO. + */ +@property (nonatomic, getter=isYesterday, readonly) BOOL yesterday; +/** Returns a Boolean value that indicates whether the date object is that same date information as yesterday. + @param timeZone The time zone to respect. + @return YES if the date object represents yesterday's date, otherwise NO. + */ +- (BOOL) isYesterdayWithTimeZone:(NSTimeZone*)timeZone; + + +#pragma mark Month & Year String +/** Returns a NSString with the localized month and year string for the NSDate object. + @return An NSString object. + */ +@property (nonatomic, readonly, copy) NSString *monthYearString; + +/** Returns a NSString with the localized month and year string for the NSDate object. + @param timeZone The time zone to respect. + @return An NSString object. + */ +- (NSString *) monthYearStringWithTimeZone:(NSTimeZone*)timeZone; + +/** Returns a NSString with the localized month string for the NSDate object. + @return An NSString object. + */ +@property (nonatomic, readonly, copy) NSString *monthString; + +/** Returns a NSString with the localized month string for the NSDate object. + @param timeZone The time zone to respect. + @return An NSString object. + */ +- (NSString*) monthStringWithTimeZone:(NSTimeZone*)timeZone; + +/** Returns a NSString with the localized year string for the NSDate object. + @return An NSString object. + */ +@property (nonatomic, readonly, copy) NSString *yearString; + +/** Returns a NSString with the localized year string for the NSDate object. + @param timeZone The time zone to respect. + @return An NSString object. + */ +- (NSString*) yearStringWithTimeZone:(NSTimeZone*)timeZone; + + +#pragma mark Date Compontents +/** Returns a NSDate from the given component information for the gregorian calendar. + @param components The information used to create the date. + @return A NSDate object. + */ ++ (NSDate*) dateWithDateComponents:(NSDateComponents*)components; + +/** Returns an NSDateComponents object from the NSDate object with respect to the given time zone and gregorian calendar. + @param timeZone The time zone to respect. + @return A NSDateComponents object. + */ +- (NSDateComponents*) dateComponentsWithTimeZone:(NSTimeZone*)timeZone; + + +- (NSDate *) dateByAddingDays:(NSUInteger)days; ++ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime; + + ++ (NSDate*) firstDateOfWeekWithTimeZone:(NSTimeZone*)timeZone; ++ (NSDate*) firstDateOfWeek; +- (NSDate*) firstDateOfWeekWithTimeZone:(NSTimeZone*)timeZone; +@property (nonatomic, readonly, copy) NSDate *firstDateOfWeek; + ++ (NSInteger) daysBetweenDate:(NSDate*)fromDateTime andDate:(NSDate*)toDateTime; + +@end diff --git a/TapkuLibrary/NSDate+TKCategory.m b/TapkuLibrary/NSDate+TKCategory.m new file mode 100755 index 00000000..4317bb68 --- /dev/null +++ b/TapkuLibrary/NSDate+TKCategory.m @@ -0,0 +1,299 @@ +// +// NSDateAdditions.m +// Created by Devin Ross on 7/28/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +#import "NSDate+TKCategory.h" + +#pragma mark - NSDate + TKCategory +@implementation NSDate (TKCategory) + +#pragma mark Yesterday ++ (NSDate*) yesterday{ + return [NSDate yesterdayWithTimeZone:[NSTimeZone defaultTimeZone]]; +} ++ (NSDate*) yesterdayWithTimeZone:(NSTimeZone*)timeZone{ + NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone]; + comp.day--; + return [NSDate dateWithDateComponents:comp]; +} + + +#pragma mark Tomorrow ++ (NSDate*) tomorrow{ + return [NSDate tomorrowWithTimeZone:[NSTimeZone defaultTimeZone]]; +} ++ (NSDate*) tomorrowWithTimeZone:(NSTimeZone*)timeZone{ + NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone]; + comp.day++; + return [NSDate dateWithDateComponents:comp]; +} + +#pragma mark Month ++ (NSDate*) month{ + return [[NSDate date] monthDateWithTimeZone:[NSTimeZone defaultTimeZone]]; +} ++ (NSDate*) monthWithTimeZone:(NSTimeZone*)timeZone{ + return [[NSDate date] monthDateWithTimeZone:timeZone]; +} +- (NSDate*) monthDate{ + return [self monthDateWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (NSDate*) monthDateWithTimeZone:(NSTimeZone*)timeZone{ + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + gregorian.timeZone = timeZone; + NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:self]; + [comp setDay:1]; + NSDate *date = [gregorian dateFromComponents:comp]; + return date; +} + + +#pragma mark Between +- (NSInteger) monthsBetweenDate:(NSDate *)toDate{ + return [self monthsBetweenDate:toDate timeZone:[NSTimeZone defaultTimeZone]]; +} +- (NSInteger) monthsBetweenDate:(NSDate *)toDate timeZone:(NSTimeZone*)timeZone{ + if([self compare:toDate]==NSOrderedSame) return 0; + + NSDate *first = nil, *last = nil; + if([self compare:toDate] == NSOrderedAscending){ + first = self; + last = toDate; + }else{ + first = toDate; + last = self; + } + + NSDateComponents *d1 = [first dateComponentsWithTimeZone:timeZone]; + NSDateComponents *d2 = [last dateComponentsWithTimeZone:timeZone]; + + if(d1.year == d2.year) + return d2.month - d1.month; + + + NSInteger ret = 12 - d1.month; + ret += d2.month; + d1.year += 1; + ret += 12 * (d2.year-d1.year); + + return ret; +} +- (NSInteger) daysBetweenDate:(NSDate*)date { + NSTimeInterval time = [self timeIntervalSinceDate:date]; + return ((abs(time) / (60.0 * 60.0 * 24.0)) + 0.5); +} + ++ (NSInteger) daysBetweenDate:(NSDate*)fromDateTime andDate:(NSDate*)toDateTime{ + NSDate *fromDate; + NSDate *toDate; + + NSCalendar *calendar = [NSCalendar currentCalendar]; + + [calendar rangeOfUnit:NSDayCalendarUnit startDate:&fromDate interval:NULL forDate:fromDateTime]; + [calendar rangeOfUnit:NSDayCalendarUnit startDate:&toDate interval:NULL forDate:toDateTime]; + + NSDateComponents *difference = [calendar components:NSDayCalendarUnit fromDate:fromDate toDate:toDate options:0]; + + return [difference day]; +} + + +#pragma mark Same Day +- (BOOL) isSameDay:(NSDate*)anotherDate{ + return [self isSameDay:anotherDate timeZone:[NSTimeZone defaultTimeZone]]; +} +- (BOOL) isSameDay:(NSDate*)anotherDate timeZone:(NSTimeZone*)timeZone{ + NSCalendar* calendar = [NSCalendar currentCalendar]; + calendar.timeZone = timeZone; + NSDateComponents* components1 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self]; + NSDateComponents* components2 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:anotherDate]; + return ([components1 year] == [components2 year] && [components1 month] == [components2 month] && [components1 day] == [components2 day]); +} + +#pragma mark Same Month +- (BOOL) isSameMonth:(NSDate *)anotherDate{ + return [self isSameMonth:anotherDate timeZone:[NSTimeZone defaultTimeZone]]; +} +- (BOOL) isSameMonth:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone{ + + NSCalendar* calendar = [NSCalendar currentCalendar]; + calendar.timeZone = timeZone; + NSDateComponents* components1 = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:self]; + NSDateComponents* components2 = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:anotherDate]; + return components1.year == components2.year && components1.month == components2.month; +} + +#pragma mark Same Year +- (BOOL) isSameYear:(NSDate *)anotherDate{ + return [self isSameYear:anotherDate timeZone:[NSTimeZone defaultTimeZone]]; +} +- (BOOL) isSameYear:(NSDate *)anotherDate timeZone:(NSTimeZone *)timeZone{ + + NSCalendar* calendar = [NSCalendar currentCalendar]; + calendar.timeZone = timeZone; + NSDateComponents* components1 = [calendar components:NSYearCalendarUnit fromDate:self]; + NSDateComponents* components2 = [calendar components:NSYearCalendarUnit fromDate:anotherDate]; + return components1.year == components2.year; + +} + +#pragma mark Is Today +- (BOOL) isToday{ + return [self isSameDay:[NSDate date]]; +} +- (BOOL) isTodayWithTimeZone:(NSTimeZone*)timeZone{ + return [self isSameDay:[NSDate date] timeZone:timeZone]; +} + +- (BOOL) isTomorrow{ + return [self isTomorrowWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (BOOL) isTomorrowWithTimeZone:(NSTimeZone*)timeZone{ + NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone]; + comp.day++; + NSDate *actualTomorrow = [NSDate dateWithDateComponents:comp]; + return [self isSameDay:actualTomorrow timeZone:timeZone]; +} + + +- (BOOL) isYesterday{ + return [self isYesterdayWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (BOOL) isYesterdayWithTimeZone:(NSTimeZone*)timeZone{ + NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone]; + comp.day--; + NSDate *actualTomorrow = [NSDate dateWithDateComponents:comp]; + return [self isSameDay:actualTomorrow timeZone:timeZone]; +} + +#pragma mark Month & Year String +- (NSString *) monthYearString{ + return [self monthYearStringWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (NSString *) monthYearStringWithTimeZone:(NSTimeZone*)timeZone{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.timeZone = timeZone; + dateFormatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:@"yMMMM" + options:0 + locale:[NSLocale currentLocale]]; + return [dateFormatter stringFromDate:self]; +} + +- (NSString*) monthString{ + return [self monthStringWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (NSString*) monthStringWithTimeZone:(NSTimeZone*)timeZone{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.timeZone = timeZone; + [dateFormatter setDateFormat:@"MMMM"]; + return [dateFormatter stringFromDate:self]; +} + +- (NSString*) yearString{ + return [self yearStringWithTimeZone:[NSTimeZone defaultTimeZone]]; +} +- (NSString*) yearStringWithTimeZone:(NSTimeZone*)timeZone{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.timeZone = timeZone; + [dateFormatter setDateFormat:@"yyyy"]; + return [dateFormatter stringFromDate:self]; +} + + +#pragma mark Date Compontents +- (NSDateComponents*) dateComponentsWithTimeZone:(NSTimeZone*)timeZone{ + + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + gregorian.timeZone = timeZone; + return [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit | NSWeekdayCalendarUnit | NSTimeZoneCalendarUnit) fromDate:self]; +} ++ (NSDate*) dateWithDateComponents:(NSDateComponents*)components{ + + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + gregorian.timeZone = components.timeZone; + return [gregorian dateFromComponents:components]; +} + + +- (NSDate *) dateByAddingDays:(NSUInteger)days { + NSDateComponents *c = [[NSDateComponents alloc] init]; + c.day = days; + return [[NSCalendar currentCalendar] dateByAddingComponents:c toDate:self options:0]; +} ++ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime { + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"dd/MM/yyyy"]; + NSString *datePortion = [dateFormatter stringFromDate:aDate]; + + [dateFormatter setDateFormat:@"HH:mm"]; + NSString *timePortion = [dateFormatter stringFromDate:aTime]; + + [dateFormatter setDateFormat:@"dd/MM/yyyy HH:mm"]; + NSString *dateTime = [NSString stringWithFormat:@"%@ %@",datePortion,timePortion]; + return [dateFormatter dateFromString:dateTime]; +} + + + +- (NSDate*) firstDateOfWeekWithTimeZone:(NSTimeZone*)timeZone{ + NSCalendar *gregorian = [NSCalendar currentCalendar]; + + NSDateComponents *weekdayComponents = [gregorian components:NSWeekdayCalendarUnit fromDate:self]; + weekdayComponents.timeZone = timeZone; + + NSDateComponents *componentsToSubtract = [[NSDateComponents alloc] init]; + componentsToSubtract.timeZone = timeZone; + + [componentsToSubtract setDay: - ([weekdayComponents weekday] - [gregorian firstWeekday])]; + + NSDate *beginningOfWeek = [gregorian dateByAddingComponents:componentsToSubtract toDate:self options:0]; + + + NSDateComponents *components = [gregorian components: (NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate: beginningOfWeek]; + components.timeZone = timeZone; + + beginningOfWeek = [gregorian dateFromComponents: components]; + + return beginningOfWeek; +} + + +- (NSDate*) firstDateOfWeek{ + return [self firstDateOfWeekWithTimeZone:[NSTimeZone defaultTimeZone]]; +} + + ++ (NSDate*) firstDateOfWeekWithTimeZone:(NSTimeZone*)timeZone{ + return [[NSDate date] firstDateOfWeekWithTimeZone:timeZone]; +} ++ (NSDate*) firstDateOfWeek{ + return [[NSDate date] firstDateOfWeek]; +} + +@end diff --git a/TapkuLibrary/NSMutableArray+TKCategory.h b/TapkuLibrary/NSMutableArray+TKCategory.h new file mode 100644 index 00000000..6f224d7a --- /dev/null +++ b/TapkuLibrary/NSMutableArray+TKCategory.h @@ -0,0 +1,43 @@ +// +// NSMutableArray+TKCategory.h +// Created by Devin Ross on 4/12/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; + +/** Additional functionality for `NSMutableArray`. */ +@interface NSMutableArray (TKCategory) + +/** Shuffles the order of the objects. */ +- (void) shuffle; + +/** Remove first object. */ +- (void) removeFirstObject; + +@end diff --git a/TapkuLibrary/NSMutableArray+TKCategory.m b/TapkuLibrary/NSMutableArray+TKCategory.m new file mode 100644 index 00000000..04a1e7ea --- /dev/null +++ b/TapkuLibrary/NSMutableArray+TKCategory.m @@ -0,0 +1,49 @@ +// +// NSMutableArray+TKCategory.m +// Created by Devin Ross on 4/12/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +#import "NSMutableArray+TKCategory.h" + +@implementation NSMutableArray (TKCategory) + +- (void) shuffle{ + NSUInteger count = [self count]; + for (NSUInteger i = 0; i < count; ++i) { + NSInteger nElements = count - i; + NSInteger n = (arc4random() % nElements) + i; + [self exchangeObjectAtIndex:i withObjectAtIndex:n]; + } +} + + +- (void) removeFirstObject{ + [self removeObjectAtIndex:0]; +} + +@end diff --git a/TapkuLibrary/NSObject+TKCategory.h b/TapkuLibrary/NSObject+TKCategory.h new file mode 100644 index 00000000..28e792df --- /dev/null +++ b/TapkuLibrary/NSObject+TKCategory.h @@ -0,0 +1,132 @@ +// +// NSObject+TKCategory.h +// Created by Devin Ross on 12/29/12. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; + +/** Additional functionality for `NSObject`. */ +@interface NSObject (TKCategory) + +/** For subclassing, this method should return the item's properties mapped to the data dictionary keys. + See the DataTests.m for an example implementation. + + + @{ + @"identifier" : @"id", + @"name" : @"name", + @"createdAt" : @[@"created_at",@"yyyy-MM-dd'T'HH:mm:ss"], // For NSDate + @"updatedAt" : @[@"updated_at",@"yyyy-MM-dd"] + }; + + + @returns The dictionary used to fill up data from the data dictionary. + */ ++ (NSDictionary*) dataKeys; + + +/** Creates object and imports data from an `NSDictionary` objects using the map provided by the dataKeys dictionary. + + @param dictionary The data that will be imported. + @returns The newly allocated object. + + */ ++ (id) createObject:(NSDictionary*)dictionary; + + +- (instancetype) initWithDataDictionary:(NSDictionary*)dictionary; + + +/** Imports data from an `NSDictionary` objects using the map provided by the dataKeys dictionary. + + @param dictionary The data that will be imported. + */ +- (void) importDataWithDictionary:(NSDictionary*)dictionary; + + +@property (nonatomic, readonly, copy) NSDictionary *dataDictionary; + +#if NS_BLOCKS_AVAILABLE + +typedef void (^TKJSONCompletionBlock)(id object,NSError *error); + +/** Process JSON data in the background with a completion block. + @param data The JSON data. + @param block The block that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + */ +- (void) processJSON:(NSData*)data withCompletion:(TKJSONCompletionBlock)block; + +/** Process JSON data in the background with a completion block. + @param data The JSON data. + @param options An json parsing options to be included will parsing the JSON data. + @param block The block that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + */ +- (void) processJSON:(NSData*)data options:(NSJSONReadingOptions)options withCompletion:(TKJSONCompletionBlock)block; + +#endif + +/** Process JSON data in the background with a callback selector. + @param data The JSON data. + @param callback The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + */ +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback; + +/** Process JSON data in the background with a callback selector. + @param data The JSON data. + @param callback The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + @param options An json parsing options to be included will parsing the JSON data. + */ +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback readingOptions:(NSJSONReadingOptions)options; + +/** Process JSON data in the background with a callback selector. + @param data The JSON data. + @param callback The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + @param backgroundProcessor The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector. + @param options An json parsing options to be included will parsing the JSON data. + */ +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor readingOptions:(NSJSONReadingOptions)options; + +/** Process JSON data in the background with a callback selector. + @param data The JSON data. + @param callback The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + @param backgroundProcessor The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector. + @param errroSelector The selector that will be called upon if there is an error parsing the data. + */ +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor errorSelector:(SEL)errroSelector; + +/** Process JSON data in the background with a callback selector. + @param data The JSON data. + @param callback The selector that will be performed upon the parsing of the json data. The process data will be included as an object with the selector. + @param backgroundProcessor The selector that will be performed in the background upon the parsing of the json data. The process data will be included as an object with the selector. This selector must return some type of object to be passed to the callback selector. + @param errroSelector The selector that will be called upon if there is an error parsing the data. + @param options An json parsing options to be included will parsing the JSON data. + */ +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor errorSelector:(SEL)errroSelector readingOptions:(NSJSONReadingOptions)options; + +@end diff --git a/TapkuLibrary/NSObject+TKCategory.m b/TapkuLibrary/NSObject+TKCategory.m new file mode 100644 index 00000000..93f6144a --- /dev/null +++ b/TapkuLibrary/NSObject+TKCategory.m @@ -0,0 +1,273 @@ +// +// NSObject+TKCategory.m +// Created by Devin Ross on 12/29/12. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "NSObject+TKCategory.h" + +#define VALID_OBJECT(_OBJ) _OBJ && (id)_OBJ != [NSNull null] && ((![_OBJ isKindOfClass:[NSString class]]) || [(NSString*)_OBJ length] > 0) + +@implementation NSObject (TKCategory) + + ++ (NSDictionary*) dataKeys{ + return @{}; +} + + ++ (id) createObject:(NSDictionary*)data{ + return [[[self class] alloc] initWithDataDictionary:data]; +} +- (instancetype) initWithDataDictionary:(NSDictionary*)dictionary{ + if((id)dictionary == [NSNull null]) return nil; + if(!(self=[self init])) return nil; + [self importDataWithDictionary:VALID_OBJECT(dictionary)?dictionary:nil]; + return self; +} +- (void) importDataWithDictionary:(NSDictionary*)rawData{ + + NSDateFormatter *formatter = nil; + NSDictionary *propertyKeys = [[self class] dataKeys]; + + for(NSString *propertyKey in propertyKeys.allKeys){ + + id jsonKey = propertyKeys[propertyKey]; + + if([jsonKey isKindOfClass:[NSString class]]){ + + id obj = rawData[jsonKey]; + if(VALID_OBJECT(obj)) [self setValue:obj forKey:propertyKey]; + + }else if([jsonKey isKindOfClass:[NSArray class]]){ + + NSString *format = [jsonKey lastObject]; + jsonKey = [jsonKey firstObject]; + + if(VALID_OBJECT(format) && VALID_OBJECT(jsonKey) && VALID_OBJECT(rawData[jsonKey])){ + if(!formatter) formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:format]; + NSDate *date = [formatter dateFromString:rawData[jsonKey]]; + [self setValue:date forKey:propertyKey]; + } + + }else if([jsonKey isKindOfClass:[NSDictionary class]]){ + + NSDictionary *dataKeyDictionary = (NSDictionary*)jsonKey; + Class class = NSClassFromString(dataKeyDictionary[@"class"]); + jsonKey = dataKeyDictionary[@"key"]; + + if([rawData[jsonKey] isKindOfClass:[NSDictionary class]] || [rawData[jsonKey] isKindOfClass:[NSArray class]]){ + Class structure = NSClassFromString(dataKeyDictionary[@"structure"]); + if(structure == [NSArray class]){ + if([rawData[jsonKey] isKindOfClass:[NSArray class]]){ + NSArray *rawArray = rawData[jsonKey]; + NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:rawArray.count]; + for(NSDictionary *subDictionary in rawArray){ + + + if([subDictionary isKindOfClass:[NSDictionary class]]) + [mutableArray addObject:[class createObject:subDictionary]]; + + } + [self setValue:mutableArray.copy forKey:propertyKey]; + } + }else if([rawData[jsonKey] isKindOfClass:[NSDictionary class]]){ + id obj = [class createObject:rawData[jsonKey]]; + [self setValue:obj forKeyPath:propertyKey]; + } + }else{ + [self setValue:nil forKeyPath:propertyKey]; + } + } + } + +} + + +- (NSDictionary*) dataDictionary{ + + NSDateFormatter *formatter = nil; + NSMutableDictionary *ret = [NSMutableDictionary dictionary]; + NSDictionary *dataKeys = [[self class] dataKeys]; + + for(id propertyKey in [dataKeys allKeys]){ + + id value = [self valueForKey:propertyKey]; + + if(value && [value isKindOfClass:[NSDate class]]){ + NSArray *array = dataKeys[propertyKey]; + + if(!formatter) formatter = [[NSDateFormatter alloc] init]; + formatter.dateFormat = array.lastObject; + NSString *date = [formatter stringFromDate:value]; + ret[array[0]] = date; + + }else if(value && [dataKeys[propertyKey] isKindOfClass:[NSDictionary class]]){ + + NSDictionary *keyDict = dataKeys[propertyKey]; + + if(NSClassFromString(keyDict[@"structure"]) == [NSArray class]){ + + NSArray *propertyArray = value; + if(!propertyArray) continue; + + NSMutableArray *dictArray = [NSMutableArray arrayWithCapacity:propertyArray.count]; + for(id obj in propertyArray){ + [dictArray addObject:[obj dataDictionary]]; + } + ret[dataKeys[propertyKey][@"key"]] = dictArray.copy; + + }else{ + ret[dataKeys[propertyKey][@"key"]] = [value dataDictionary]; + } + + + }else if(value) + ret[dataKeys[propertyKey]] = value; + + } + return ret; + +} + + +#pragma mark Process JSON in Background +#if NS_BLOCKS_AVAILABLE +- (void) processJSON:(NSData*)data withCompletion:(TKJSONCompletionBlock)block{ + [self processJSON:data options:0 withCompletion:block]; +} + +- (void) processJSON:(NSData*)data options:(NSJSONReadingOptions)options withCompletion:(TKJSONCompletionBlock)block{ + + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul); + dispatch_async(queue, ^{ + + NSError *error; + id object = [NSJSONSerialization JSONObjectWithData:data options:options error:&error]; + dispatch_sync(dispatch_get_main_queue(), ^{ + block(object,error); + }); + }); + +} +#endif + +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback{ + + [self processJSONDataInBackground:data + withCallbackSelector:callback + backgroundSelector:nil + errorSelector:nil + readingOptions:0]; + +} + +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback readingOptions:(NSJSONReadingOptions)options{ + + [self processJSONDataInBackground:data + withCallbackSelector:callback + backgroundSelector:nil + errorSelector:nil + readingOptions:options]; + +} + +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor readingOptions:(NSJSONReadingOptions)options{ + + [self processJSONDataInBackground:data + withCallbackSelector:callback + backgroundSelector:backgroundProcessor + errorSelector:nil + readingOptions:options]; + +} + +- (void) processJSONDataInBackground:(NSData *)data withCallbackSelector:(SEL)callback backgroundSelector:(SEL)backgroundProcessor errorSelector:(SEL)errroSelector{ + + [self processJSONDataInBackground:data + withCallbackSelector:callback + backgroundSelector:backgroundProcessor + errorSelector:errroSelector + readingOptions:0]; + +} + + +- (void) processJSONDataInBackground:(NSData *)data + withCallbackSelector:(SEL)callback + backgroundSelector:(SEL)backgroundProcessor + errorSelector:(SEL)errroSelector + readingOptions:(NSJSONReadingOptions)options{ + + + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + + dict[@"data"] = data; + dict[@"flags"] = @(options); + + + if(callback) dict[@"callback"] = NSStringFromSelector(callback); + if(backgroundProcessor) dict[@"backgroundProcessor"] = NSStringFromSelector(backgroundProcessor); + if(errroSelector) dict[@"errroSelector"] = NSStringFromSelector(errroSelector); + + + [self performSelectorInBackground:@selector(_processJSONData:) withObject:dict]; + + +} + + +- (void) _processJSONData:(NSDictionary*)dict{ + @autoreleasepool { + NSError *error = nil; + + NSData *data = dict[@"data"]; + NSUInteger options = [dict[@"flags"] unsignedIntValue]; + + NSString *callback = dict[@"callback"]; + NSString *background = dict[@"backgroundProcessor"]; + NSString *eSelector = dict[@"errroSelector"]; + + id object = [NSJSONSerialization JSONObjectWithData:data options:options error:&error]; + + + + if(error && eSelector){ + [self performSelector:NSSelectorFromString(eSelector) withObject:error]; + }else if(!error){ + if(background) object = [self performSelector:NSSelectorFromString(background) withObject:object]; + [self performSelectorOnMainThread:NSSelectorFromString(callback) withObject:object waitUntilDone:NO]; + } + } +} + + + + +@end diff --git a/TapkuLibrary/NSString+TKCategory.h b/TapkuLibrary/NSString+TKCategory.h new file mode 100755 index 00000000..0b65a079 --- /dev/null +++ b/TapkuLibrary/NSString+TKCategory.h @@ -0,0 +1,92 @@ +// +// NSStringAddition.h +// Created by Devin Ross on 10/26/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; + +/** Additional functionality for `NSString`. */ +@interface NSString (TKCategory) + + +/** Returns `YES` if a string is a valid email address, otherwise `NO`. + @return True if the string is formatted properly as an email address. + */ +@property (nonatomic, getter=isEmail, readonly) BOOL email; + +/** Returns a `NSString` that is URL friendly. + @return A URL encoded string. + */ +@property (nonatomic, readonly, copy) NSString *URLEncode; + +/** Returns a `NSString` that properly replaces HTML specific character sequences. + @return An escaped HTML string. + */ +@property (nonatomic, readonly, copy) NSString *escapeHTML; + +/** Returns a `NSString` that properly formats text for HTML. + @return An unescaped HTML string. + */ +@property (nonatomic, readonly, copy) NSString *unescapeHTML; + +/** Returns a `NSString` that removes HTML elements. + @return Returns a string without the HTML elements. + */ +@property (nonatomic, readonly, copy) NSString *stringByRemovingHTML; + +/** Returns an MD5 string of from the given `NSString`. + @return A MD5 string. + */ +@property (nonatomic, readonly, copy) NSString *md5sum; + +/** Returns `YES` is a string has the substring, otherwise `NO`. + @param substring The substring. + @return `YES` if the substring is contained in the string, otherwise `NO`. + */ +- (BOOL) hasString:(NSString*)substring; + + +@property (nonatomic, readonly, copy) NSString *capitalizeSentence; + + +/** Returns the credit card type based on the first for digits of the card number. + @return A credit card company name if the number matches a company otherwise nil. + */ +@property (nonatomic, readonly, copy) NSString *creditCardType; + +/** Returns YES if the card number passes the Luhn algorithm. No spaces in the card number. + @return Returns YES if the card is a valid credit card number, otherwise NO. + */ +@property (nonatomic, getter=isValidCreditCardNumber, readonly) BOOL validCreditCardNumber; + + +- (NSString*) formattedPhoneNumberWithLastCharacterRemoved:(BOOL)deleteLastChar; + + +@end diff --git a/TapkuLibrary/NSString+TKCategory.m b/TapkuLibrary/NSString+TKCategory.m new file mode 100644 index 00000000..2da83f7a --- /dev/null +++ b/TapkuLibrary/NSString+TKCategory.m @@ -0,0 +1,335 @@ +// +// NSStringAddition.m +// Created by Devin Ross on 10/26/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "NSString+TKCategory.h" +#import + +@implementation NSString (TKCategory) + + +- (NSString*) creditCardType{ + if(self.length < 4) return nil; + + NSString *firstTwo = [self substringToIndex:2]; + NSInteger value = firstTwo.integerValue; + + if(value == 34 || value == 37) + return NSLocalizedString(@"American Express", @""); + + else if(value == 36) + return NSLocalizedString(@"Diners Club", @""); + + else if(value == 38) + return NSLocalizedString(@"Carte Blanche", @""); + + else if(value > 50 && value < 56) + return NSLocalizedString(@"Master Card", @""); + + + + + + NSString *firstFour = [self substringToIndex:4]; + value = firstFour.integerValue; + + + if(value == 2014 || value == 2149) + return NSLocalizedString(@"EnRoute", @""); + + else if(value == 2131 || value == 1800) + return NSLocalizedString(@"JCB", @""); + + else if(value == 6011) + return NSLocalizedString(@"Discover", @""); + + + + + NSString *firstThree = [self substringToIndex:3]; + value = firstThree.integerValue; + + if(value >= 300 && value < 306) return NSLocalizedString(@"Diners Club", @""); + + NSString *firstOne = [self substringToIndex:1]; + value = firstOne.integerValue; + + if(value == 3) return NSLocalizedString(@"JCB", @""); + + else if(value == 4) return NSLocalizedString(@"Visa", @""); + + + return NSLocalizedString(@"Unknown", @""); +} + + +- (BOOL) isValidCreditCardNumber{ + + NSCharacterSet *nonDecimalsSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; + + if([self rangeOfCharacterFromSet:nonDecimalsSet].location != NSNotFound) + return NO; + + + + + + NSInteger luhnChecksum = 0; + NSInteger subtractionNumber = 48; + + for (NSInteger i=0;i 1){ + luhnChecksum += [@([doubleDigit characterAtIndex:0]) integerValue]-subtractionNumber; + luhnChecksum += [@([doubleDigit characterAtIndex:1]) integerValue]-subtractionNumber; + }else{ + luhnChecksum += doubled; + } + } + + + return luhnChecksum % 10 == 0; +} + + + + + +- (NSString*) capitalizeSentence{ + if(self.length < 1) return self; + + return [self stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:[self substringToIndex:1].capitalizedString]; +} + +- (BOOL) isEmail{ + + NSString *emailRegEx = + @"(?:[a-z0-9!#$%\\&'*+/=?\\^_`{|}~-]+(?:\\.[a-z0-9!#$%\\&'*+/=?\\^_`{|}" + @"~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\" + @"x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-" + @"z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5" + @"]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-" + @"9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21" + @"-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"; + + NSPredicate *regExPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx]; + return [regExPredicate evaluateWithObject:[self lowercaseString]]; +} + +- (NSString*) URLEncode{ + + NSString *encodedString = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes( + NULL, + (__bridge CFStringRef)self, + NULL, + (CFStringRef)@"!*'();:@&=+$,/?%#[]", + kCFStringEncodingUTF8 ); + + return encodedString; + +} + + +- (NSString *) escapeHTML{ + NSMutableString *s = [NSMutableString string]; + + NSInteger start = 0; + NSInteger len = [self length]; + NSCharacterSet *chs = [NSCharacterSet characterSetWithCharactersInString:@"<>&\""]; + + while (start < len) { + NSRange r = [self rangeOfCharacterFromSet:chs options:0 range:NSMakeRange(start, len-start)]; + if (r.location == NSNotFound) { + [s appendString:[self substringFromIndex:start]]; + break; + } + + if (start < r.location) { + [s appendString:[self substringWithRange:NSMakeRange(start, r.location-start)]]; + } + + switch ([self characterAtIndex:r.location]) { + case '<': + [s appendString:@"<"]; + break; + case '>': + [s appendString:@">"]; + break; + case '"': + [s appendString:@"""]; + break; + // case '…': + // [s appendString:@"…"]; + // break; + case '&': + [s appendString:@"&"]; + break; + } + + start = r.location + 1; + } + + return s; +} + +- (NSString *) unescapeHTML{ + NSMutableString *s = [NSMutableString string]; + NSMutableString *target = [self mutableCopy]; + NSCharacterSet *chs = [NSCharacterSet characterSetWithCharactersInString:@"&"]; + + while ([target length] > 0) { + NSRange r = [target rangeOfCharacterFromSet:chs]; + if (r.location == NSNotFound) { + [s appendString:target]; + break; + } + + if (r.location > 0) { + [s appendString:[target substringToIndex:r.location]]; + [target deleteCharactersInRange:NSMakeRange(0, r.location)]; + } + + if ([target hasPrefix:@"<"]) { + [s appendString:@"<"]; + [target deleteCharactersInRange:NSMakeRange(0, 4)]; + } else if ([target hasPrefix:@">"]) { + [s appendString:@">"]; + [target deleteCharactersInRange:NSMakeRange(0, 4)]; + } else if ([target hasPrefix:@"""]) { + [s appendString:@"\""]; + [target deleteCharactersInRange:NSMakeRange(0, 6)]; + } else if ([target hasPrefix:@"'"]) { + [s appendString:@"'"]; + [target deleteCharactersInRange:NSMakeRange(0, 5)]; + } else if ([target hasPrefix:@"&"]) { + [s appendString:@"&"]; + [target deleteCharactersInRange:NSMakeRange(0, 5)]; + } else if ([target hasPrefix:@"…"]) { + [s appendString:@"…"]; + [target deleteCharactersInRange:NSMakeRange(0, 8)]; + } else { + [s appendString:@"&"]; + [target deleteCharactersInRange:NSMakeRange(0, 1)]; + } + } + return s; +} + +- (NSString*) stringByRemovingHTML{ + + NSString *html = self; + NSScanner *thescanner = [NSScanner scannerWithString:html]; + NSString *text = nil; + while ([thescanner isAtEnd] == NO) { + [thescanner scanUpToString:@"<" intoString:NULL]; + [thescanner scanUpToString:@">" intoString:&text]; + html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text] withString:@" "]; + } + return html; +} + +- (NSString *) md5sum{ + unsigned char digest[CC_MD5_DIGEST_LENGTH], i; + CC_MD5([self UTF8String], (uint32_t)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); + NSMutableString *ms = [NSMutableString string]; + for (i=0;i 11 && leadingOne) || (digits.length > 10 && !leadingOne)) + return digits; + + NSStringCompareOptions opt = NSRegularExpressionSearch; + NSRange range = NSMakeRange(0, digits.length); + + NSString *occurence, *replace; + + + if(digits.length < 5 && leadingOne){ + occurence = @"(\\d{1})(\\d+)"; + replace = @"$1 ($2)"; + + }else if(digits.length < 8 && leadingOne){ + occurence = @"(\\d{1})(\\d{3})(\\d+)"; + replace = @"$1 ($2) $3"; + + }else if(digits.length<7){ + occurence = @"(\\d{3})(\\d+)"; + replace = @"($1) $2"; + + }else if(digits.length > 6 && leadingOne){ + occurence = @"(\\d{1})(\\d{3})(\\d{3})(\\d+)"; + replace = @"$1 ($2) $3-$4"; + + }else{ + occurence = @"(\\d{3})(\\d{3})(\\d+)"; + replace = @"($1) $2-$3"; + } + + digits = [digits stringByReplacingOccurrencesOfString:occurence withString:replace options:opt range:range]; + + return digits; +} + + +@end diff --git a/TapkuLibrary/TKAlertCenter.m b/TapkuLibrary/TKAlertCenter.m index 04ab1130..5087217a 100644 --- a/TapkuLibrary/TKAlertCenter.m +++ b/TapkuLibrary/TKAlertCenter.m @@ -30,6 +30,7 @@ */ #import "TKAlertCenter.h" +#import "UIView+TKCategory.h" #import "TKGlobal.h" #pragma mark - TKAlertView @@ -73,14 +74,10 @@ - (void) drawRect:(CGRect)rect{ [[UIColor colorWithWhite:0 alpha:0.8] set]; [self _drawRoundRectangleInRect:rect withRadius:10]; [[UIColor whiteColor] set]; - - - NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; - paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; - paragraphStyle.alignment = NSTextAlignmentCenter; - NSDictionary *dict = @{ NSFontAttributeName: [UIFont boldSystemFontOfSize:14], NSParagraphStyleAttributeName: paragraphStyle, NSForegroundColorAttributeName : [UIColor whiteColor] }; - [_messageText drawInRect:_messageRect withAttributes:dict]; - + [_messageText drawInRect:_messageRect + withFont:[UIFont boldSystemFontOfSize:14] + lineBreakMode:NSLineBreakByWordWrapping + alignment:NSTextAlignmentCenter]; CGRect r = CGRectZero; r.origin.y = 15; @@ -93,14 +90,9 @@ - (void) drawRect:(CGRect)rect{ #pragma mark Setter Methods - (void) adjust{ - - CGSize s = [_messageText boundingRectWithSize:CGSizeMake(160,200) - options:NSLineBreakByWordWrapping | NSStringDrawingUsesLineFragmentOrigin - attributes:@{ NSFontAttributeName : [UIFont boldSystemFontOfSize:14]} - context:nil].size; - - - [_messageText sizeWithAttributes:@{ NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]; + CGSize s = [_messageText sizeWithFont:[UIFont boldSystemFontOfSize:14] + constrainedToSize:CGSizeMake(160,200) + lineBreakMode:NSLineBreakByWordWrapping]; float imageAdjustment = 0; if (_image) { @@ -275,8 +267,8 @@ CGRect subtractRect(CGRect wf,CGRect kf){ }else{ - kf.origin.x = fabs(kf.size.width - wf.size.width); - kf.origin.y = fabs(kf.size.height - wf.size.height); + kf.origin.x = abs(kf.size.width - wf.size.width); + kf.origin.y = abs(kf.size.height - wf.size.height); if(kf.origin.x > 0){ diff --git a/TapkuLibrary/TKAlertViewController.m b/TapkuLibrary/TKAlertViewController.m index e9937a33..8d7d98ff 100644 --- a/TapkuLibrary/TKAlertViewController.m +++ b/TapkuLibrary/TKAlertViewController.m @@ -31,6 +31,7 @@ #import "TKAlertViewController.h" #import "TKGlobal.h" +#import "UIDevice+TKCategory.h" @interface TKAlertViewController () @property (nonatomic,strong) UIDynamicAnimator *animator; @@ -45,8 +46,8 @@ - (instancetype) init{ return self; } -- (UIInterfaceOrientationMask) supportedInterfaceOrientations{ - if([UIDevice currentDevice].padIdiom) +- (NSUInteger) supportedInterfaceOrientations{ + if([UIDevice padIdiom]) return UIInterfaceOrientationMaskAll; return UIInterfaceOrientationMaskPortrait; } diff --git a/TapkuLibrary/TKAppDelegate.m b/TapkuLibrary/TKAppDelegate.m index f9ac887b..4bc884b3 100644 --- a/TapkuLibrary/TKAppDelegate.m +++ b/TapkuLibrary/TKAppDelegate.m @@ -30,6 +30,7 @@ */ #import "TKAppDelegate.h" +#import "TKWindow.h" @implementation TKAppDelegate diff --git a/TapkuLibrary/TKCalendarDayEventView.m b/TapkuLibrary/TKCalendarDayEventView.m index 58b256a3..82caa4bd 100644 --- a/TapkuLibrary/TKCalendarDayEventView.m +++ b/TapkuLibrary/TKCalendarDayEventView.m @@ -30,6 +30,7 @@ */ #import "TKCalendarDayEventView.h" +#import "UIColor+TKCategory.h" #define FONT_SIZE 12.0 @@ -150,4 +151,5 @@ - (CGFloat) contentHeight{ } + @end diff --git a/TapkuLibrary/TKCalendarDayView.m b/TapkuLibrary/TKCalendarDayView.m index 84df5c99..4cf62d41 100644 --- a/TapkuLibrary/TKCalendarDayView.m +++ b/TapkuLibrary/TKCalendarDayView.m @@ -29,11 +29,17 @@ */ #import "TKCalendarDayView.h" +#import "NSDate+TKCategory.h" #import "UIImage+TKCategory.h" #import "TKGlobal.h" +#import "TKGradientView.h" +#import "UIColor+TKCategory.h" +#import "UIImageView+TKCategory.h" +#import "UIView+TKCategory.h" +#import "UIScreen+TKCategory.h" #define NOB_SIZE 6.0f -#define TOP_BAR_HEIGHT 84.0 +#define TOP_BAR_HEIGHT 64.0 #define EVENT_SAME_HOUR 3.0 #define HORIZONTAL_PAD 5.0f #define RIGHT_EVENT_INSET 10.0 @@ -46,7 +52,7 @@ #define TIMELINE_HEIGHT VERTICAL_INSET * 2 + 24 * (VERTICAL_DIFF) #define DAY_FONT_SIZE 18 #define WEEKEND_TEXT_COLOR [UIColor colorWithWhite:167/255. alpha:1] -#define DAY_LABEL_WIDTH 35.0f + #pragma mark - TKNowView @interface TKNowView : UIView @@ -177,31 +183,29 @@ - (void) _setupView{ self.currentDay = [self _timelineAtIndex:1].date; [self _updateDateLabel]; [self addSubview:self.daysBackgroundView]; - [self addSubview:self.monthYearLabel]; + //[self addSubview:self.monthYearLabel]; NSInteger cnt = 0; NSArray *daySymbols = [[NSCalendar currentCalendar] shortWeekdaySymbols]; CGFloat wid = CGRectGetWidth(self.frame); + CGFloat xmargin = 20; wid -= 8; - NSInteger per = CGFrameGetWidth(self) - (DAY_LABEL_WIDTH *7); - per /= 7; - NSInteger minX = per / 2; - for(NSString *str in daySymbols){ - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(minX + cnt*(DAY_LABEL_WIDTH+per) , 0, DAY_LABEL_WIDTH, 20)]; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(xmargin + cnt* wid/daySymbols.count, 0, 40, 20)]; label.font = [UIFont systemFontOfSize:10]; label.text = [str substringToIndex:1]; label.textColor = cnt == 0 || cnt == 6 ? WEEKEND_TEXT_COLOR : [UIColor blackColor]; label.textAlignment = NSTextAlignmentCenter; + [label sizeToFit]; label.userInteractionEnabled = NO; [self.daysBackgroundView addSubview:label]; - [label sizeToFitWithAlignment]; - cnt++; } + + [self.daysBackgroundView addSubviewToBack:self.daysScrollView]; UIView *dayContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.daysScrollView.contentSize.width, CGRectGetHeight(self.daysScrollView.frame))]; @@ -497,116 +501,122 @@ - (void) _refreshDataWithPageAtIndex:(NSInteger)index{ } - (void) _realignEventsAtIndex:(NSInteger)index{ - - UIScrollView *sv = self.pages[index]; - TKTimelineView *timeline = [self _timelineAtIndex:index]; - - - NSMutableArray *sameTimeEvents = [[NSMutableArray alloc] init]; - NSInteger offsetCount = 0; - NSInteger repeatNumber = 0; // number of nested appointments - CGFloat horizOffset = 0.0f; // number of pixels to offset horizontally when they are nested - CGFloat startMarker = -100.0f; // starting point to check if they match - CGFloat endMarker = -100.0f; - - - CGFloat topOrigin = -1; - - for (TKCalendarDayEventView *event in timeline.events) { - - - if(event.gestureRecognizers.count<1){ - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewWasTapped:)]; - [event addGestureRecognizer:tap]; - } - - - BOOL startSameDay = [event.startDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; - - if(!startSameDay && (([event.startDate compare:timeline.date] == NSOrderedAscending && [event.endDate compare:timeline.date] == NSOrderedAscending) || ([event.startDate compare:timeline.date] == NSOrderedDescending))) continue; - - BOOL endSameDay = [event.endDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; - NSDateComponents *startComp = [event.startDate dateComponentsWithTimeZone:self.calendar.timeZone]; - NSDateComponents *endComp = [event.endDate dateComponentsWithTimeZone:self.calendar.timeZone]; - - NSInteger hourStart = startSameDay ? startComp.hour : 0; - CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; - - NSInteger minuteStart = startSameDay ? round(startComp.minute / 5.0) * 5 : 0; - CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); - - NSInteger hourEnd = endSameDay ? endComp.hour : 23; - CGFloat hourEndPosition = hourEnd * VERTICAL_DIFF + VERTICAL_INSET; - - NSInteger minuteEnd = endSameDay ? round(endComp.minute / 5.0) * 5 : 60; - CGFloat minuteEndPosition = roundf((CGFloat)minuteEnd / 60.0f * VERTICAL_DIFF); - - CGFloat eventHeight = hourEndPosition + minuteEndPosition - hourStartPosition - minuteStartPosition; - eventHeight = MAX(roundf(VERTICAL_DIFF/2), eventHeight); - - - - - // nobre additions - split control and offset control - // split control - adjusts balloon widths so their times/titles don't overlap - // offset control - adjusts starting balloon position so you can see all starts/ends - if ((hourStartPosition + minuteStartPosition) - startMarker < 1) { - repeatNumber++; - } else { - repeatNumber = 0; - [sameTimeEvents removeAllObjects]; - //if this event starts before the last event's end, we have to offset it! - if (hourStartPosition + minuteStartPosition < endMarker) { - horizOffset = EVENT_SAME_HOUR * ++offsetCount; - } - else { - horizOffset = 0.0f; - offsetCount = 0; - } - } - - - - - - CGFloat eventWidth = (CGRectGetWidth(self.bounds) - LEFT_INSET - RIGHT_EVENT_INSET)/(repeatNumber+1); - CGFloat eventOriginX = LEFT_INSET + 2.0f + horizOffset; - CGRect eventFrame = CGRectMake(eventOriginX + (repeatNumber*eventWidth), hourStartPosition + minuteStartPosition, eventWidth, eventHeight); - event.frame = CGRectIntegral(eventFrame); - [event setNeedsLayout]; - [sv addSubview:event]; - - for (NSInteger i = [sameTimeEvents count]-1; i >= 0; i--) { - TKCalendarDayEventView *sameTimeEvent = sameTimeEvents[i]; - CGRect newFrame = sameTimeEvent.frame; - newFrame.size.width = eventWidth; - newFrame.origin.x = eventOriginX + (i*(eventWidth)); - sameTimeEvent.frame = CGRectIntegral(newFrame); - [sameTimeEvent setNeedsLayout]; - } - [sameTimeEvents addObject:event]; - - [event setNeedsLayout]; - - - startMarker = hourStartPosition + minuteStartPosition; - endMarker = MAX(endMarker,hourEndPosition + minuteEndPosition); - - if(topOrigin<0) - topOrigin = startMarker; - - topOrigin = MIN(topOrigin,startMarker); - - } - - if(topOrigin>0) - timeline.startY = topOrigin; - if(sv == self.nowLineView.superview) - [sv bringSubviewToFront:self.nowLineView]; - + + UIScrollView *sv = self.pages[index]; + TKTimelineView *timeline = [self _timelineAtIndex:index]; + + + NSMutableArray *sameTimeEvents = [[NSMutableArray alloc] init]; + NSInteger offsetCount = 0; + NSInteger repeatNumber = 0; // number of nested appointments + CGFloat horizOffset = 0.0f; // number of pixels to offset horizontally when they are nested + CGFloat startMarker = -100.0f; // starting point to check if they match + CGFloat endMarker = -100.0f; + + + CGFloat topOrigin = -1; + +#pragma 为了事件条宽度设个变量 + int event_i = 0; + for (TKCalendarDayEventView *event in timeline.events) { + + + if(event.gestureRecognizers.count<1){ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewWasTapped:)]; + [event addGestureRecognizer:tap]; + } + + + BOOL startSameDay = [event.startDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; + + if(!startSameDay && (([event.startDate compare:timeline.date] == NSOrderedAscending && [event.endDate compare:timeline.date] == NSOrderedAscending) || ([event.startDate compare:timeline.date] == NSOrderedDescending))) continue; + + BOOL endSameDay = [event.endDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; + NSDateComponents *startComp = [event.startDate dateComponentsWithTimeZone:self.calendar.timeZone]; + NSDateComponents *endComp = [event.endDate dateComponentsWithTimeZone:self.calendar.timeZone]; + + NSInteger hourStart = startSameDay ? startComp.hour : 0; + CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; + + NSInteger minuteStart = startSameDay ? round(startComp.minute / 5.0) * 5 : 0; + CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); + + NSInteger hourEnd = endSameDay ? endComp.hour : 23; + CGFloat hourEndPosition = hourEnd * VERTICAL_DIFF + VERTICAL_INSET; + + NSInteger minuteEnd = endSameDay ? round(endComp.minute / 5.0) * 5 : 60; + CGFloat minuteEndPosition = roundf((CGFloat)minuteEnd / 60.0f * VERTICAL_DIFF); + + CGFloat eventHeight = hourEndPosition + minuteEndPosition - hourStartPosition - minuteStartPosition; + eventHeight = MAX(roundf(VERTICAL_DIFF/2), eventHeight); + + + + + // nobre additions - split control and offset control + // split control - adjusts balloon widths so their times/titles don't overlap + // offset control - adjusts starting balloon position so you can see all starts/ends + if ((hourStartPosition + minuteStartPosition) - startMarker < 1) { + repeatNumber++; + } else { + repeatNumber = 0; + [sameTimeEvents removeAllObjects]; + //if this event starts before the last event's end, we have to offset it! + if (hourStartPosition + minuteStartPosition < endMarker) { + horizOffset = EVENT_SAME_HOUR * ++offsetCount; + } + else { + horizOffset = 0.0f; + offsetCount = 0; + } + } + + + +#pragma 事件条宽度 + CGFloat eventWidth = ([UIScreen mainScreen].bounds.size.width / 3 * 2 - 50) / timeline.events.count; + CGFloat eventOriginX = LEFT_INSET + eventWidth * event_i; + event_i++; + // CGFloat eventWidth = (CGRectGetWidth(self.bounds) - LEFT_INSET - RIGHT_EVENT_INSET)/(repeatNumber+1); + // CGFloat eventOriginX = LEFT_INSET + 2.0f + horizOffset; + // CGRect eventFrame = CGRectMake(eventOriginX + (repeatNumber*eventWidth), hourStartPosition + minuteStartPosition, eventWidth, eventHeight); + CGRect eventFrame = CGRectMake(eventOriginX, hourStartPosition + minuteStartPosition, eventWidth, eventHeight); + event.frame = CGRectIntegral(eventFrame); + [event setNeedsLayout]; + [sv addSubview:event]; + + // for (NSInteger i = [sameTimeEvents count]-1; i >= 0; i--) { + // TKCalendarDayEventView *sameTimeEvent = sameTimeEvents[i]; + // CGRect newFrame = sameTimeEvent.frame; + // newFrame.size.width = eventWidth; + // newFrame.origin.x = eventOriginX + (i*(eventWidth)); + // sameTimeEvent.frame = CGRectIntegral(newFrame); + // [sameTimeEvent setNeedsLayout]; + // } + // [sameTimeEvents addObject:event]; + // + // [event setNeedsLayout]; + + + startMarker = hourStartPosition + minuteStartPosition; + endMarker = MAX(endMarker,hourEndPosition + minuteEndPosition); + + if(topOrigin<0) + topOrigin = startMarker; + + topOrigin = MIN(topOrigin,startMarker); + + } + + if(topOrigin>0) + timeline.startY = topOrigin; + if(sv == self.nowLineView.superview) + [sv bringSubviewToFront:self.nowLineView]; + } + #pragma mark WeekDay - (void) _advanceWeekToIndex:(NSInteger)index animated:(BOOL)animated{ self.userInteractionEnabled = NO; @@ -1004,7 +1014,8 @@ - (UIScrollView*) horizontalScrollView{ } - (UIScrollView*) daysScrollView{ if(_daysScrollView) return _daysScrollView; - _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetMinY(self.monthYearLabel.frame))]; +// _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetMinY(self.monthYearLabel.frame))]; + _daysScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), 64)]; _daysScrollView.pagingEnabled = YES; _daysScrollView.delegate = self; _daysScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.daysScrollView.frame)*3.0, 0); @@ -1126,20 +1137,16 @@ - (NSArray *) times{ - +#define DAY_LABEL_WIDTH 35.0f @implementation TKWeekdaysView - (instancetype) initWithFrame:(CGRect)frame{ if(!(self=[super initWithFrame:frame])) return nil; - NSInteger per = CGFrameGetWidth(self) - (DAY_LABEL_WIDTH *7); - per /= 7; - NSInteger minX = per / 2; NSMutableArray *labels = [NSMutableArray arrayWithCapacity:7]; for(NSInteger i=0;i<7;i++){ - TKDateLabel *label = [[TKDateLabel alloc] initWithFrame:CGRectMake(minX+(DAY_LABEL_WIDTH+per)*i, 16, DAY_LABEL_WIDTH, DAY_LABEL_WIDTH)]; + TKDateLabel *label = [[TKDateLabel alloc] initWithFrame:CGRectMake(8+(DAY_LABEL_WIDTH+9)*i, 16, DAY_LABEL_WIDTH, DAY_LABEL_WIDTH)]; label.weekend = i % 6 == 0; - //label.backgroundColor = [UIColor redColor]; [self addSubviewToBack:label]; [labels addObject:label]; } @@ -1205,7 +1212,6 @@ - (void) setWeekend:(BOOL)weekend{ #pragma mark - TKNowView @implementation TKNowView - - (instancetype) init{ if(!(self=[super initWithFrame:CGRectMake(0, 0, 320, 14)])) return nil; @@ -1217,6 +1223,8 @@ - (instancetype) init{ self.timeLabel.font = [UIFont boldSystemFontOfSize:10]; [self addSubview:self.timeLabel]; + + UIView *nob = [[UIView alloc] initWithFrame:CGRectMake(LEFT_INSET + 1, 3, 6, 6)]; nob.backgroundColor = self.tintColor; nob.tag = 7; @@ -1238,6 +1246,7 @@ - (instancetype) init{ [self updateTime]; + return self; } diff --git a/TapkuLibrary/TKCalendarDayView.m.orig b/TapkuLibrary/TKCalendarDayView.m.orig new file mode 100644 index 00000000..b44d4234 --- /dev/null +++ b/TapkuLibrary/TKCalendarDayView.m.orig @@ -0,0 +1,1261 @@ +// +// TKCalendarDayView.m +// Created by Devin Ross on 7/28/09. +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKCalendarDayView.h" +#import "NSDate+TKCategory.h" +#import "UIImage+TKCategory.h" +#import "TKGlobal.h" +#import "TKGradientView.h" +#import "UIColor+TKCategory.h" +#import "UIImageView+TKCategory.h" +#import "UIView+TKCategory.h" +#import "UIScreen+TKCategory.h" + +#define NOB_SIZE 6.0f +#define TOP_BAR_HEIGHT 84.0 +#define EVENT_SAME_HOUR 3.0 +#define HORIZONTAL_PAD 5.0f +#define RIGHT_EVENT_INSET 10.0 +#define LEFT_INSET 53.0f +#define VERTICAL_INSET 10.0f +#define FONT_SIZE 11.0f +#define AM_SIZE 11.0f +#define DEFAULT_TEXT_COLOR [UIColor colorWithRed:59/255. green:73/255. blue:88/255. alpha:1] +#define VERTICAL_DIFF 45.0 +#define TIMELINE_HEIGHT VERTICAL_INSET * 2 + 24 * (VERTICAL_DIFF) +#define DAY_FONT_SIZE 18 +#define WEEKEND_TEXT_COLOR [UIColor colorWithWhite:167/255. alpha:1] + + +#pragma mark - TKNowView +@interface TKNowView : UIView +@property (nonatomic,strong) UILabel *timeLabel; +- (void) updateTime; +@end + +#pragma mark - TKDateLabel +@interface TKDateLabel : UILabel +@property (nonatomic,strong) NSDate *date; +@property (nonatomic,assign) BOOL today; +@property (nonatomic,assign) BOOL selected; +@property (nonatomic,assign) BOOL weekend; +@end + + +#pragma mark - TKTimelineView +@interface TKTimelineView : UIView +@property (nonatomic,strong) NSMutableArray *events; +@property (nonatomic,assign) CGFloat startY; +@property (nonatomic,strong) NSDate *date; +@property (nonatomic,strong) NSArray *times; +@property (nonatomic,strong) UIColor *hourColor; +@property (nonatomic,assign) BOOL is24hClock; +@property (nonatomic,assign) BOOL isToday; +@end + +@interface TKWeekdaysView : UIView +@property (nonatomic,strong) NSArray *weekdayLabels; +@end + + +#pragma mark - TKCalendarDayView +@interface TKCalendarDayView () + +@property (nonatomic,strong) NSDateFormatter *formatter; +@property (nonatomic,strong) NSMutableArray *pages; +@property (nonatomic,strong) UIScrollView *horizontalScrollView; + +@property (nonatomic,strong) NSMutableArray *weekdayPages; +@property (nonatomic,strong) UIScrollView *daysScrollView; + +@property (nonatomic,strong) NSDate *currentDay; +@property (nonatomic,strong) NSMutableArray *eventGraveYard; +@property (nonatomic,strong) UILabel *monthYearLabel; +@property (nonatomic,strong) TKNowView *nowLineView; +@property (nonatomic,assign) NSInteger indexOfCurrentDay; + +@end + + +@implementation TKCalendarDayView + +#pragma mark Init & Friends +- (instancetype) initWithFrame:(CGRect)frame calendar:(NSCalendar*)calendar{ + if(!(self=[super initWithFrame:frame])) return nil; + self.calendar = calendar; + [self _setupView]; + return self; +} +- (instancetype) initWithFrame:(CGRect)frame timeZone:(NSTimeZone*)timeZone{ + + NSCalendar *cal = [NSCalendar autoupdatingCurrentCalendar]; + cal.timeZone = timeZone; + + self = [self initWithFrame:frame calendar:cal]; + return self; +} +- (instancetype) initWithFrame:(CGRect)frame{ + self = [self initWithFrame:frame calendar:[NSCalendar autoupdatingCurrentCalendar]]; + return self; +} +- (instancetype) initWithCoder:(NSCoder *)decoder { + if(!(self=[self initWithCoder:decoder])) return nil; + self.calendar = [NSCalendar autoupdatingCurrentCalendar]; + [self _setupView]; + return self; +} +- (void) _setupView{ + + self.nowLineView = [[TKNowView alloc] init]; + + NSDateComponents *info = [[NSDate date] dateComponentsWithTimeZone:self.calendar.timeZone]; + info.hour = info.minute = info.second = 0; + + self.formatter = [[NSDateFormatter alloc] init]; + self.formatter.timeZone = self.calendar.timeZone; + + self.eventGraveYard = [NSMutableArray array]; + self.backgroundColor = [UIColor whiteColor]; + self.clipsToBounds = YES; + self.pages = [NSMutableArray arrayWithCapacity:3]; + self.weekdayPages = [NSMutableArray arrayWithCapacity:3]; + [self addSubview:self.horizontalScrollView]; + + + info.day -= 1; + + for(NSInteger i=0;i<3;i++){ + + NSDate *date = [NSDate dateWithDateComponents:info]; + + CGRect r = CGRectInset(self.horizontalScrollView.bounds, HORIZONTAL_PAD, 0); + r.origin.x = CGRectGetWidth(self.horizontalScrollView.frame) * i + HORIZONTAL_PAD; + r.origin.y = 0; + + CGRect rr = r; + rr.origin.x = 0; + + UIScrollView *sv = [[UIScrollView alloc] initWithFrame:r]; + sv.autoresizingMask = UIViewAutoresizingFlexibleWidth; + sv.clipsToBounds = NO; + sv.tag = i; + sv.contentSize = CGSizeMake(0, TIMELINE_HEIGHT); + sv.alwaysBounceVertical = TRUE; + sv.backgroundColor = [UIColor whiteColor]; + [self.horizontalScrollView addSubview:sv]; + + TKTimelineView *timelineView = [[TKTimelineView alloc] initWithFrame:sv.bounds]; + timelineView.autoresizingMask = UIViewAutoresizingFlexibleWidth; + [sv addSubview:timelineView]; + timelineView.date = date; + [self.pages addObject:sv]; + + info.day += 1; + } + + self.currentDay = [self _timelineAtIndex:1].date; + [self _updateDateLabel]; + [self addSubview:self.daysBackgroundView]; + [self addSubview:self.monthYearLabel]; + + + NSInteger cnt = 0; + NSArray *daySymbols = [[NSCalendar currentCalendar] shortWeekdaySymbols]; + CGFloat wid = CGRectGetWidth(self.frame); + CGFloat xmargin = 20; + wid -= 8; + + for(NSString *str in daySymbols){ + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(xmargin + cnt* wid/daySymbols.count, 0, 40, 20)]; + label.font = [UIFont systemFontOfSize:10]; + label.text = [str substringToIndex:1]; + label.textColor = cnt == 0 || cnt == 6 ? WEEKEND_TEXT_COLOR : [UIColor blackColor]; + label.textAlignment = NSTextAlignmentCenter; + [label sizeToFit]; + label.userInteractionEnabled = NO; + [self.daysBackgroundView addSubview:label]; + cnt++; + } + + + + [self.daysBackgroundView addSubviewToBack:self.daysScrollView]; + + UIView *dayContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.daysScrollView.contentSize.width, CGRectGetHeight(self.daysScrollView.frame))]; + [self.daysScrollView addSubview:dayContainerView]; + + CGRect weekFrame = self.daysScrollView.frame; + weekFrame.origin = CGPointZero; + for(NSInteger i=0;i<3;i++){ + + weekFrame.origin.x = CGRectGetWidth(weekFrame) * i; + TKWeekdaysView *weekdayView = [[TKWeekdaysView alloc] initWithFrame:weekFrame]; + + for(UILabel *label in weekdayView.weekdayLabels){ + label.userInteractionEnabled = YES; + [label addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapWeekdayLabel:)]]; + } + [dayContainerView addSubviewToBack:weekdayView]; + [self.weekdayPages addObject:weekdayView]; + } + +} + + +#pragma mark Button Actions +- (void) nextDay:(id)sender { + [self _movePagesToIndex:2 animated:NO]; +} +- (void) previousDay:(id)sender { + [self _movePagesToIndex:0 animated:NO]; +} +- (void) scrollViewWasTapped:(UITapGestureRecognizer*)gesture{ + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:eventViewWasSelected:)]) + [self.delegate calendarDayTimelineView:self eventViewWasSelected:(TKCalendarDayEventView*)gesture.view]; +} + + +#pragma mark UIView Subclasses +- (void) didMoveToWindow{ + if (self.window && ![self _timelineAtIndex:1].events) + [self _reloadData]; +} +- (void) layoutSubviews{ + + [CATransaction begin]; + [CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions]; + [self _realignPages]; + [CATransaction commit]; + +} + + +#pragma mark Private Methods +- (void) _realignPages{ + + CGFloat w = CGRectGetWidth([self.pages[1] frame]); + CGFloat scrollWidth = CGRectGetWidth(self.horizontalScrollView.frame); + + self.horizontalScrollView.frame = CGRectInset(CGRectMake(0, TOP_BAR_HEIGHT, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame) - TOP_BAR_HEIGHT), -HORIZONTAL_PAD, 0); + self.horizontalScrollView.contentSize = CGSizeMake(scrollWidth*3.0, 0); + self.horizontalScrollView.contentOffset = CGPointMake(scrollWidth, 0); + + NSInteger i = 0; + for(UIScrollView *sv in self.pages){ + CGRect r = CGRectInset(self.horizontalScrollView.bounds, HORIZONTAL_PAD, 0); + r.origin = CGPointMake(scrollWidth * i + HORIZONTAL_PAD,0); + if(CGRectGetWidth(r) != w){ + sv.frame = r; + [self _realignEventsAtIndex:i]; + }else + sv.frame = r; + sv.bounds = CGRectMakeWithSize(0, 0, r.size); + i++; + } + [self _scrollToTopEvent:NO]; + +} +- (void) _movePagesToIndex:(NSInteger)nowPage animated:(BOOL)animated{ + + UIScrollView *needsUpdating = nil; + NSInteger updateIndex = 1; + if(nowPage<1){ + UIScrollView *sv = [self.pages lastObject]; + [self.pages insertObject:sv atIndex:0]; + [self.pages removeLastObject]; + needsUpdating = sv; + updateIndex = 0; + }else if(nowPage>1){ + UIScrollView *sv = self.pages[0]; + [self.pages addObject:sv]; + [self.pages removeObjectAtIndex:0]; + needsUpdating = sv; + updateIndex = 2; + } + + self.currentDay = [self _timelineAtIndex:1].date; + + NSDateComponents *info = [self.currentDay dateComponentsWithTimeZone:self.calendar.timeZone]; + info.day += nowPage < 1 ? -1 : 1; + [self _timelineWithScrollView:needsUpdating].date = [NSDate dateWithDateComponents:info]; + [self _updateDateLabel]; + + + NSInteger i = 0; + for(UIScrollView *sv in self.pages){ + CGRect r = sv.frame; + r.origin.x = HORIZONTAL_PAD + CGRectGetWidth(self.horizontalScrollView.frame) * i; + sv.frame = r; + i++; + } + + self.horizontalScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.horizontalScrollView.frame), 0); + needsUpdating.contentOffset = CGPointZero; + [self _refreshDataWithPageAtIndex:updateIndex]; + + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:didMoveToDate:)]) + [self.delegate calendarDayTimelineView:self didMoveToDate:self.currentDay]; + + self.indexOfCurrentDay = nowPage > 1 ? self.indexOfCurrentDay+1 : self.indexOfCurrentDay-1; + + + if(self.indexOfCurrentDay < 0 || self.indexOfCurrentDay > 6){ + self.userInteractionEnabled = NO; + + NSInteger day = self.indexOfCurrentDay < 0 ? 6 : 0; + + + [UIView animateWithDuration:0.3 animations:^{ + self.daysScrollView.contentOffset = self.indexOfCurrentDay > 6 ? CGPointMake(CGRectGetWidth(self.daysScrollView.frame)*2, 0) : CGPointZero; + }completion:^(BOOL finished){ + [self _resetWeekdayOrderByMoving:self.indexOfCurrentDay > 0]; + self.userInteractionEnabled = YES; + self.indexOfCurrentDay = day; + }]; + + } + + + + [UIView transitionWithView:self.daysScrollView.subviews.firstObject duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + [self _updateSelectedWeekdayAtIndex:self.indexOfCurrentDay+7]; + }completion:nil]; + + + + + [self _scrollToTopEvent:animated]; + +} +- (void) _scrollToTopEvent:(BOOL)animated{ + UIScrollView *sv = self.pages[1]; + TKTimelineView *timeline = [self _timelineAtIndex:1]; + + CGFloat y = -VERTICAL_INSET + timeline.startY; + if(sv == self.nowLineView.superview) + y = CGRectGetMinY(self.nowLineView.frame) - 20; + y = MIN(sv.contentSize.height - CGRectGetHeight(sv.bounds), y); + y = MAX(0,y); + + [sv setContentOffset:CGPointMake(0, y) animated:animated]; +} + + + +- (TKTimelineView*) _timelineWithScrollView:(UIScrollView*)sv{ + return (TKTimelineView*)[sv viewWithTag:5]; +} +- (TKTimelineView*) _timelineAtIndex:(NSInteger)index{ + return (TKTimelineView*)[self.pages[index] viewWithTag:5]; +} +- (NSInteger) _currentScrolledPage{ + CGFloat w = CGRectGetWidth(self.horizontalScrollView.frame); + CGFloat x = self.horizontalScrollView.contentOffset.x + (w/2.0f); + return x / w; +} +- (NSInteger) _currentScrolledWeek{ + CGFloat w = CGRectGetWidth(self.daysScrollView.frame); + CGFloat x = self.daysScrollView.contentOffset.x + (w/2.0f); + return x / w; +} +- (void) _updateDateLabel{ + self.formatter.dateFormat = @"EEEE MMMM d, yyyy"; + self.formatter.timeZone = self.calendar.timeZone; + self.monthYearLabel.text = [self.formatter stringFromDate:self.currentDay]; +} + + + +#pragma mark UIScrollViewDelegate +- (void) _checkForPageChange{ + NSInteger page = [self _currentScrolledPage]; + if(page!=1) [self _movePagesToIndex:page animated:YES]; +} +- (void) _checkForAdvancingWeek{ + NSInteger page = [self _currentScrolledWeek]; + if(page!=1) [self _advanceWeekToIndex:page animated:YES]; +} +- (void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ + if(decelerate) return; + + if(scrollView == self.horizontalScrollView){ + [self _checkForPageChange]; + }else if(scrollView == self.daysScrollView){ + [self _checkForAdvancingWeek]; + } +} +- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ + if(scrollView == self.horizontalScrollView){ + [self _checkForPageChange]; + }else if(scrollView == self.daysScrollView){ + [self _checkForAdvancingWeek]; + } +} +- (void) scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView{ + if(scrollView == self.horizontalScrollView){ + [self _checkForPageChange]; + }else if(scrollView == self.daysScrollView){ + [self _checkForAdvancingWeek]; + } +} + + +#pragma mark Reload Day +- (void) reloadData{ + [self _reloadData]; +} +- (void) _reloadData{ + [self _updateDateLabel]; + [self _refreshDataWithPageAtIndex:0]; + [self _refreshDataWithPageAtIndex:1]; + [self _refreshDataWithPageAtIndex:2]; + [self _setupDaysView]; + [self _scrollToTopEvent:NO]; + [self.nowLineView updateTime]; + +} +- (void) _refreshDataWithPageAtIndex:(NSInteger)index{ + + UIScrollView *sv = self.pages[index]; + TKTimelineView *timeline = [self _timelineAtIndex:index]; + + + CGRect r = CGRectInset(self.horizontalScrollView.bounds, HORIZONTAL_PAD, 0); + r.origin.x = CGRectGetWidth(self.horizontalScrollView.frame) * index + HORIZONTAL_PAD; + sv.frame = r; + + + + timeline.startY = VERTICAL_INSET; + + for (UIView* view in sv.subviews) { + if ([view isKindOfClass:[TKCalendarDayEventView class]]){ + [self.eventGraveYard addObject:view]; + [view removeFromSuperview]; + } + } + + timeline.isToday = NO; + + if(self.nowLineView.superview == sv) [self.nowLineView removeFromSuperview]; + if([timeline.date isTodayWithTimeZone:self.calendar.timeZone]){ + + NSDate *date = [NSDate date]; + NSDateComponents *comp = [date dateComponentsWithTimeZone:self.calendar.timeZone]; + + NSInteger hourStart = comp.hour; + CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; + + NSInteger minuteStart = round(comp.minute / 5.0) * 5; + CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); + + + CGRect eventFrame = CGRectMake(CGRectGetMinX(self.nowLineView.frame), hourStartPosition + minuteStartPosition - 5, CGRectGetWidth(self.frame), 14); + self.nowLineView.frame = eventFrame; + [sv addSubview:self.nowLineView]; + timeline.isToday = YES; + + } + + [timeline setNeedsDisplay]; + + if(!self.dataSource) return; + timeline.events = [NSMutableArray arrayWithArray:[self.dataSource calendarDayTimelineView:self eventsForDate:timeline.date]]; + + + [timeline.events sortUsingComparator:^NSComparisonResult(TKCalendarDayEventView *obj1, TKCalendarDayEventView *obj2){ + return [obj1.startDate compare:obj2.startDate]; + }]; + + [self _realignEventsAtIndex:index]; + if(self.nowLineView.superview == sv) + [sv bringSubviewToFront:self.nowLineView]; + + +} +- (void) _realignEventsAtIndex:(NSInteger)index{ + + UIScrollView *sv = self.pages[index]; + TKTimelineView *timeline = [self _timelineAtIndex:index]; + + + NSMutableArray *sameTimeEvents = [[NSMutableArray alloc] init]; + NSInteger offsetCount = 0; + NSInteger repeatNumber = 0; // number of nested appointments + CGFloat horizOffset = 0.0f; // number of pixels to offset horizontally when they are nested + CGFloat startMarker = -100.0f; // starting point to check if they match + CGFloat endMarker = -100.0f; + + + CGFloat topOrigin = -1; + + for (TKCalendarDayEventView *event in timeline.events) { + + + if(event.gestureRecognizers.count<1){ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewWasTapped:)]; + [event addGestureRecognizer:tap]; + } + + + BOOL startSameDay = [event.startDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; + + if(!startSameDay && (([event.startDate compare:timeline.date] == NSOrderedAscending && [event.endDate compare:timeline.date] == NSOrderedAscending) || ([event.startDate compare:timeline.date] == NSOrderedDescending))) continue; + + BOOL endSameDay = [event.endDate isSameDay:timeline.date timeZone:self.calendar.timeZone]; + NSDateComponents *startComp = [event.startDate dateComponentsWithTimeZone:self.calendar.timeZone]; + NSDateComponents *endComp = [event.endDate dateComponentsWithTimeZone:self.calendar.timeZone]; + + NSInteger hourStart = startSameDay ? startComp.hour : 0; + CGFloat hourStartPosition = hourStart * VERTICAL_DIFF + VERTICAL_INSET; + + NSInteger minuteStart = startSameDay ? round(startComp.minute / 5.0) * 5 : 0; + CGFloat minuteStartPosition = roundf((CGFloat)minuteStart / 60.0f * VERTICAL_DIFF); + + NSInteger hourEnd = endSameDay ? endComp.hour : 23; + CGFloat hourEndPosition = hourEnd * VERTICAL_DIFF + VERTICAL_INSET; + + NSInteger minuteEnd = endSameDay ? round(endComp.minute / 5.0) * 5 : 60; + CGFloat minuteEndPosition = roundf((CGFloat)minuteEnd / 60.0f * VERTICAL_DIFF); + + CGFloat eventHeight = hourEndPosition + minuteEndPosition - hourStartPosition - minuteStartPosition; + eventHeight = MAX(roundf(VERTICAL_DIFF/2), eventHeight); + + + + + // nobre additions - split control and offset control + // split control - adjusts balloon widths so their times/titles don't overlap + // offset control - adjusts starting balloon position so you can see all starts/ends + if ((hourStartPosition + minuteStartPosition) - startMarker < 1) { + repeatNumber++; + } else { + repeatNumber = 0; + [sameTimeEvents removeAllObjects]; + //if this event starts before the last event's end, we have to offset it! + if (hourStartPosition + minuteStartPosition < endMarker) { + horizOffset = EVENT_SAME_HOUR * ++offsetCount; + } + else { + horizOffset = 0.0f; + offsetCount = 0; + } + } + + + + + + CGFloat eventWidth = (CGRectGetWidth(self.bounds) - LEFT_INSET - RIGHT_EVENT_INSET)/(repeatNumber+1); + CGFloat eventOriginX = LEFT_INSET + 2.0f + horizOffset; + CGRect eventFrame = CGRectMake(eventOriginX + (repeatNumber*eventWidth), hourStartPosition + minuteStartPosition, eventWidth, eventHeight); + event.frame = CGRectIntegral(eventFrame); + [event setNeedsLayout]; + [sv addSubview:event]; + + for (NSInteger i = [sameTimeEvents count]-1; i >= 0; i--) { + TKCalendarDayEventView *sameTimeEvent = sameTimeEvents[i]; + CGRect newFrame = sameTimeEvent.frame; + newFrame.size.width = eventWidth; + newFrame.origin.x = eventOriginX + (i*(eventWidth)); + sameTimeEvent.frame = CGRectIntegral(newFrame); + [sameTimeEvent setNeedsLayout]; + } + [sameTimeEvents addObject:event]; + + [event setNeedsLayout]; + + + startMarker = hourStartPosition + minuteStartPosition; + endMarker = MAX(endMarker,hourEndPosition + minuteEndPosition); + + if(topOrigin<0) + topOrigin = startMarker; + + topOrigin = MIN(topOrigin,startMarker); + + } + + if(topOrigin>0) + timeline.startY = topOrigin; + if(sv == self.nowLineView.superview) + [sv bringSubviewToFront:self.nowLineView]; + +} + + +#pragma mark WeekDay +- (void) _advanceWeekToIndex:(NSInteger)index animated:(BOOL)animated{ + self.userInteractionEnabled = NO; + + BOOL moveRight = index > 1 ? YES : NO; + NSInteger pageToUpdate = moveRight ? 2 : 0; + + TKWeekdaysView *weekView = self.weekdayPages[pageToUpdate]; + TKDateLabel *currentLabel = weekView.weekdayLabels[self.indexOfCurrentDay]; + NSDate *theNewDate = currentLabel.date; + [self _resetWeekdayOrderByMoving:moveRight]; + [self _timelineAtIndex:pageToUpdate].date = theNewDate; + [self _refreshDataWithPageAtIndex:pageToUpdate]; + + + [UIView animateWithDuration:animated ? 0.3 : 0 animations:^{ + + self.horizontalScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.horizontalScrollView.frame) * pageToUpdate, 0); + + }completion:^(BOOL finished){ + + + UIScrollView *needsUpdating = nil; + NSInteger updateIndex = 1; + + if(pageToUpdate<1){ + UIScrollView *sv = [self.pages lastObject]; + [self.pages insertObject:sv atIndex:0]; + [self.pages removeLastObject]; + needsUpdating = sv; + updateIndex = 0; + }else if(pageToUpdate>1){ + UIScrollView *sv = self.pages[0]; + [self.pages addObject:sv]; + [self.pages removeObjectAtIndex:0]; + needsUpdating = sv; + updateIndex = 2; + } + + self.currentDay = theNewDate; + [self _updateDateLabel]; + + NSDateComponents *info = [self.currentDay dateComponentsWithTimeZone:self.calendar.timeZone]; + info.day += pageToUpdate < 1 ? -1 : 1; + [self _timelineWithScrollView:needsUpdating].date = [NSDate dateWithDateComponents:info]; + + + NSInteger i = 0; + for(UIScrollView *sv in self.pages){ + CGRect r = sv.frame; + r.origin.x = HORIZONTAL_PAD + CGRectGetWidth(self.horizontalScrollView.frame) * i; + sv.frame = r; + i++; + } + self.horizontalScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.horizontalScrollView.frame), 0); + + NSArray *allLabels = [self _allDayLabels]; + [self _timelineAtIndex:0].date = [allLabels[self.indexOfCurrentDay+7-1] date]; + [self _timelineAtIndex:2].date = [allLabels[self.indexOfCurrentDay+7+1] date]; + ((UIScrollView*)self.pages[0]).contentOffset = CGPointZero; + ((UIScrollView*)self.pages[2]).contentOffset = CGPointZero; + [self _refreshDataWithPageAtIndex:0]; + [self _refreshDataWithPageAtIndex:2]; + + needsUpdating.contentOffset = CGPointZero; + [self _refreshDataWithPageAtIndex:updateIndex]; + + + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:didMoveToDate:)]) + [self.delegate calendarDayTimelineView:self didMoveToDate:self.currentDay]; + + [self _scrollToTopEvent:YES]; + + + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:didMoveToDate:)]) + [self.delegate calendarDayTimelineView:self didMoveToDate:self.currentDay]; + + + [UIView transitionWithView:self.daysScrollView.subviews.firstObject duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + [self _updateSelectedWeekdayAtIndex:self.indexOfCurrentDay+7]; + }completion:nil]; + + [self _scrollToTopEvent:animated]; + self.userInteractionEnabled = YES; + + + }]; + + + +} +- (void) _resetWeekdayOrderByMoving:(BOOL)forwards{ + + if(forwards){ + TKWeekdaysView *weekView = [self.weekdayPages firstObject]; + [self.weekdayPages addObject:weekView]; + [self.weekdayPages removeObjectAtIndex:0]; + + + + TKWeekdaysView *currentWeekView = self.weekdayPages[1]; + TKDateLabel *currentPageLabel = currentWeekView.weekdayLabels.lastObject; + + NSDateComponents *mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:currentPageLabel.date]; + mutedCom.day++; + for(TKDateLabel *label in weekView.weekdayLabels){ + + NSDate *aDate = [self.calendar dateFromComponents:mutedCom]; + mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:aDate]; + label.text = [NSString stringWithFormat:@"%@",@(mutedCom.day)]; + label.date = aDate; + label.today = [aDate isTodayWithTimeZone:self.calendar.timeZone]; + label.selected = [aDate isSameDay:self.currentDay timeZone:self.calendar.timeZone]; + mutedCom.day++; + + } + + }else{ + TKWeekdaysView *weekView = [self.weekdayPages lastObject]; + [self.weekdayPages insertObject:weekView atIndex:0]; + [self.weekdayPages removeLastObject]; + + + + + TKWeekdaysView *currentWeekView = self.weekdayPages[1]; + TKDateLabel *currentPageLabel = currentWeekView.weekdayLabels.firstObject; + + NSDateComponents *mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:currentPageLabel.date]; + mutedCom.day --; + for(TKDateLabel *label in weekView.weekdayLabels.reverseObjectEnumerator){ + + NSDate *aDate = [self.calendar dateFromComponents:mutedCom]; + mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:aDate]; + label.text = [NSString stringWithFormat:@"%@",@(mutedCom.day)]; + label.date = aDate; + label.today = [aDate isTodayWithTimeZone:self.calendar.timeZone]; + label.selected = [aDate isSameDay:self.currentDay timeZone:self.calendar.timeZone]; + mutedCom.day --; + + } + + + } + + + NSInteger i = 0; + for(TKWeekdaysView *sv in self.weekdayPages){ + CGRect r = sv.frame; + r.origin.x = CGRectGetWidth(self.daysScrollView.frame) * i; + sv.frame = r; + i++; + } + self.daysScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.daysScrollView.frame), 0); + +} +- (void) _updateSelectedWeekdayAtIndex:(NSInteger)allLabelsIndex{ + + NSArray *allLabel = [self _allDayLabels]; + + NSInteger index = allLabelsIndex; + NSInteger i=0; + for(TKDateLabel *label in allLabel){ + label.selected = i == index; + i++; + } + + +} +- (void) didTapWeekdayLabel:(UITapGestureRecognizer*)sender{ + + NSArray *allLabels = [self _allDayLabels]; + NSInteger indexOfSelectedLabel = [allLabels indexOfObject:sender.view]; + + if(indexOfSelectedLabel == NSNotFound) return; + + TKDateLabel *label = allLabels[indexOfSelectedLabel]; + NSDate *theNewDate = label.date; + + if([label.date isSameDay:self.currentDay timeZone:self.calendar.timeZone]) return; + + BOOL moveRight = [label.date compare:self.currentDay] == NSOrderedDescending; + NSInteger pageToUpdate = moveRight ? 2 : 0; + + self.userInteractionEnabled = NO; + + [self _timelineAtIndex:pageToUpdate].date = label.date; + [self _refreshDataWithPageAtIndex:pageToUpdate]; + + + [UIView transitionWithView:self.daysScrollView.subviews.firstObject duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + [self _updateSelectedWeekdayAtIndex:indexOfSelectedLabel]; + }completion:nil]; + + [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ + self.horizontalScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.horizontalScrollView.frame) * pageToUpdate, 0); + }completion:^(BOOL finished){ + + + UIScrollView *needsUpdating = nil; + NSInteger updateIndex = 1; + + if(pageToUpdate<1){ + UIScrollView *sv = [self.pages lastObject]; + [self.pages insertObject:sv atIndex:0]; + [self.pages removeLastObject]; + needsUpdating = sv; + updateIndex = 0; + }else if(pageToUpdate>1){ + UIScrollView *sv = self.pages[0]; + [self.pages addObject:sv]; + [self.pages removeObjectAtIndex:0]; + needsUpdating = sv; + updateIndex = 2; + } + + self.currentDay = theNewDate; + [self _updateDateLabel]; + + NSDateComponents *info = [self.currentDay dateComponentsWithTimeZone:self.calendar.timeZone]; + info.day += pageToUpdate < 1 ? -1 : 1; + [self _timelineWithScrollView:needsUpdating].date = [NSDate dateWithDateComponents:info]; + + + NSInteger i = 0; + for(UIScrollView *sv in self.pages){ + CGRect r = sv.frame; + r.origin.x = HORIZONTAL_PAD + CGRectGetWidth(self.horizontalScrollView.frame) * i; + sv.frame = r; + i++; + } + self.horizontalScrollView.contentOffset = CGPointMake(CGRectGetWidth(self.horizontalScrollView.frame), 0); + + + [self _timelineAtIndex:0].date = [allLabels[indexOfSelectedLabel-1] date]; + [self _timelineAtIndex:2].date = [allLabels[indexOfSelectedLabel+1] date]; + ((UIScrollView*)self.pages[0]).contentOffset = CGPointZero; + ((UIScrollView*)self.pages[2]).contentOffset = CGPointZero; + [self _refreshDataWithPageAtIndex:0]; + [self _refreshDataWithPageAtIndex:2]; + + needsUpdating.contentOffset = CGPointZero; + [self _refreshDataWithPageAtIndex:updateIndex]; + + + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:didMoveToDate:)]) + [self.delegate calendarDayTimelineView:self didMoveToDate:self.currentDay]; + + [self _scrollToTopEvent:YES]; + + self.userInteractionEnabled = YES; + self.indexOfCurrentDay = indexOfSelectedLabel - 7; + + if(self.delegate && [self.delegate respondsToSelector:@selector(calendarDayTimelineView:didMoveToDate:)]) + [self.delegate calendarDayTimelineView:self didMoveToDate:self.currentDay]; + }]; + + + + + +} +- (void) _setupDaysView{ + + NSArray *labels = [self _allDayLabels]; + NSDateComponents *comp = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra | NSCalendarUnitWeekday fromDate:self.currentDay]; + NSDateComponents *mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:self.currentDay]; + for(NSInteger cnt= comp.weekday + 6;cnt>=0;cnt--){ + NSDate *aDate = [self.calendar dateFromComponents:mutedCom]; + mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:aDate]; + TKDateLabel *label = labels[cnt]; + label.text = [NSString stringWithFormat:@"%@",@(mutedCom.day)]; + label.date = aDate; + label.today = [aDate isTodayWithTimeZone:self.calendar.timeZone]; + label.selected = [aDate isSameDay:self.currentDay timeZone:self.calendar.timeZone]; + mutedCom.day --; + } + + mutedCom = [self.calendar components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitEra fromDate:self.currentDay]; + + for(NSInteger cnt= comp.weekday + 6;cnt",NSStringFromClass([self class]),self.date]; +} + +- (void) setIs24hClock:(BOOL)is24hClock{ + _is24hClock = is24hClock; + [self setNeedsDisplay]; +} + +#pragma mark Drawing +- (void) drawRect:(CGRect)rect { + // Drawing code + // Here Draw timeline from 12 am to noon to 12 am next day + // Times appearance + UIFont *timeFont = [UIFont systemFontOfSize:FONT_SIZE]; + UIColor *timeColor = [UIColor blackColor]; + UIColor *lineColor = [UIColor colorWithHex:0xd7d7d7]; + + NSInteger discount = - 100; + + if(self.isToday){ + + NSDate *now = [NSDate date]; + NSDateFormatter *form = [[NSDateFormatter alloc] init]; + form.dateFormat = @"H"; + NSInteger hour = [[form stringFromDate:now] integerValue]; + form.dateFormat = @"m"; + + NSInteger minute = [[form stringFromDate:now] integerValue]; + + if(minute > 39) + discount = hour+1; + else if(minute < 21) + discount = hour; + + } + + // Draw each times string + for (NSInteger i=0; i 0 && index < mc ? [self.marks[index] boolValue] : NO; - [self drawTileInRect:r day:i mark:mark font:font font2:font2 textColor:grayGradientColor context:context]; + [self drawTileInRect:r day:i mark:mark font:font font2:font2 context:context]; index++; } @@ -370,16 +371,12 @@ - (void) drawRect:(CGRect)rect { } BOOL mark = mc > 0 && index < mc ? [self.marks[index] boolValue] : NO; + [self drawTileInRect:r day:i mark:mark font:font font2:font2 context:context]; - BOOL isToday = today == i; - - - [self drawTileInRect:r day:i mark:mark font:font font2:font2 textColor:isToday ? [UIColor whiteColor] : gradientColor context:context]; if(today == i){ CGContextSetShadowWithColor(context, CGSizeMake(0,1), 0, whiteColor); [color set]; } - index++; } @@ -392,7 +389,7 @@ - (void) drawRect:(CGRect)rect { while(index % 7 != 0){ r = [self rectForCellAtIndex:index]; BOOL mark = mc > 0 && index < mc ? [self.marks[index] boolValue] : NO; - [self drawTileInRect:r day:i mark:mark font:font font2:font2 textColor:grayGradientColor context:context]; + [self drawTileInRect:r day:i mark:mark font:font font2:font2 context:context]; i++; index++; } @@ -446,7 +443,7 @@ - (BOOL) selectDay:(NSInteger)day{ row--; } - self.selectedImageView.frame = CGRectMakeWithSize((column*TILE_WIDTH)-1, (row*44)-1, self.selectedImageView.frame.size); + self.selectedImageView.frame = CGRectMakeWithSize((column*46)-1, (row*44)-1, self.selectedImageView.frame.size); [self addSubview:self.selectedImageView]; @@ -485,7 +482,7 @@ - (void) reactToTouch:(UITouch*)touch down:(BOOL)down{ if(p.x > CGRectGetWidth(self.bounds) || p.x < 0) return; if(p.y > CGRectGetHeight(self.bounds) || p.y < 0) return; - NSInteger column = p.x / TILE_WIDTH, row = p.y / 44; + NSInteger column = p.x / 46, row = p.y / 44; NSInteger day = 1, portion = 0; if(row == (int) (CGRectGetHeight(self.bounds) / 44)) row --; @@ -548,7 +545,7 @@ - (void) reactToTouch:(UITouch*)touch down:(BOOL)down{ - self.selectedImageView.frame = CGRectMakeWithSize((column*TILE_WIDTH)-1, (row*44)-1, self.selectedImageView.frame.size); + self.selectedImageView.frame = CGRectMakeWithSize((column*46)-1, (row*44)-1, self.selectedImageView.frame.size); if(day == selectedDay && selectedPortion == portion) return; @@ -616,7 +613,7 @@ - (UIImageView *) selectedImageView{ UIImage *img = [[UIImage imageWithContentsOfFile:path] stretchableImageWithLeftCapWidth:1 topCapHeight:0]; _selectedImageView = [[UIImageView alloc] initWithImage:img]; _selectedImageView.layer.magnificationFilter = kCAFilterNearest; - _selectedImageView.frame = CGRectMake(0, 0, TILE_WIDTH+1, 45); + _selectedImageView.frame = CGRectMake(0, 0, 47, 45); return _selectedImageView; } @@ -702,7 +699,7 @@ - (instancetype) initWithSundayAsFirst:(BOOL)s timeZone:(NSTimeZone*)timeZone{ NSInteger i = 0; for(NSString *s in ar){ - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(TILE_WIDTH*i + (i==0?0:-1), 30, 45, 15)]; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(46*i + (i==0?0:-1), 30, 45, 15)]; [self addSubview:label]; // Added Accessibility Labels @@ -803,6 +800,7 @@ - (void) changeMonth:(UIButton *)sender{ [self.delegate calendarMonthView:self monthDidChange:self.currentTile.monthDate animated:YES]; } + - (void) animateToNextOrPreviousMonth:(BOOL)next{ [self changeMonth:next ? self.rightArrow : self.leftArrow]; } @@ -1009,6 +1007,7 @@ - (UIView *) dropshadow{ _dropshadow.userInteractionEnabled = NO; return _dropshadow; } + - (NSDate*) dateSelected{ if(self.currentTile==nil) return nil; return [self.currentTile dateSelected]; diff --git a/TapkuLibrary/TKCalendarMonthViewController.h b/TapkuLibrary/TKCalendarMonthViewController.h index f4ff2351..2241f1a9 100644 --- a/TapkuLibrary/TKCalendarMonthViewController.h +++ b/TapkuLibrary/TKCalendarMonthViewController.h @@ -1,5 +1,5 @@ // -// TKCalendarMonthViewController.h +// DaterViewController.h // Created by Devin Ross on 7/28/09. // /* diff --git a/TapkuLibrary/TKCalendarMonthViewController.m b/TapkuLibrary/TKCalendarMonthViewController.m index a8270afa..94e06bf6 100644 --- a/TapkuLibrary/TKCalendarMonthViewController.m +++ b/TapkuLibrary/TKCalendarMonthViewController.m @@ -1,5 +1,5 @@ // -// TKCalendarMonthViewController.m +// DaterViewController.m // Created by Devin Ross on 7/28/09. // /* diff --git a/TapkuLibrary/TKCardModalViewController.h b/TapkuLibrary/TKCardModalViewController.h new file mode 100644 index 00000000..a8ba622f --- /dev/null +++ b/TapkuLibrary/TKCardModalViewController.h @@ -0,0 +1,56 @@ +// +// TKCardModalViewController.h +// Created by Devin Ross on 10/13/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface TKCardModalViewController : UIViewController + + +@property (nonatomic,strong) UIView *contentView; +@property (nonatomic,strong) UIView *backgroundView; +@property (nonatomic,assign) BOOL throwToDismissEnabled; +@property (nonatomic,assign) BOOL tapToDismissEnabled; +@property (nonatomic,assign) BOOL onlyAllowTapOffCardToDismiss; + +@property (nonatomic,assign) CGRect visibleFrame; + +- (void) keyboardWillShow:(NSNotification*)notification; +- (void) keyboardWillHide:(NSNotification*)notification; + + +- (void) show; +- (void) hide; + +- (void) showAlertView:(id)transitionContext; +- (void) hideAlertView:(id)transitionContext; +- (void) tapped:(UITapGestureRecognizer*)sender; + +@end diff --git a/TapkuLibrary/TKCardModalViewController.m b/TapkuLibrary/TKCardModalViewController.m new file mode 100644 index 00000000..54818f33 --- /dev/null +++ b/TapkuLibrary/TKCardModalViewController.m @@ -0,0 +1,439 @@ +// +// TKCardModalViewController.m +// Created by Devin Ross on 10/13/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +#import "TKCardModalViewController.h" +#import "UIDevice+TKCategory.h" +#import "TKGlobal.h" +#import "UIGestureRecognizer+TKCategory.h" + +@interface TKCardModalViewController () + +@property (nonatomic,strong) UIDynamicAnimator *animator; +@property (nonatomic) UIAttachmentBehavior* attachmentBehavior; +@property (nonatomic,strong) UIPushBehavior *pushBehavior; +@property (nonatomic, strong) UIDynamicItemBehavior *itemBehavior; + +@property (nonatomic,assign) CGFloat angle; +@property (nonatomic,assign) CGFloat magnitude; +@property (nonatomic,assign) CGPoint cardRestingPosition; + +@property (nonatomic,strong) UITapGestureRecognizer *tapGesture; +@property (nonatomic,strong) UIPanGestureRecognizer *panGesture; + +@end + +static const CGFloat _resistance = 0.0f; // linear resistance applied to the image’s dynamic item behavior +static const CGFloat _density = 1.0f; // relative mass density applied to the image's dynamic item behavior +static const CGFloat _velocityFactor = 1.0f; // affects how quickly the view is pushed out of the view +static const CGFloat _angularVelocityFactor = 1.0f; // adjusts the amount of spin applied to the view during a push force, increases towards the view bounds +static const CGFloat _minimumVelocityRequiredForPush = 50.0f; // defines how much velocity is required for the push behavior to be applied + +@implementation TKCardModalViewController + +- (instancetype) init{ + if(!(self=[super init])) return nil; + self.modalPresentationStyle = UIModalPresentationCustom; + self.transitioningDelegate = self; + self.tapToDismissEnabled = YES; + self.throwToDismissEnabled = YES; + return self; +} +- (NSUInteger) supportedInterfaceOrientations{ + if([UIDevice padIdiom]) + return UIInterfaceOrientationMaskAll; + return UIInterfaceOrientationMaskPortrait; +} + + +#pragma mark View Lifecycle +- (void) loadView{ + [super loadView]; + self.view.backgroundColor = [UIColor clearColor]; + + self.visibleFrame = self.view.bounds; + + self.backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; + self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; + self.backgroundView.alpha = 0; + [self.view addSubview:self.backgroundView]; + + + + CGSize s = CGSizeMake(280, 200); + CGRect alertRect = CGRectMakeWithSize( (CGFrameGetWidth(self.view)- s.width)/2.0f, (CGFrameGetHeight(self.view)- s.height)/2.0f, s); + + self.contentView = [[UIView alloc] initWithFrame:alertRect]; + self.contentView.backgroundColor = [UIColor whiteColor]; + self.contentView.layer.shadowOffset = CGSizeMake(0, 1); + self.contentView.layer.shadowColor = [UIColor blackColor].CGColor; + self.contentView.layer.shadowRadius = 3; + self.contentView.layer.shadowOpacity = 0.1; + self.contentView.layer.cornerRadius = 8; + self.contentView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + [self.view addSubview:self.contentView]; + + + + self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; + self.panGesture.enabled = self.throwToDismissEnabled; + [self.contentView addGestureRecognizer:self.panGesture]; + + self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)]; + self.tapGesture.enabled = self.tapToDismissEnabled; + self.tapGesture.delegate = self; + [self.view addGestureRecognizer:self.tapGesture]; + + self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; + + +} +- (void) viewDidLoad{ + [super viewDidLoad]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; +} +- (void) viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + + if (NSStringFromClass([UIInterpolatingMotionEffect class])) { + UIInterpolatingMotionEffect *mx; + + mx = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; + mx.maximumRelativeValue = @(15); + mx.minimumRelativeValue = @(-15); + [self.contentView addMotionEffect:mx]; + + mx = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; + mx.maximumRelativeValue = @(15); + mx.minimumRelativeValue = @(-15); + [self.contentView addMotionEffect:mx]; + } +} + + + + + +- (void) keyboardWillShow:(NSNotification*)notification{ + + NSValue *keyRectVal = notification.userInfo[UIKeyboardFrameEndUserInfoKey]; + CGRect keyFrame = [keyRectVal CGRectValue]; + + + CGRect bounds = self.view.bounds; + bounds.origin.y = 20; + bounds.size.height -= keyFrame.size.height; + bounds.size.height -= 20; + + self.visibleFrame = bounds; + + + [UIView animateWithDuration:0.6 delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:0.4 options:0 animations:^{ + self.contentView.center = CGPointMake(self.contentView.center.x, bounds.size.height/2); + }completion:^(BOOL finished) { + + }]; +} +- (void) keyboardWillHide:(NSNotification*)notification{ + + self.visibleFrame = self.view.bounds; + + + [UIView animateWithDuration:0.9 delay:0.3 usingSpringWithDamping:0.6 initialSpringVelocity:0.6 options:0 animations:^{ + self.contentView.center = CGPointMake(self.contentView.center.x, (CGFrameGetHeight(self.view)-20) / 2 + 20); + }completion:nil]; +} + + + +- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ + CGPoint p = [touch locationInView:self.contentView.superview]; + if(gestureRecognizer == self.tapGesture && CGRectContainsPoint(self.contentView.frame, p)) + return NO; + return YES; +} + +- (void) tapped:(UITapGestureRecognizer*)sender{ + + if(self.onlyAllowTapOffCardToDismiss){ + CGPoint p = [sender locationInView:self.contentView.superview]; + if(!CGRectContainsPoint(self.contentView.frame, p)) [self hide]; + }else + [self hide]; + + +} +- (void) pan:(UIPanGestureRecognizer*)gesture{ + if(!self.throwToDismissEnabled) return; + + UIView *view = gesture.view; + UIView *cnt = view.superview; + + CGPoint p = [gesture locationInView:view.superview]; + CGPoint velocity = [gesture velocityInView:cnt]; + CGFloat magnitude = sqrt(pow(velocity.x,2) + pow(velocity.y, 2)); + UIOffset offset = UIOffsetMake(p.x - view.center.x, p.y - view.center.y); + CGPoint o = CGPointMake(CGRectGetMidX(cnt.bounds), CGRectGetMidY(cnt.bounds)); + CGFloat angle = atan2(p.y-o.y, p.x-o.x); + + if(gesture.began){ + + self.cardRestingPosition = self.contentView.center; + + [self.animator removeAllBehaviors]; + + self.itemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[view]]; + self.itemBehavior.elasticity = 0.0f; + self.itemBehavior.friction = 0.2f; + self.itemBehavior.allowsRotation = YES; + self.itemBehavior.density = _density; + self.itemBehavior.resistance = _resistance; + [self.animator addBehavior:self.itemBehavior]; + + self.attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:view offsetFromCenter:offset attachedToAnchor:p]; + [self.animator addBehavior:self.attachmentBehavior]; + + } + + self.attachmentBehavior.anchorPoint = p; + + if(gesture.changed){ + self.angle = angle; + self.magnitude = magnitude; + } + + + if(gesture.state == UIGestureRecognizerStateEnded || gesture.state == UIGestureRecognizerStateCancelled){ + + [self.animator removeAllBehaviors]; + CGPoint location = [gesture locationInView:cnt]; + CGPoint boxLocation = [gesture locationInView:view]; + + // need to scale velocity values to tame down physics on the iPad + CGFloat deviceVelocityScale = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 0.2f : 1.0f; + CGFloat deviceAngularScale = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 0.7f : 1.0f; + // factor to increase delay before `dismissAfterPush` is called on iPad to account for more area to cover to disappear + //CGFloat deviceDismissDelay = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 1.8f : 1.0f; + CGPoint velocity = [gesture velocityInView:self.view]; + CGFloat velocityAdjust = 10.0f * deviceVelocityScale; + + if (fabs(velocity.x / velocityAdjust) > _minimumVelocityRequiredForPush || fabs(velocity.y / velocityAdjust) > _minimumVelocityRequiredForPush) { + + + self.pushBehavior = [[UIPushBehavior alloc] initWithItems:@[view] mode:UIPushBehaviorModeInstantaneous]; + self.pushBehavior.angle = 0.0f; + self.pushBehavior.magnitude = 0.0f; + + + UIOffset offsetFromCenter = UIOffsetMake(boxLocation.x - CGRectGetMidX(view.bounds), boxLocation.y - CGRectGetMidY(view.bounds)); + CGFloat radius = sqrtf(powf(offsetFromCenter.horizontal, 2.0f) + powf(offsetFromCenter.vertical, 2.0f)); + CGFloat pushVelocity = sqrtf(powf(velocity.x, 2.0f) + powf(velocity.y, 2.0f)); + + // calculate angles needed for angular velocity formula + CGFloat velocityAngle = atan2f(velocity.y, velocity.x); + CGFloat locationAngle = atan2f(offsetFromCenter.vertical, offsetFromCenter.horizontal); + if (locationAngle > 0) { + locationAngle -= M_PI * 2; + } + + // angle (θ) is the angle between the push vector (V) and vector component parallel to radius, so it should always be positive + CGFloat angle = fabsf(fabsf(velocityAngle) - fabsf(locationAngle)); + // angular velocity formula: w = (abs(V) * sin(θ)) / abs(r) + CGFloat angularVelocity = fabsf((fabsf(pushVelocity) * sinf(angle)) / fabsf(radius)); + + // rotation direction is dependent upon which corner was pushed relative to the center of the view + // when velocity.y is positive, pushes to the right of center rotate clockwise, left is counterclockwise + CGFloat direction = (location.x < view.center.x) ? -1.0f : 1.0f; + // when y component of velocity is negative, reverse direction + if (velocity.y < 0) { direction *= -1; } + + // amount of angular velocity should be relative to how close to the edge of the view the force originated + // angular velocity is reduced the closer to the center the force is applied + // for angular velocity: positive = clockwise, negative = counterclockwise + CGFloat xRatioFromCenter = fabsf(offsetFromCenter.horizontal) / (CGRectGetWidth(view.frame) / 2.0f); + CGFloat yRatioFromCetner = fabsf(offsetFromCenter.vertical) / (CGRectGetHeight(view.frame) / 2.0f); + + // apply device scale to angular velocity + angularVelocity *= deviceAngularScale; + // adjust angular velocity based on distance from center, force applied farther towards the edges gets more spin + angularVelocity *= ((xRatioFromCenter + yRatioFromCetner) / 2.0f); + + + + + [self.itemBehavior addAngularVelocity:angularVelocity * _angularVelocityFactor * direction forItem:view]; + [self.animator addBehavior:self.pushBehavior]; + self.pushBehavior.pushDirection = CGVectorMake((velocity.x / velocityAdjust) * _velocityFactor, (velocity.y / velocityAdjust) * _velocityFactor); + self.pushBehavior.active = YES; + [self.animator addBehavior:self.pushBehavior]; + + + CGFloat dimension = MAX(CGFrameGetHeight(self.contentView),CGFrameGetWidth(self.contentView)) * 1.2; + dimension = -MAX(dimension,420); + + UICollisionBehavior *collide = [[UICollisionBehavior alloc] initWithItems:@[view]]; + collide.translatesReferenceBoundsIntoBoundary = YES; + [collide setTranslatesReferenceBoundsIntoBoundaryWithInsets:UIEdgeInsetsMake(dimension, dimension, dimension, dimension)]; + collide.collisionDelegate = self; + [self.animator addBehavior:collide]; + + // delay for dismissing is based on push velocity also + return; + } + + + CGPoint pp = [self.view convertPoint:self.cardRestingPosition toView:cnt]; + UISnapBehavior *snapBehavior = [[UISnapBehavior alloc] initWithItem:view snapToPoint:pp]; + snapBehavior.damping = 0.85; + [self.animator addBehavior:snapBehavior]; + + } + +} + + +- (void) show{ + id delegate = [[UIApplication sharedApplication] delegate]; + [[delegate window].rootViewController presentViewController:self animated:YES completion:nil]; +} +- (void) hide{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; + [self dismissViewControllerAnimated:YES completion:nil]; +} + + +#pragma mark UIViewControllerTransitioningDelegate +- (NSTimeInterval) transitionDuration:(id)transitionContext{ + + UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + if([toVC isKindOfClass:[self class]]) + return 0.8f; + return 0.4f + 0.5f; +} +- (void) showAlertView:(id)transitionContext{ + + UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + UIView *containerView = [transitionContext containerView]; + [containerView addSubview:toVC.view]; + + toVC.view.frame = CGRectMake(0, 0, CGRectGetWidth(containerView.frame), CGRectGetHeight(containerView.frame)); + + CGFloat originalX = self.contentView.center.x; + CGFloat originalMinX = CGFrameGetMinX(self.contentView); + + self.contentView.center = CGPointMake(originalX, -300); + self.contentView.transform = CGRotate(-10 * M_PI / 180.0f); + + [UIView animateWithDuration:0.4 animations:^{ + self.backgroundView.alpha = 1; + }]; + + [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:0 animations:^{ + self.contentView.transform = CGAffineTransformIdentity; + NSInteger y = (CGRectGetHeight(self.visibleFrame) - CGFrameGetHeight(self.contentView)) / 2; + self.contentView.frame = CGRectMake(originalMinX, y, CGFrameGetWidth(self.contentView), CGFrameGetHeight(self.contentView)); + } completion:^(BOOL finished) { + [transitionContext completeTransition:YES]; + }]; + +} +- (void) hideAlertView:(id)transitionContext{ + + if(self.contentView.superview){ + + if(!self.animator) + self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; + + + [self.animator removeAllBehaviors]; + + UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.contentView]]; + gravity.magnitude = 3; + [self.animator addBehavior:gravity]; + + UIDynamicItemBehavior *behav = [[UIDynamicItemBehavior alloc] initWithItems:@[self.contentView]]; + behav.allowsRotation = YES; + behav.friction = 0.5; + + CGFloat velocity = (arc4random() % 20) - 10.0f; + velocity /= 100.0f; + [behav addAngularVelocity:velocity forItem:self.contentView]; + [self.animator addBehavior:behav]; + + } + + [UIView animateWithDuration:0.4 delay:0.4 options:0 animations:^{ + self.backgroundView.transform = CGAffineTransformIdentity; + self.backgroundView.alpha = 0; + } completion:^(BOOL finished){ + [self.view removeFromSuperview]; + [transitionContext completeTransition:YES]; + }]; + +} +- (void) animateTransition:(id)transitionContext{ + + UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + if([toVC isKindOfClass:[self class]]) + [self showAlertView:transitionContext]; + else + [self hideAlertView:transitionContext]; + +} + +- (id ) animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{ + return self; +} +- (id ) animationControllerForDismissedController:(UIViewController *)dismissed{ + return self; +} +- (void) collisionBehavior:(UICollisionBehavior*)behavior beganContactForItem:(id)item withBoundaryIdentifier:(id)identifier atPoint:(CGPoint)p{ + [self.animator removeAllBehaviors]; + [self.contentView removeFromSuperview]; + [self hide]; +} + +#pragma mark Properties +- (void) setTapToDismissEnabled:(BOOL)tapToDismissEnabled{ + _tapToDismissEnabled = tapToDismissEnabled; + self.tapGesture.enabled = tapToDismissEnabled; +} +- (void) setThrowToDismissEnabled:(BOOL)throwToDismissEnabled{ + _throwToDismissEnabled = throwToDismissEnabled; + self.panGesture.enabled = throwToDismissEnabled; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKCoverflowView.m b/TapkuLibrary/TKCoverflowView.m index ace7dfa1..3775e7ce 100644 --- a/TapkuLibrary/TKCoverflowView.m +++ b/TapkuLibrary/TKCoverflowView.m @@ -30,6 +30,8 @@ */ #import "TKCoverflowView.h" +#import "UIImageView+TKCategory.h" +#import "TKGradientView.h" #import "TKGlobal.h" @interface TKCoverflowView (){ diff --git a/TapkuLibrary/TKDecimalInputView.h b/TapkuLibrary/TKDecimalInputView.h new file mode 100644 index 00000000..e0b45192 --- /dev/null +++ b/TapkuLibrary/TKDecimalInputView.h @@ -0,0 +1,44 @@ +// +// TKDecimalInputView.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKNumberInputView.h" + +/** `TKDecimalInputView` is subclass `TKNumberInputView` with a decimal key. */ +@interface TKDecimalInputView : TKNumberInputView + +///---------------------------- +/// @name Properties +///---------------------------- + +/** Decimal key. */ +@property (nonatomic,strong) TKInputKey *decimalKey; + +@end diff --git a/TapkuLibrary/TKDecimalInputView.m b/TapkuLibrary/TKDecimalInputView.m new file mode 100644 index 00000000..d25e984a --- /dev/null +++ b/TapkuLibrary/TKDecimalInputView.m @@ -0,0 +1,102 @@ +// +// TKDecimalInputView.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKDecimalInputView.h" +#import "UIDevice+TKCategory.h" +#import "TKGlobal.h" +#import "TKInputKey.h" + +@implementation TKDecimalInputView + +#define RECT(_X,_Y,_S) CGRectMakeWithSize(_X,_Y,_S) + +- (instancetype) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys keypadFrame:(CGRect)padFrame{ + frame.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIDevice phoneIdiom] ? 216 : 352); + + CGFloat w = padFrame.size.width / 3; + CGFloat h = padFrame.size.height / 4; + CGFloat pad = 0, xPad = 0, marginX = 0; + + + if([UIDevice padIdiom]){ + w = 108, h = 75, pad = 10, xPad = 16, marginX = 24; + } + + + CGSize s = CGSizeMake(w,h); + + + self.oneKey = [TKInputKey keyWithFrame:RECT( marginX, pad, s) symbol:@"1" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.twoKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, pad, s) symbol:@"2" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.threeKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, pad, s) symbol:@"3" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.fourKey = [TKInputKey keyWithFrame:RECT( marginX, h+pad*2, s) symbol:@"4" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.fiveKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, h+pad*2, s) symbol:@"5" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.sixKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, h+pad*2, s) symbol:@"6" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.sevenKey = [TKInputKey keyWithFrame:RECT( marginX, h*2+pad*3, s) symbol:@"7" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.eightKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, h*2+pad*3, s) symbol:@"8" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.nineKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, h*2+pad*3, s) symbol:@"9" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.decimalKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, h*3+pad*4, s) symbol:@"." normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.zeroKey = [TKInputKey keyWithFrame:CGRectMake( marginX, h*3+pad*4, w*2+xPad,h) symbol:@"0" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + + + NSMutableArray *ar = [NSMutableArray arrayWithArray:self.keypadKeys]; + [ar addObjectsFromArray:keys]; + + + if(!(self=[super initWithFrame:frame withKeysModels:ar])) return nil; + + return self; +} +- (NSArray*) keypadKeys{ + return @[self.oneKey,self.twoKey,self.threeKey,self.fourKey,self.fiveKey,self.sixKey,self.sevenKey,self.eightKey,self.nineKey,self.zeroKey,self.decimalKey]; +} +- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + + if(self.selectedKey && [self.keypadKeys containsObject:self.selectedKey]){ + + BOOL insert = YES; + + if(self.textField.delegate && [self.textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:)]) + insert = [self.textField.delegate textField:self.textField shouldChangeCharactersInRange:NSMakeRange(self.textField.text.length, 0) replacementString:self.selectedKey.label.text]; + + if(insert) + [self.textField insertText:self.selectedKey.label.text]; + + [super touchesCancelled:touches withEvent:event]; + return; + } + + [super touchesEnded:touches withEvent:event]; + +} + + +@end diff --git a/TapkuLibrary/TKDecimalInputWithNextKeyView.h b/TapkuLibrary/TKDecimalInputWithNextKeyView.h new file mode 100644 index 00000000..ecc1af3f --- /dev/null +++ b/TapkuLibrary/TKDecimalInputWithNextKeyView.h @@ -0,0 +1,43 @@ +// +// TKDecimalInputWithNextKeyView.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKDecimalInputView.h" + +/** `TKDecimalInputWithNextKeyView` is subclass `TKDecimalInputView` with a next key. */ +@interface TKDecimalInputWithNextKeyView : TKDecimalInputView + +///---------------------------- +/// @name Properties +///---------------------------- +/** The next key. */ +@property (nonatomic,strong) TKInputKey *nextKey; + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKDecimalInputWithNextKeyView.m b/TapkuLibrary/TKDecimalInputWithNextKeyView.m new file mode 100644 index 00000000..478f2895 --- /dev/null +++ b/TapkuLibrary/TKDecimalInputWithNextKeyView.m @@ -0,0 +1,60 @@ +// +// TKDecimalInputWithNextKeyView.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKDecimalInputWithNextKeyView.h" +#import "UIDevice+TKCategory.h" +#import "TKGlobal.h" +#import "TKInputKey.h" +#import "UIImage+TKCategory.h" + +@implementation TKDecimalInputWithNextKeyView + +- (instancetype) initWithFrame:(CGRect)frame{ + frame.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIDevice phoneIdiom] ? 216 : 352); + + CGFloat yPad = 0, xPad = 0, xMargin = 0; + CGFloat w = frame.size.width / 4; + CGFloat h = frame.size.height / 4; + + if([UIDevice padIdiom]){ + w = 108, h = 75, yPad = 10, xPad = 16, xMargin = 28; + } + + self.nextKey = [[TKInputKey alloc] initWithFrame:CGRectMake(xMargin+w*3 + (xPad*3), yPad, w+1, h*2+yPad) symbol:[UIImage imageNamedTK:@"keyboard/next-key"] normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:NO]; + self.backspaceKey = [[TKInputKey alloc] initWithFrame:CGRectMake(xMargin+w*3+ (xPad*3), h*2+yPad*3, w+1, h*2+yPad) symbol:[UIImage imageNamedTK:@"keyboard/backspace-key"] normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:NO]; + + CGRect pad = CGRectMake(0, 0, w*3, h*4); + + if(!(self=[super initWithFrame:frame withKeysModels:@[self.nextKey,self.backspaceKey] keypadFrame:pad])) return nil; + return self; +} + +@end diff --git a/TapkuLibrary/TKEmptyView.h b/TapkuLibrary/TKEmptyView.h index 6d233954..2f748341 100644 --- a/TapkuLibrary/TKEmptyView.h +++ b/TapkuLibrary/TKEmptyView.h @@ -31,7 +31,8 @@ @import UIKit; @import QuartzCore; -@import curry; +#import "TKGradientView.h" + /** The glyph that appears with the empty view. diff --git a/TapkuLibrary/TKGlobal.h b/TapkuLibrary/TKGlobal.h index 748a2327..274fac01 100755 --- a/TapkuLibrary/TKGlobal.h +++ b/TapkuLibrary/TKGlobal.h @@ -39,9 +39,123 @@ #define TKBUNDLE(_URL) [TKGlobal fullBundlePath:[@"TapkuLibrary.bundle/Images" stringByAppendingPathComponent:_URL]] +FOUNDATION_STATIC_INLINE CATransform3D CAScale(CGFloat x,CGFloat y,CGFloat z); +FOUNDATION_STATIC_INLINE CATransform3D CAScale(CGFloat x,CGFloat y,CGFloat z){ + return CATransform3DMakeScale(x,y,z); +} +FOUNDATION_STATIC_INLINE CATransform3D CARotate(CGFloat angle,CGFloat x,CGFloat y,CGFloat z); +FOUNDATION_STATIC_INLINE CATransform3D CARotate(CGFloat angle,CGFloat x,CGFloat y,CGFloat z){ + return CATransform3DMakeRotation(angle,x,y,z); +} +FOUNDATION_STATIC_INLINE CATransform3D CATranslate(CGFloat x,CGFloat y,CGFloat z); +FOUNDATION_STATIC_INLINE CATransform3D CATranslate(CGFloat x,CGFloat y,CGFloat z){ + return CATransform3DMakeTranslation(x,y,z); +} +FOUNDATION_STATIC_INLINE CATransform3D CAConcat(CATransform3D t1,CATransform3D t2); +FOUNDATION_STATIC_INLINE CATransform3D CAConcat(CATransform3D t1,CATransform3D t2){ + return CATransform3DConcat(t1,t2); +} + +FOUNDATION_STATIC_INLINE CGAffineTransform CGScale(CGFloat x,CGFloat y); +FOUNDATION_STATIC_INLINE CGAffineTransform CGScale(CGFloat x,CGFloat y){ + return CGAffineTransformMakeScale(x,y); +} + +FOUNDATION_STATIC_INLINE CGAffineTransform CGRotate(CGFloat angle); +FOUNDATION_STATIC_INLINE CGAffineTransform CGRotate(CGFloat angle){ + return CGAffineTransformMakeRotation(angle); +} + +FOUNDATION_STATIC_INLINE CGAffineTransform CGTranslate(CGFloat x, CGFloat y); +FOUNDATION_STATIC_INLINE CGAffineTransform CGTranslate(CGFloat x, CGFloat y){ + return CGAffineTransformMakeTranslation(x, y); +} + +FOUNDATION_STATIC_INLINE CGAffineTransform CGConcat(CGAffineTransform first, CGAffineTransform second); +FOUNDATION_STATIC_INLINE CGAffineTransform CGConcat(CGAffineTransform first, CGAffineTransform second){ + return CGAffineTransformConcat(first, second); +} + +FOUNDATION_STATIC_INLINE CGRect CGRectMakeWithSize(CGFloat x, CGFloat y, CGSize size); +FOUNDATION_STATIC_INLINE CGRect CGRectMakeWithSize(CGFloat x, CGFloat y, CGSize size){ + CGRect r; r.origin.x = x; r.origin.y = y; r.size = size; return r; +} + +FOUNDATION_STATIC_INLINE CGRect CGRectMakeWithPoint(CGPoint origin, CGFloat width, CGFloat height); +FOUNDATION_STATIC_INLINE CGRect CGRectMakeWithPoint(CGPoint origin, CGFloat width, CGFloat height){ + CGRect r; r.origin = origin; r.size.width = width; r.size.height = height; return r; +} + +FOUNDATION_STATIC_INLINE CGRect CGRectCompose(CGPoint origin, CGSize size); +FOUNDATION_STATIC_INLINE CGRect CGRectCompose(CGPoint origin, CGSize size){ + CGRect r; r.origin = origin; r.size = size; return r; +} + + + +FOUNDATION_STATIC_INLINE CGPoint CGPointGetMidpoint(CGPoint p1,CGPoint p2); +FOUNDATION_STATIC_INLINE CGPoint CGPointGetMidpoint(CGPoint p1,CGPoint p2){ + return CGPointMake((p1.x+p2.x)/2.0f,(p1.y+p2.y)/2.0f); +} + +FOUNDATION_STATIC_INLINE CGFloat CGPointGetDistance(CGPoint p1,CGPoint p2); +FOUNDATION_STATIC_INLINE CGFloat CGPointGetDistance(CGPoint p1,CGPoint p2){ + return sqrt(pow(p2.x-p1.x,2)+pow(p2.y-p1.y,2)); +} + + +FOUNDATION_STATIC_INLINE CGPoint CGRectGetMidpoint(CGRect rect); +FOUNDATION_STATIC_INLINE CGPoint CGRectGetMidpoint(CGRect rect){ + return CGPointMake(rect.origin.x + rect.size.width / 2.0f, rect.origin.y + rect.size.height / 2.0f); +} + +FOUNDATION_STATIC_INLINE CGPoint CGRectGetCenter(CGRect rect); +FOUNDATION_STATIC_INLINE CGPoint CGRectGetCenter(CGRect rect){ + return CGPointMake(rect.size.width / 2.0f, rect.size.height / 2.0f); +} + + + + +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetWidth(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetWidth(UIView *view){ + return CGRectGetWidth(view.frame); +} + +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetHeight(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetHeight(UIView *view){ + return CGRectGetHeight(view.frame); +} + +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMinX(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMinX(UIView *view){ + return CGRectGetMinX(view.frame); +} +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMinY(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMinY(UIView *view){ + return CGRectGetMinY(view.frame); +} + +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMaxX(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMaxX(UIView *view){ + return CGRectGetMaxX(view.frame); +} +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMaxY(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMaxY(UIView *view){ + return CGRectGetMaxY(view.frame); +} + +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMidX(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMidX(UIView *view){ + return CGRectGetMidX(view.frame); +} +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMidY(UIView *view); +FOUNDATION_STATIC_INLINE CGFloat CGFrameGetMidY(UIView *view){ + return CGRectGetMidY(view.frame); +} @interface TKGlobal : NSObject diff --git a/TapkuLibrary/TKGlowButton.h b/TapkuLibrary/TKGlowButton.h new file mode 100644 index 00000000..27fedaee --- /dev/null +++ b/TapkuLibrary/TKGlowButton.h @@ -0,0 +1,44 @@ +// +// TKGlowButton.h +// Created by Devin Ross on 8/24/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** `TKGlowButton` is a subclassed `UIButton` that allows the background of a button to glow on touch. */ +@interface TKGlowButton : UIButton + +/** + This method allows you to set the background color during a certain state. + @param color The background color of the button. + @param state The state to which the color will appear. + */ +- (void) setBackgroundColor:(UIColor*)color forState:(UIControlState)state; + +@end diff --git a/TapkuLibrary/TKGlowButton.m b/TapkuLibrary/TKGlowButton.m new file mode 100644 index 00000000..25d278f9 --- /dev/null +++ b/TapkuLibrary/TKGlowButton.m @@ -0,0 +1,87 @@ +// +// TKGlowButton.m +// Created by Devin Ross on 8/24/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKGlowButton.h" + +@interface TKGlowButton (){ + UIColor *normalBackgroundColor, *selectedBackgroundColor, *highlightedBackgroundColor; +} +@end + +@implementation TKGlowButton + +- (void) setBackgroundColor:(UIColor*)color forState:(UIControlState)state{ + + if(state == UIControlStateNormal){ + normalBackgroundColor = color; + self.backgroundColor = color; + }else if(state == UIControlStateHighlighted){ + highlightedBackgroundColor = color; + }else if(state == UIControlStateSelected){ + selectedBackgroundColor = color; + } + +} + + +- (void) setSelected:(BOOL)selected{ + [super setSelected:selected]; + + UIColor *clr = [UIColor clearColor]; + + if(selected && selectedBackgroundColor) + clr = selectedBackgroundColor; + else if(!selected && normalBackgroundColor) + clr = normalBackgroundColor; + + [UIView beginAnimations:nil context:nil]; + self.backgroundColor = clr; + [UIView commitAnimations]; + +} + +- (void) setHighlighted:(BOOL)highlighted{ + [super setHighlighted:highlighted]; + + UIColor *clr = [UIColor clearColor]; + + if(highlighted && highlightedBackgroundColor) + clr = highlightedBackgroundColor; + else if(!highlighted && normalBackgroundColor) + clr = normalBackgroundColor; + + [UIView beginAnimations:nil context:nil]; + self.backgroundColor = clr; + [UIView commitAnimations]; + +} + +@end diff --git a/TapkuLibrary/TKGradientView.h b/TapkuLibrary/TKGradientView.h new file mode 100644 index 00000000..930ff6e7 --- /dev/null +++ b/TapkuLibrary/TKGradientView.h @@ -0,0 +1,64 @@ +// +// TKGradientView.h +// Created by Devin Ross on 9/21/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; +@import QuartzCore; + + +/** This class implements `UIView` backed by a `CAGradientLayer`. */ +@interface TKGradientView : UIView + +///---------------------------- +/// @name Gradient Style Properties +///---------------------------- + +/** An array of `UIColor` objects defining the color of each gradient stop. */ +@property (nonatomic,strong) NSArray *colors; + +/** An optional array of NSNumber objects defining the location of each gradient stop. */ +@property (nonatomic,strong) NSArray *locations; + + +/** + The start point corresponds to the first stop of the gradient. The point is defined in the unit coordinate space and is then mapped to the layer’s bounds rectangle when drawn. + Default value is (0.5,0.0). +*/ +@property (nonatomic,assign) CGPoint startPoint; + + +/** The end point of the gradient when drawn in the layer’s coordinate space. */ +@property (nonatomic,assign) CGPoint endPoint; + +/** Style of gradient drawn by the layer. */ +@property (nonatomic,copy) NSString *type; + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKGradientView.m b/TapkuLibrary/TKGradientView.m new file mode 100644 index 00000000..2b87fc5b --- /dev/null +++ b/TapkuLibrary/TKGradientView.m @@ -0,0 +1,108 @@ +// +// TKGradientView.m +// Created by Devin Ross on 9/21/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKGradientView.h" + + +@implementation TKGradientView + + ++ (Class)layerClass { + return [CAGradientLayer class]; +} +- (CAGradientLayer *) _gradientLayer{ + return (CAGradientLayer *)self.layer; +} + + + +- (NSArray *) colors{ + NSArray *cgColors = [self _gradientLayer].colors; + + if (cgColors == nil) return nil; + + + NSMutableArray *uiColors = [NSMutableArray arrayWithCapacity:[cgColors count]]; + + for (id cgColor in cgColors) + [uiColors addObject:[UIColor colorWithCGColor:(__bridge CGColorRef)cgColor]]; + + return [NSArray arrayWithArray:uiColors]; +} +- (void)setColors:(NSArray *)newColors { + NSMutableArray *newCGColors = nil; + + if (newColors != nil) { + newCGColors = [NSMutableArray arrayWithCapacity:[newColors count]]; + for (id color in newColors) { + + if ([color isKindOfClass:[UIColor class]]) + [newCGColors addObject:(id)[color CGColor]]; + else + [newCGColors addObject:color]; + } + } + + [self _gradientLayer].colors = newCGColors; +} + + +- (NSArray *)locations { + return [self _gradientLayer].locations; +} +- (void) setLocations:(NSArray *)newLocations { + [self _gradientLayer].locations = newLocations; +} + +- (CGPoint) startPoint{ + return [self _gradientLayer].startPoint; +} +- (void) setStartPoint:(CGPoint)newStartPoint { + [self _gradientLayer].startPoint = newStartPoint; +} + +- (CGPoint) endPoint{ + return [self _gradientLayer].endPoint; +} +- (void) setEndPoint:(CGPoint)newEndPoint { + [self _gradientLayer].endPoint = newEndPoint; +} + +- (NSString *) type{ + return [self _gradientLayer].type; +} +- (void) setType:(NSString *)newType { + [self _gradientLayer].type = newType; +} + + + +@end diff --git a/TapkuLibrary/TKHTTPRequest.h b/TapkuLibrary/TKHTTPRequest.h index 2167d3b5..e09b676b 100644 --- a/TapkuLibrary/TKHTTPRequest.h +++ b/TapkuLibrary/TKHTTPRequest.h @@ -30,6 +30,7 @@ */ @import Foundation; +#import "NSObject+TKCategory.h" #if NS_BLOCKS_AVAILABLE typedef void (^TKBasicBlock)(void); diff --git a/TapkuLibrary/TKHTTPRequest.m b/TapkuLibrary/TKHTTPRequest.m index a735468a..5673afec 100644 --- a/TapkuLibrary/TKHTTPRequest.m +++ b/TapkuLibrary/TKHTTPRequest.m @@ -31,6 +31,7 @@ #import "TKHTTPRequest.h" #import "TKNetworkQueue.h" +#import "NSObject+TKCategory.h" typedef enum TKOperationState { diff --git a/TapkuLibrary/TKImageCache.m b/TapkuLibrary/TKImageCache.m index e6e8cda5..90f926cd 100644 --- a/TapkuLibrary/TKImageCache.m +++ b/TapkuLibrary/TKImageCache.m @@ -256,8 +256,8 @@ - (void) removeCachedImagesFromDiskOlderThanTime:(NSTimeInterval)time{ for( NSString *file in files ) { if( ![file isEqual:@"."] && ![file isEqual:@".."] ) { - NSString *aPath = [path stringByAppendingPathComponent:file]; - NSDate *created = [[[NSFileManager defaultManager] attributesOfItemAtPath:aPath error:NULL] fileCreationDate]; + NSString *path = [path stringByAppendingPathComponent:file]; + NSDate *created = [[[NSFileManager defaultManager] attributesOfItemAtPath:path error:NULL] fileCreationDate]; NSTimeInterval timeSince = fabs([created timeIntervalSinceNow]); if(timeSince > time){ @@ -265,7 +265,7 @@ - (void) removeCachedImagesFromDiskOlderThanTime:(NSTimeInterval)time{ dispatch_async(dispatch_get_main_queue(), ^{ if(_diskKeys) [_diskKeys removeObjectForKey:file]; }); - [[NSFileManager defaultManager] removeItemAtPath:aPath error:&error]; + [[NSFileManager defaultManager] removeItemAtPath:[path stringByAppendingPathComponent:file] error:&error]; } } } diff --git a/TapkuLibrary/TKInputKey.h b/TapkuLibrary/TKInputKey.h new file mode 100644 index 00000000..3e539ff7 --- /dev/null +++ b/TapkuLibrary/TKInputKey.h @@ -0,0 +1,91 @@ +// +// TKInputKey.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** An input key display type. */ +typedef NS_ENUM(NSInteger, TKInputKeyType) { + TKInputKeyTypeDefault = 0, + TKInputKeyTypeDark = 1, + TKInputKeyTypeHighlighted = 2 +} ; + +/** `TKInputKey` is an input key to be used by a `TKInputView`. */ +@interface TKInputKey : UIView + +/** Initializes an input key. + + @param frame The frame of the `UIView`. + @param symbol A image or string for the key. + @param normal A image or string for the key. + @param highlighted A image or string for the key. + @param runner If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning. + @return An initialized `TKInputKey` object or nil if the object couldn’t be created. + */ ++ (instancetype) keyWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner; + + +/** Initializes an input key. + + @param frame The frame of the `UIView`. + @param symbol A image or string for the key. + @param normal A image or string for the key. + @param highlighted A image or string for the key. + @param runner If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning. + @return An initialized `TKInputKey` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner NS_DESIGNATED_INITIALIZER; + +///---------------------------- +/// @name Properties +///---------------------------- + +/** The display mode when the key is in a normal state. */ +@property (nonatomic,assign) TKInputKeyType normalType; + +/** The display mode when the key is in a highlighted state. */ +@property (nonatomic,assign) TKInputKeyType highlighedType; + +/** If yes, the key can be highlighted and selected even if it isn't the initial key touched at the beginning. */ +@property (nonatomic,assign) BOOL runner; + +/** The label that displays the text symbol. */ +@property (nonatomic,strong) UILabel *label; + +/** The symbol image view. */ +@property (nonatomic,strong) UIImageView *symbol; + + +/** The backspace key. + @param highlighted A flag to set the key to highlighted. */ +- (void) setHighlighted:(BOOL)highlighted; + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKInputKey.m b/TapkuLibrary/TKInputKey.m new file mode 100644 index 00000000..1cfe6187 --- /dev/null +++ b/TapkuLibrary/TKInputKey.m @@ -0,0 +1,151 @@ +// +// TKInputKey.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKInputKey.h" +#import "UIColor+TKCategory.h" +#import "UIDevice+TKCategory.h" +#import "TKGlobal.h" +#import "UIFont+TKCategory.h" + +@implementation TKInputKey + ++ (instancetype) keyWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner{ + return [[TKInputKey alloc] initWithFrame:frame symbol:symbol normalType:normal selectedType:highlighted runner:runner]; +} + +- (instancetype) initWithFrame:(CGRect)frame symbol:(id)symbol normalType:(TKInputKeyType)normal selectedType:(TKInputKeyType)highlighted runner:(BOOL)runner{ + if(!(self=[super initWithFrame:frame])) return nil; + + if([UIDevice padIdiom]){ + + self.layer.cornerRadius = 5; + self.layer.shadowRadius = 0; + self.layer.shadowColor = [UIColor colorWithWhite:0 alpha:0.2].CGColor; + self.layer.shadowOpacity = 1; + self.layer.shadowOffset = CGSizeMake(0, 1); + }else{ + + UIView *line; + + line = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height - 1, frame.size.width, 1)]; + line.backgroundColor = [UIColor colorWithHex:0xcfd1d5]; + line.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; + [self addSubview:line]; + + line = [[UIView alloc] initWithFrame:CGRectMake(frame.size.width-1, 0, 1, frame.size.height)]; + line.backgroundColor = [UIColor colorWithHex:0xcfd1d5]; + line.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight; + [self addSubview:line]; + } + + + + + if([symbol isKindOfClass:[NSString class]]){ + + CGRect bounds = frame; + bounds.origin = CGPointZero; + + self.label = [[UILabel alloc] initWithFrame:CGRectInset(bounds, 5, 5)]; + self.label.font = [UIFont helveticaNeueLightWithSize:30]; + self.label.textAlignment = NSTextAlignmentCenter; + self.label.backgroundColor = [UIColor clearColor]; + self.label.adjustsFontSizeToFitWidth = YES; + self.label.text = symbol; + [self addSubview:self.label]; + + }else if([symbol isKindOfClass:[UIImage class]]){ + + + self.symbol = [[UIImageView alloc] initWithImage:(UIImage*)symbol]; + self.symbol.tintColor = [UIColor colorWithWhite:0.3 alpha:1]; + + NSInteger w = (CGRectGetWidth(self.frame) - CGRectGetWidth(self.symbol.frame)) / 2; + NSInteger h = (CGRectGetHeight(self.frame) - CGRectGetHeight(self.symbol.frame)) / 2; + + self.symbol.frame = CGRectMakeWithSize(w, h, self.symbol.frame.size); + + self.symbol.center = CGPointMake(self.frame.size.width/2., self.frame.size.height/2.); + self.symbol.frame = CGRectIntegral(self.symbol.frame); + [self addSubview:self.symbol]; + + } + + self.normalType = normal; + self.highlighedType = highlighted; + self.runner = runner; + + return self; +} +- (void) setHighlighted:(BOOL)highlighted{ + + TKInputKeyType type = highlighted ? self.highlighedType : self.normalType; + + if(type == TKInputKeyTypeDark || type == TKInputKeyTypeDefault){ + + self.label.textColor = [UIColor blackColor]; + + + if(type == TKInputKeyTypeDark) + self.backgroundColor = [UIColor colorWithHex:0xe4e4e4]; + else + self.backgroundColor = [UIColor colorWithWhite:1 alpha:1]; + self.symbol.tintColor = [UIColor colorWithWhite:0.3 alpha:1]; + self.symbol.image = self.symbol.image; + + }else if(type == TKInputKeyTypeHighlighted){ + + self.symbol.tintColor = [UIColor whiteColor]; + self.symbol.image = [self.symbol.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + self.label.textColor = [UIColor whiteColor]; + self.backgroundColor = [UIColor colorWithHex:0x4185f4]; + } + +} +- (void) setNormalType:(TKInputKeyType)normalType{ + _normalType = normalType; + [self setHighlighted:NO]; +} + + +- (void) layoutSubviews{ + [super layoutSubviews]; + + self.label.frame = CGRectInset(self.bounds, 5, 5); + self.symbol.center = CGPointMake(self.frame.size.width/2., self.frame.size.height/2.); + self.symbol.frame = CGRectIntegral(self.symbol.frame); +} + + +- (NSString*) description{ + return [NSString stringWithFormat:@"<%@ %@>",NSStringFromClass([self class]),self.label.text]; +} +@end diff --git a/TapkuLibrary/TKInputView.h b/TapkuLibrary/TKInputView.h new file mode 100644 index 00000000..16d7486f --- /dev/null +++ b/TapkuLibrary/TKInputView.h @@ -0,0 +1,86 @@ +// +// TKInputView.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; +@class TKInputView; +@class TKInputKey; + +/** The delegate of a `TKInputView` object must adopt the `TKInputViewDelegate` protocol. */ +@protocol TKInputViewDelegate + +/** When a key is tapped, this delegate method is invoked. + @param inputView The input view. + @param key The input key tapped. + @return + */ +- (void) inputView:(TKInputView*)inputView didSelectKey:(TKInputKey*)key; + +@end + +/** + `TKInputView` is intended to be a custom keyboard + that you can present to the user instead of the + customary Apple provided keyboards. + */ +@interface TKInputView : UIView + + +/** Initializes an input view. Invoke this method for subclasses. + + @param frame The frame of the `UIView`. + @param keys The keys included on the view. + @return An initialized `TKInputView` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys; + +///---------------------------- +/// @name Properties +///---------------------------- + +/** The delegate must adopt the `TKInputViewDelegate` protocol. The delegate is not retained. */ +@property (nonatomic,weak) id delegate; + +/** The text field using the custom input view. The text field is not retained. */ +@property (nonatomic,weak) UITextField *textField; + +/** The backspace key. */ +@property (nonatomic,strong) TKInputKey *backspaceKey; + +/** The key that will resign the text field. */ +@property (nonatomic,strong) TKInputKey *hideKeyboardKey; + +/** The current key that is being touched down. */ +@property (nonatomic,readonly) TKInputKey *selectedKey; + +/** The view that contains all the keys. This view becomes useful when dealing with iPad formatting. */ +@property (nonatomic,strong) UIView *containerView; + +@end diff --git a/TapkuLibrary/TKInputView.m b/TapkuLibrary/TKInputView.m new file mode 100644 index 00000000..9cbf2e45 --- /dev/null +++ b/TapkuLibrary/TKInputView.m @@ -0,0 +1,220 @@ +// +// TKInputView.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKInputView.h" +#import "UIDevice+TKCategory.h" +#import "UIColor+TKCategory.h" +#import "TKInputKey.h" +#import "UIView+TKCategory.h" +#import "UIImageView+TKCategory.h" +#import "TKGlobal.h" +#import "UIImage+TKCategory.h" + +@interface TKInputView () + +@property (nonatomic,strong) NSArray *keyViews; +@property (nonatomic,assign) TKInputKey *originalSelectedKey; +@property (nonatomic,strong) TKInputKey *selectedKey; + +@end + +@implementation TKInputView + +- (instancetype) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys{ + + frame.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIDevice phoneIdiom] ? 216 : 352); + + if(!(self=[super initWithFrame:frame])) return nil; + + self.backgroundColor = [UIColor colorWithHex:0xd7dadf]; + self.clipsToBounds = YES; + self.multipleTouchEnabled = NO; + self.exclusiveTouch = YES; + + + + + CGRect cntFrame = self.bounds; + self.containerView = [[UIView alloc] initWithFrame:cntFrame]; + + if([UIDevice padIdiom]) + self.containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + self.containerView.clipsToBounds = YES; + [self addSubview:self.containerView]; + + int tag = 0; + + CGFloat maxX = 0,minX = CGRectGetWidth(self.containerView.frame); + + for(TKInputKey *key in keys){ + + CGRect r = key.frame; + r.origin.y++; + key.frame = r; + + minX = MIN(CGRectGetMinX(r),minX); + maxX = MAX(CGRectGetMaxX(r),maxX); + + key.tag = tag; + [key setHighlighted:NO]; + [self.containerView addSubviewToBack:key]; + tag++; + } + + self.keyViews = keys; + + + if([UIDevice padIdiom]){ + CGRect cntRect = self.containerView.frame; + cntRect.size.width = maxX + minX; + cntRect.origin.x = (CGRectGetWidth(self.frame) - cntRect.size.width) / 2.0f; + self.containerView.frame = cntRect; + + self.hideKeyboardKey = [[TKInputKey alloc] initWithFrame:CGRectMake(frame.size.width - 80 - 32, frame.size.height - 75 - 12, 80, 75) + symbol:[UIImage imageNamedTK:@"keyboard/down-keyboard"] + normalType:TKInputKeyTypeDefault + selectedType:TKInputKeyTypeHighlighted runner:NO]; + self.hideKeyboardKey.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; + self.hideKeyboardKey.tag = tag; + [self.hideKeyboardKey setHighlighted:NO]; + [self addSubview:self.hideKeyboardKey]; + + UIImage *dotsImage = [UIImage imageNamedTK:@"keyboard/move-keyboard-dots"]; + UIImageView *dots = [UIImageView imageViewWithFrame:CGRectMakeWithSize(CGRectGetWidth(frame) - 18, CGRectGetHeight(frame) - 57, dotsImage.size)]; + dots.image = [UIImage imageNamedTK:@"keyboard/move-keyboard-dots"]; + dots.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin; + [self addSubview:dots]; + } + + + + + + return self; +} +- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + + + UITouch *touch = [touches anyObject]; + UIView *view = [self hitTest:[touch locationInView:self] withEvent:event]; + + if(self.selectedKey!=nil){ + + [self.selectedKey setHighlighted:NO]; + self.originalSelectedKey = nil; + self.selectedKey = nil; + + } + + + if(![view isKindOfClass:[TKInputKey class]]) + return; + + + [[UIDevice currentDevice] playInputClick]; + + + self.originalSelectedKey = (TKInputKey*)view; + self.selectedKey = self.originalSelectedKey; + [self.selectedKey setHighlighted:YES]; + [self.containerView bringSubviewToFront:self.selectedKey]; + + +} +- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ + UITouch *touch = [touches anyObject]; + + + UIView *view = [self hitTest:[touch locationInView:self] withEvent:event]; + + TKInputKey *currentKey = nil; + + + if([view isKindOfClass:[TKInputKey class]]) + currentKey = (TKInputKey*)view; + + + + BOOL on = NO; + + if(self.originalSelectedKey == currentKey) + on = YES; + else if(self.originalSelectedKey.runner && currentKey.runner) + on = YES; + + + if(self.selectedKey != currentKey){ + [self.selectedKey setHighlighted:NO]; + self.selectedKey = nil; + } + + if(on){ + self.selectedKey = currentKey; + [self.containerView bringSubviewToFront:self.selectedKey]; + [self.selectedKey setHighlighted:YES]; + } + + +} +- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + + + if(self.selectedKey == self.backspaceKey){ + + BOOL delete = YES; + if(self.textField.text.length < 1) + delete = NO; + + + else if(self.textField.delegate && [self.textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:)]) + delete = [self.textField.delegate textField:self.textField shouldChangeCharactersInRange:NSMakeRange(self.textField.text.length-1, 1) replacementString:@""]; + + if(delete) + [self.textField deleteBackward]; + + + }else if(self.selectedKey){ + [self.delegate inputView:self didSelectKey:self.selectedKey]; + } + [self touchesCancelled:touches withEvent:event]; +} +- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ + + [self.selectedKey setHighlighted:NO]; + self.selectedKey = nil; + self.originalSelectedKey = nil; + +} +- (BOOL) enableInputClicksWhenVisible{ + return YES; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKKeyboardTableViewController.h b/TapkuLibrary/TKKeyboardTableViewController.h new file mode 100644 index 00000000..3415e0e8 --- /dev/null +++ b/TapkuLibrary/TKKeyboardTableViewController.h @@ -0,0 +1,64 @@ +// +// TKKeyboardTableViewController.h +// Created by Devin Ross on 10/1/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKTableViewController.h" + +/** + This class provides additional functionality to `TKTableViewController` text entry. + It will adjust its bounds when keyboards appear and hide keyboards when the user scrolls the table. + When you subclass, make sure to set this view controller to the delegate of your `UITextField` and `UITextView` objects. + */ +@interface TKKeyboardTableViewController : TKTableViewController + +///---------------------------- +/// @name Properties +///---------------------------- + +/** This flag is set to YES, it will call resignResponders when the user scrolls a table view. On iPad defaults to NO, Phone defaults to YES. */ +@property (nonatomic,assign) BOOL hideKeyboardOnScroll; + +/** This flag is set to YES, it will scroll the UITextField or UITextView into the bounds when it becomes the first responder. Defaults to YES. */ +@property (nonatomic,assign) BOOL scrollToTextField; + + +///---------------------------- +/// @name Methods +///---------------------------- + +/** Scrolls the tableview to keep the view within the table view bounds. + @param view The view that the table views bounds adjusts to. + */ +- (void) scrollToView:(UIView*)view; + +/** When subclassing, call resignFirstResponder on all your `UITextField` and `UITextView` objects */ +- (void) resignResponders; + +@end diff --git a/TapkuLibrary/TKKeyboardTableViewController.m b/TapkuLibrary/TKKeyboardTableViewController.m new file mode 100644 index 00000000..ab61817c --- /dev/null +++ b/TapkuLibrary/TKKeyboardTableViewController.m @@ -0,0 +1,174 @@ +// +// TKKeyboardTableViewController.m +// Created by Devin Ross on 10/1/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKKeyboardTableViewController.h" +#import "UIDevice+TKCategory.h" + +@interface TKKeyboardTableViewController () +@property (nonatomic,assign) BOOL scrollLock; +@property (nonatomic,assign) CGRect keyboardRect; +@end + +@implementation TKKeyboardTableViewController + +- (instancetype) init{ + if(!(self=[super init])) return nil; + self.scrollToTextField = YES; + self.hideKeyboardOnScroll = [UIDevice phoneIdiom]; + return self; +} +- (instancetype) initWithStyle:(UITableViewStyle)style{ + if(!(self=[super initWithStyle:style])) return nil; + self.scrollToTextField = YES; + self.hideKeyboardOnScroll = [UIDevice phoneIdiom]; + return self; +} +- (void) dealloc{ + self.tableView.delegate = nil; + self.tableView.dataSource = nil; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark View Lifecycle +- (void) viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil]; +} +- (void) viewDidDisappear:(BOOL)animated{ + [super viewDidDisappear:animated]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil]; +} + +#pragma mark Move ScrollView +- (void) keyboardWillAppear:(NSNotification*)sender{ + if(!self.isViewLoaded || self.view.superview == nil) return; + + self.scrollLock = YES; + + self.keyboardRect = [sender.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; + + [self _updateInsetWithKeyboard]; + +} +- (void) keyboardWillDisappear:(NSNotification*)sender{ + self.keyboardRect = CGRectZero; + + if(!self.isViewLoaded || self.view.superview == nil) return; + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationBeginsFromCurrentState:YES]; + [UIView setAnimationCurve:UIViewAnimationCurveLinear]; + self.tableView.contentInset = UIEdgeInsetsMake(self.tableView.contentInset.top, 0, self.bottomLayoutGuide.length, 0); + [UIView commitAnimations]; + + self.tableView.scrollIndicatorInsets = self.tableView.contentInset; +} +- (void) textViewDidBeginEditing:(UITextView *)textView{ + if(!self.scrollToTextField) return; + self.scrollLock = YES; + [self performSelector:@selector(scrollToView:) withObject:textView afterDelay:0.1]; +} +- (void) textFieldDidBeginEditing:(UITextField *)textField{ + if(!self.scrollToTextField) return; + self.scrollLock = YES; + [self performSelector:@selector(scrollToView:) withObject:textField afterDelay:0.1]; +} +- (void) _updateInsetWithKeyboard{ + UIWindow *window = [UIApplication sharedApplication].windows[0]; + UIView *mainSubviewOfWindow = window.rootViewController.view; + CGRect keyboardFrameConverted = [mainSubviewOfWindow convertRect:self.keyboardRect fromView:window]; + CGRect rect = [self.view convertRect:keyboardFrameConverted fromView:mainSubviewOfWindow]; + rect = CGRectIntersection(rect, self.view.bounds); + + + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:0.05]; + [UIView setAnimationBeginsFromCurrentState:YES]; + [UIView setAnimationCurve:UIViewAnimationCurveLinear]; + self.tableView.contentInset = self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(self.tableView.contentInset.top, 0, CGRectGetHeight(rect), 0); + [UIView commitAnimations]; +} + +#pragma mark Rotations +- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ + [self _updateInsetWithKeyboard]; +} + + + +#pragma mark UIScrollView Delegate +- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView{ + if(self.hideKeyboardOnScroll && !self.scrollLock) + [self resignResponders]; +} +- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ + self.scrollLock = NO; +} +- (void) scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView{ + self.scrollLock = NO; +} +- (void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ + if(!decelerate) self.scrollLock = NO; +} +- (void) _unlock{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.scrollLock = NO; + }); +} + +#pragma mark Public Functions +- (void) scrollToView:(UIView*)view{ + + if([view isKindOfClass:[UITextView class]]){ + UITextView *textView = (UITextView*)view; + CGRect cursorPosition = [textView caretRectForPosition:textView.selectedTextRange.start]; + CGRect rect = [view convertRect:cursorPosition toView:self.tableView]; + rect = CGRectInset(rect, 0, -50); + [self.tableView scrollRectToVisible:rect animated:YES]; + [self performSelector:@selector(_unlock) withObject:nil afterDelay:0.35]; + return; + } + + CGRect rect = [view convertRect:view.bounds toView:self.tableView]; + rect = CGRectInset(rect, 0, -15); + [self.tableView scrollRectToVisible:rect animated:YES]; + [self performSelector:@selector(_unlock) withObject:nil afterDelay:0.35]; +} +- (void) resignResponders{ + +} + +@end \ No newline at end of file diff --git a/Tests/FoundationTests.h b/TapkuLibrary/TKLoadingView.h similarity index 84% rename from Tests/FoundationTests.h rename to TapkuLibrary/TKLoadingView.h index 1d33d477..22554d68 100644 --- a/Tests/FoundationTests.h +++ b/TapkuLibrary/TKLoadingView.h @@ -1,6 +1,6 @@ // -// FoundationTests.h -// Created by Devin Ross on 4/6/11. +// PopoverEmptyView.h +// Created by Devin on 4/13/13. // /* @@ -27,15 +27,17 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ -@import Foundation; @import UIKit; -@import XCTest; -#import "NSDate+TKCategory.h" -@interface FoundationTests : XCTestCase -- (void) testShouldCreateExpectedDate; + +@interface TKLoadingView : UIView + +@property (nonatomic,strong) UILabel *loadingLabel; + +- (void) startAnimating; +- (void) stopAnimating; @end \ No newline at end of file diff --git a/TapkuLibrary/TKLoadingView.m b/TapkuLibrary/TKLoadingView.m new file mode 100644 index 00000000..3d545c0a --- /dev/null +++ b/TapkuLibrary/TKLoadingView.m @@ -0,0 +1,114 @@ +// +// PopoverEmptyView.m +// Created by Devin on 4/13/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKLoadingView.h" + +@implementation TKLoadingView + + +- (instancetype) initWithFrame:(CGRect)frame{ + if(!(self=[super initWithFrame:frame])) return nil; + + + self.loadingLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.loadingLabel.backgroundColor = [UIColor clearColor]; + self.loadingLabel.text = [NSString stringWithFormat:@"%@...",NSLocalizedString(@"Loading", @"Loading")]; + self.loadingLabel.font = [UIFont boldSystemFontOfSize:16]; + [self.loadingLabel sizeToFit]; + self.loadingLabel.center = CGPointMake(CGRectGetWidth(frame)/2.0, CGRectGetHeight(frame)/2.0); + self.loadingLabel.frame = CGRectIntegral(self.loadingLabel.frame); + [self addSubview:self.loadingLabel]; + self.loadingLabel.hidden = YES; + + return self; +} + + +- (void) layoutSubviews{ + [super layoutSubviews]; + NSString *str = [NSString stringWithFormat:@"%@...",NSLocalizedString(@"Loading", @"Loading")]; + CGSize size = [str sizeWithFont:self.loadingLabel.font]; + CGFloat wid = CGRectGetWidth(self.frame), hei = CGRectGetHeight(self.frame); + NSInteger x = (wid-size.width) / 2, y = (hei-size.height) / 2; + CGRect frame = CGRectMake(x, y, size.width, size.height); + self.loadingLabel.frame = frame; +} + + +#define DELAY 0.25 + + +- (void) startAnimating{ + self.loadingLabel.hidden = NO; + self.loadingLabel.text = [NSString stringWithFormat:@"%@...",NSLocalizedString(@"Loading", @"Loading")]; + if(!self.window) return; + + [self.loadingLabel sizeToFit]; + self.loadingLabel.center = CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetHeight(self.frame)/2.0); + self.loadingLabel.frame = CGRectIntegral(self.loadingLabel.frame); + + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_next) object:nil]; + [self performSelector:@selector(_next) withObject:nil afterDelay:DELAY]; +} +- (void) stopAnimating{ + self.loadingLabel.hidden = YES; + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_next) object:nil]; +} + +- (void) didMoveToWindow{ + if(self.loadingLabel.hidden) return; + + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_next) object:nil]; + [self performSelector:@selector(_next) withObject:nil afterDelay:DELAY]; +} + + +- (void) _next{ + if(!self.loadingLabel.superview) return; + + NSString *str = self.loadingLabel.text; + + if([str hasSuffix:@"..."]) + str = NSLocalizedString(@"Loading", @"Loading"); + else + str = [str stringByAppendingString:@"."]; + + + self.loadingLabel.text = str; + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_next) object:nil]; + [self performSelector:@selector(_next) withObject:nil afterDelay:DELAY]; + + +} + + + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKMultiSwitch.h b/TapkuLibrary/TKMultiSwitch.h new file mode 100644 index 00000000..a057bd17 --- /dev/null +++ b/TapkuLibrary/TKMultiSwitch.h @@ -0,0 +1,80 @@ +// +// TKMultiSwitch.h +// Created by Devin Ross on 6/27/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +typedef NS_ENUM(NSInteger, TKMultiSwitchStyle) { + TKMultiSwitchStyleHollow, + TKMultiSwitchStyleFilled +} ; + +/** `TKMultiSwitch` a slide control with multiple options. Sort of like a `UISwitch` mixed with a `UISegmentControl`. */ +@interface TKMultiSwitch : UIControl + +/** + Initialize a `TKMultiSwitch` instance. + @param items The items in the switch view. + @return A `TKMultiSwitch` object. + */ +- (instancetype) initWithItems:(NSArray*)items NS_DESIGNATED_INITIALIZER; + +/** The index of the selected item. */ +@property (nonatomic,assign) NSInteger indexOfSelectedItem; + +/** The select padding. */ +@property (nonatomic,assign) CGFloat selectionInset; + +/** The font used. */ +@property (nonatomic,strong) UIFont *font; + +/** Choose between a hollow or filled selection indicator. */ +@property (nonatomic,assign) TKMultiSwitchStyle style; + +/** If the style is a filled selection, then this will be used for the current select label. */ +@property (nonatomic,strong) UIColor *selectedTextColor; + +/** If the style is a filled selection, then this will be used for the current unselected labels. */ +@property (nonatomic,strong) UIColor *textColor; + + +/** + Select an item manually. + @param index The index of the item. + @param animated Animate the selection of the item. + */ +- (void) selectItemAtIndex:(NSInteger)index animated:(BOOL)animated; + + +@property (nonatomic,strong) UIPanGestureRecognizer *panGesture; +@property (nonatomic,strong) UILongPressGestureRecognizer *longPressGesture; +@property (nonatomic,strong) UITapGestureRecognizer *tapGesture; + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKMultiSwitch.m b/TapkuLibrary/TKMultiSwitch.m new file mode 100644 index 00000000..a3fc7ec8 --- /dev/null +++ b/TapkuLibrary/TKMultiSwitch.m @@ -0,0 +1,442 @@ +// +// TKMultiSwitch.m +// Created by Devin Ross on 6/27/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKMultiSwitch.h" +#import "UIGestureRecognizer+TKCategory.h" +#import "TKGlobal.h" + +@interface TKMultiSwitch () + +@property (nonatomic,strong) UIView *selectionView; +@property (nonatomic,strong) NSArray *labels; +@property (nonatomic,assign) CGFloat offsetFromCenter; +@property (nonatomic,assign) BOOL needsReadjustment; + + +@end + +@implementation TKMultiSwitch + +#define UNSELECTED_ALPHA 0.5 + +#define UP_SCALE (CGRectGetHeight(self.frame) / (CGRectGetHeight(self.frame) - self.selectionInset*2)) +#define SCALE_UP CGScale(UP_SCALE, UP_SCALE) + +- (instancetype) init{ + self = [self initWithItems:@[@""]]; + return self; +} +- (instancetype) initWithFrame:(CGRect)frame{ + self = [self initWithItems:@[@""]]; + return self; +} +- (instancetype) initWithItems:(NSArray*)items{ + CGFloat height = 40; + if(!(self=[super initWithFrame:CGRectMake(10, 6, 320-20, height)])) return nil; + + _style = TKMultiSwitchStyleHollow; + + self.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1]; + self.clipsToBounds = NO; + self.layer.cornerRadius = CGRectGetHeight(self.frame)/2; + + self.selectionInset = 3; + + CGFloat per = CGRectGetWidth(self.frame) / items.count; + self.selectionView = [[UIView alloc] initWithFrame:CGRectInset(CGRectMake(0, 0, per, height), self.selectionInset, self.selectionInset)]; + self.selectionView.layer.borderColor = self.tintColor.CGColor; + self.selectionView.layer.cornerRadius = CGRectGetHeight(self.selectionView.frame) / 2; + self.selectionView.layer.borderWidth = 1; + self.selectionView.userInteractionEnabled = NO; + [self addSubview:self.selectionView]; + + _font = [UIFont systemFontOfSize:12]; + + NSInteger i = 0; + NSMutableArray *labels = [NSMutableArray arrayWithCapacity:items.count]; + for(NSString *txt in items){ + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(per * i, 0, per, height)]; + label.font = self.font; + label.text = txt; + label.textAlignment = NSTextAlignmentCenter; + label.textColor = self.tintColor; + label.alpha = i == 0 ? 1 : UNSELECTED_ALPHA; + [self addSubview:label]; + [labels addObject:label]; + i++; + } + self.labels = labels.copy; + + self.multipleTouchEnabled = NO; + + self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; + self.panGesture.delegate = self; + [self addGestureRecognizer:self.panGesture]; + + self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; + self.tapGesture.delegate = self; + [self addGestureRecognizer:self.tapGesture]; + + self.longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longtap:)]; + self.longPressGesture.minimumPressDuration = 0.25; + self.longPressGesture.delegate = self; + [self addGestureRecognizer:self.longPressGesture]; + + self.offsetFromCenter = -1; + _indexOfSelectedItem = 0; + + return self; +} + + + +- (void) layoutSubviews{ + [super layoutSubviews]; + [self readjustLayout]; +} + +- (void) setFrame:(CGRect)frame{ + [super setFrame:frame]; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} + + + + +- (void) readjustLayout{ + + if(!self.needsReadjustment) return; + + self.needsReadjustment = NO; + + CGFloat height = CGRectGetHeight(self.frame); + self.layer.cornerRadius = height/2; + + CGFloat per = (CGRectGetWidth(self.frame)) / self.labels.count; + self.selectionView.frame = CGRectInset(CGRectMake(0, 0, per, height), self.selectionInset, self.selectionInset); + + + if(self.style == TKMultiSwitchStyleHollow) { + self.selectionView.layer.borderColor = self.tintColor.CGColor; + self.selectionView.layer.cornerRadius = CGRectGetHeight(self.selectionView.frame) / 2; + self.selectionView.layer.borderWidth = 1; + self.selectionView.backgroundColor = [UIColor clearColor]; + }else{ + self.selectionView.layer.borderColor = self.tintColor.CGColor; + self.selectionView.layer.cornerRadius = CGRectGetHeight(self.selectionView.frame) / 2; + self.selectionView.layer.borderWidth = 0; + self.selectionView.backgroundColor = self.tintColor; + } + + + [self addSubview:self.selectionView]; + [self sendSubviewToBack:self.selectionView]; + + NSInteger i = 0; + for(UILabel *label in self.labels){ + label.frame = CGRectMake(per * i , 0, per, CGFrameGetHeight(self)); + label.font = self.font; + + + if(self.style == TKMultiSwitchStyleFilled){ + label.textColor = i == _indexOfSelectedItem ? self.selectedTextColor : self.textColor; + label.alpha = 1; + }else{ + label.alpha = i == _indexOfSelectedItem ? 1 : UNSELECTED_ALPHA; + } + + + i++; + } + + CGFloat x = [self.labels[_indexOfSelectedItem] center].x; + self.selectionView.center = CGPointMake( x, CGFrameGetHeight(self)/2); + +} +- (void) tintColorDidChange{ + [super tintColorDidChange]; + for(UILabel *label in self.labels) + label.textColor = self.tintColor; + self.selectionView.layer.borderColor = self.tintColor.CGColor; + [self readjustLayout]; +} + +#pragma mark UIGesture Actions +- (void) longtap:(UILongPressGestureRecognizer*)press{ + + CGPoint point = [press locationInView:self]; + CGFloat per = CGRectGetWidth(self.frame) / self.labels.count; + NSInteger index = point.x / per; + + if(press.began){ + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationBeginsFromCurrentState:YES]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + self.selectionView.transform = SCALE_UP; + + if(index != _indexOfSelectedItem){ + + CGFloat x = point.x; + x = MIN(CGRectGetWidth(self.frame)-(CGRectGetWidth(self.selectionView.frame)/2),x); + x = MAX(CGRectGetWidth(self.selectionView.frame)/2,x); + + self.selectionView.center = CGPointMake( x, self.selectionView.center.y); + self.offsetFromCenter = 0; + + NSInteger i = 0; + + + + + + for(UILabel *label in self.labels){ + + + if(self.style == TKMultiSwitchStyleFilled){ + [UIView transitionWithView:label duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionBeginFromCurrentState animations:^{ + label.textColor = i == index ? self.selectedTextColor : self.textColor; + label.alpha = 1; + } completion:nil]; + + }else{ + label.alpha = i == index ? 1 : UNSELECTED_ALPHA; + + } + + i++; + } + }else{ + + CGFloat x = point.x; + x = MIN(CGRectGetWidth(self.frame)-(CGRectGetWidth(self.selectionView.frame)/2),x); + x = MAX(CGRectGetWidth(self.selectionView.frame)/2,x); + self.selectionView.center = CGPointMake( x, self.selectionView.center.y); + + } + [UIView commitAnimations]; + + + }else if(press.ended || press.cancelled){ + + CGFloat per = CGRectGetWidth(self.frame) / self.labels.count; + NSInteger index = self.selectionView.center.x / per; + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationBeginsFromCurrentState:YES]; + self.selectionView.transform = CGAffineTransformIdentity; + [UIView commitAnimations]; + + [UIView beginAnimations:nil context:nil]; + self.selectionView.transform = CGAffineTransformIdentity; + self.selectionView.center = CGPointMake( self.selectionInset + per * index + CGRectGetWidth(self.selectionView.frame)/2, self.selectionView.center.y); + [UIView commitAnimations]; + + self.offsetFromCenter = -1; + + if(_indexOfSelectedItem == index) return; + _indexOfSelectedItem = index; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + + } +} +- (void) pan:(UIPanGestureRecognizer*)pan{ + + CGPoint p = [pan locationInView:self]; + if(pan.began){ + if(self.offsetFromCenter == -1) + self.offsetFromCenter = p.x - self.selectionView.center.x; + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + self.selectionView.transform = SCALE_UP; + [UIView commitAnimations]; + + } + + CGFloat per = CGRectGetWidth(self.frame) / self.labels.count; + NSInteger index = self.selectionView.center.x / per; + + if(pan.changed){ + + CGFloat x = p.x - self.offsetFromCenter; + x = MIN(CGRectGetWidth(self.frame)-(CGRectGetWidth(self.selectionView.frame)/2),x); + x = MAX(CGRectGetWidth(self.selectionView.frame)/2,x); + + [UIView beginAnimations:nil context:nil]; + self.selectionView.center = CGPointMake( x, self.selectionView.center.y); + [UIView commitAnimations]; + + [UIView beginAnimations:nil context:nil]; + NSInteger i = 0; + for(UILabel *label in self.labels){ + if(self.style == TKMultiSwitchStyleFilled){ + [UIView transitionWithView:label duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + label.textColor = i == index ? self.selectedTextColor : self.textColor; + label.alpha = 1; + } completion:nil]; + + }else{ + label.alpha = i == index ? 1 : UNSELECTED_ALPHA; + } + i++; + } + [UIView commitAnimations]; + } + + if(pan.ended || pan.cancelled){ + + [UIView beginAnimations:nil context:nil]; + self.selectionView.transform = CGAffineTransformIdentity; + self.selectionView.center = CGPointMake( self.selectionInset + per * index + CGRectGetWidth(self.selectionView.frame)/2, self.selectionView.center.y); + [UIView commitAnimations]; + + self.offsetFromCenter = -1; + + if(_indexOfSelectedItem == index) return; + _indexOfSelectedItem = index; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + + } + + +} +- (void) tap:(UITapGestureRecognizer*)tap{ + + CGPoint point = [tap locationInView:self]; + CGFloat per = CGRectGetWidth(self.frame) / self.labels.count; + NSInteger index = point.x / per; + self.offsetFromCenter = -1; + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationBeginsFromCurrentState:YES]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + self.selectionView.transform = CGAffineTransformIdentity; + self.selectionView.center = CGPointMake( self.selectionInset + per * index + CGRectGetWidth(self.selectionView.frame)/2, self.selectionView.center.y); + NSInteger i = 0; + for(UILabel *label in self.labels){ + + if(self.style == TKMultiSwitchStyleFilled){ + [UIView transitionWithView:label duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionBeginFromCurrentState animations:^{ + label.textColor = i == index ? self.selectedTextColor : self.textColor; + label.alpha = 1; + } completion:nil]; + }else{ + label.alpha = i == index ? 1 : UNSELECTED_ALPHA; + } + i++; + } + [UIView commitAnimations]; + + if(index == _indexOfSelectedItem) return; + _indexOfSelectedItem = index; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + +} +- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{ + if(self.longPressGesture == gestureRecognizer && self.panGesture == otherGestureRecognizer) + return YES; + if([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] || [otherGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) + return NO; + if(gestureRecognizer == self.panGesture || [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) + return NO; + return YES; +} + +#pragma mark Public Properties +- (void) setIndexOfSelectedItem:(NSInteger)indexOfSelectedItem{ + [self selectItemAtIndex:indexOfSelectedItem animated:NO]; +} +- (void) selectItemAtIndex:(NSInteger)index animated:(BOOL)animated{ + + CGFloat per = CGRectGetWidth(self.frame) / self.labels.count; + self.offsetFromCenter = -1; + if(index == _indexOfSelectedItem) return; + + + if(animated) [UIView beginAnimations:nil context:nil]; + self.selectionView.transform = CGAffineTransformIdentity; + self.selectionView.center = CGPointMake( self.selectionInset + per * index + CGRectGetWidth(self.selectionView.frame)/2, self.selectionView.center.y); + + NSInteger i = 0; + for(UILabel *label in self.labels){ + + + if(self.style == TKMultiSwitchStyleFilled){ + + [UIView transitionWithView:label duration:animated ? 0.3 : 0 options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionBeginFromCurrentState animations:^{ + label.textColor = i == index ? self.selectedTextColor : self.textColor; + label.alpha = 1; + } completion:nil]; + }else{ + label.alpha = i == index ? 1 : UNSELECTED_ALPHA; + + } + + + i++; + } + if(animated) [UIView commitAnimations]; + _indexOfSelectedItem = index; + +} + +- (void) setStyle:(TKMultiSwitchStyle)style{ + _style = style; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} + +- (void) setSelectionInset:(CGFloat)selectionInset{ + _selectionInset = selectionInset; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} + +- (void) setSelectedTextColor:(UIColor *)selectedTextColor{ + _selectedTextColor = selectedTextColor; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} +- (void) setTextColor:(UIColor *)textColor{ + _textColor = textColor; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} + +- (void) setFont:(UIFont *)font{ + _font = font; + self.needsReadjustment = YES; + [self setNeedsLayout]; +} + + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKNumberInputView.h b/TapkuLibrary/TKNumberInputView.h new file mode 100644 index 00000000..10e7a949 --- /dev/null +++ b/TapkuLibrary/TKNumberInputView.h @@ -0,0 +1,86 @@ +// +// TKNumberInputView.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKInputView.h" +@class TKInputKey; + +/** `TKNumberInputView` is subclass `TKInputView` with a number pad. */ +@interface TKNumberInputView : TKInputView + +/** Initializes an number pad input view. + + @param frame The frame of the `UIView`. + @param keys The keys included on the view. + @param padFrame The frame of the number pad. + @return An initialized `TKInputView` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys keypadFrame:(CGRect)padFrame; + +///---------------------------- +/// @name Properties +///---------------------------- + +/** One key. */ +@property (nonatomic,strong) TKInputKey *oneKey; + +/** Two key. */ +@property (nonatomic,strong) TKInputKey *twoKey; + +/** Three key. */ +@property (nonatomic,strong) TKInputKey *threeKey; + +/** Four key. */ +@property (nonatomic,strong) TKInputKey *fourKey; + +/** Five key. */ +@property (nonatomic,strong) TKInputKey *fiveKey; + +/** Six key. */ +@property (nonatomic,strong) TKInputKey *sixKey; + +/** Seven key. */ +@property (nonatomic,strong) TKInputKey *sevenKey; + +/** Eight key. */ +@property (nonatomic,strong) TKInputKey *eightKey; + +/** Nine key. */ +@property (nonatomic,strong) TKInputKey *nineKey; + +/** Zero key. */ +@property (nonatomic,strong) TKInputKey *zeroKey; + +/** Zero key. + @return An array of all the number keys. + */ +@property (nonatomic, readonly, copy) NSArray *keypadKeys; + +@end diff --git a/TapkuLibrary/TKNumberInputView.m b/TapkuLibrary/TKNumberInputView.m new file mode 100644 index 00000000..aa093396 --- /dev/null +++ b/TapkuLibrary/TKNumberInputView.m @@ -0,0 +1,101 @@ +// +// TKNumberInputView.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKNumberInputView.h" +#import "UIDevice+TKCategory.h" +#import "TKInputKey.h" +#import "TKGlobal.h" + +@implementation TKNumberInputView + +#define RECT(_X,_Y,_S) CGRectMakeWithSize(_X,_Y,_S) + + + +- (instancetype) initWithFrame:(CGRect)frame withKeysModels:(NSArray*)keys keypadFrame:(CGRect)padFrame{ + frame.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIDevice phoneIdiom] ? 216 : 352); + + CGFloat w = padFrame.size.width / 3; + CGFloat h = padFrame.size.height / 4; + CGFloat pad = 0, xPad = 0, marginX = 0; + + + if([UIDevice padIdiom]){ + w = 108, h = 75, pad = 10, xPad = 16, marginX = 24; + } + + + CGSize s = CGSizeMake(w,h); + + self.oneKey = [TKInputKey keyWithFrame:RECT( marginX, pad, s) symbol:@"1" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.twoKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, pad, s) symbol:@"2" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.threeKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, pad, s) symbol:@"3" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.fourKey = [TKInputKey keyWithFrame:RECT( marginX, h+pad*2, s) symbol:@"4" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.fiveKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, h+pad*2, s) symbol:@"5" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.sixKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, h+pad*2, s) symbol:@"6" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.sevenKey = [TKInputKey keyWithFrame:RECT( marginX, h*2+pad*3, s) symbol:@"7" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.eightKey = [TKInputKey keyWithFrame:RECT( marginX+w+xPad, h*2+pad*3, s) symbol:@"8" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.nineKey = [TKInputKey keyWithFrame:RECT( marginX+w*2+xPad*2, h*2+pad*3, s) symbol:@"9" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + self.zeroKey = [TKInputKey keyWithFrame:CGRectMake( marginX, h*3+pad*4, w*3+xPad*2,h) symbol:@"0" normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:YES]; + + NSMutableArray *ar = [NSMutableArray arrayWithArray:self.keypadKeys]; + [ar addObjectsFromArray:keys]; + + + if(!(self=[super initWithFrame:frame withKeysModels:ar])) return nil; + + return self; +} +- (NSArray*) keypadKeys{ + return @[self.oneKey,self.twoKey,self.threeKey,self.fourKey,self.fiveKey,self.sixKey,self.sevenKey,self.eightKey,self.nineKey,self.zeroKey]; +} +- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + + if(self.selectedKey && [self.keypadKeys containsObject:self.selectedKey]){ + + BOOL insert = YES; + + if(self.textField.delegate) + insert = [self.textField.delegate textField:self.textField shouldChangeCharactersInRange:NSMakeRange(self.textField.text.length, 0) replacementString:self.selectedKey.label.text]; + + if(insert) + [self.textField insertText:self.selectedKey.label.text]; + + [super touchesCancelled:touches withEvent:event]; + return; + } + + [super touchesEnded:touches withEvent:event]; + +} + + +@end diff --git a/TapkuLibrary/TKNumberInputWithNextKeyView.h b/TapkuLibrary/TKNumberInputWithNextKeyView.h new file mode 100644 index 00000000..48e5cf9a --- /dev/null +++ b/TapkuLibrary/TKNumberInputWithNextKeyView.h @@ -0,0 +1,43 @@ +// +// TKNumberInputWithNextKeyView.h +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKNumberInputView.h" + +/** `TKNumberInputWithNextKeyView` is subclass `TKNumberInputView` with a next key. */ +@interface TKNumberInputWithNextKeyView : TKNumberInputView + +///---------------------------- +/// @name Properties +///---------------------------- +/** The next key. */ +@property (nonatomic,strong) TKInputKey *nextKey; + +@end diff --git a/TapkuLibrary/TKNumberInputWithNextKeyView.m b/TapkuLibrary/TKNumberInputWithNextKeyView.m new file mode 100644 index 00000000..f912d56e --- /dev/null +++ b/TapkuLibrary/TKNumberInputWithNextKeyView.m @@ -0,0 +1,60 @@ +// +// TKNumberInputWithNextKeyView.m +// Created by Devin Ross on 3/21/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKNumberInputWithNextKeyView.h" +#import "UIDevice+TKCategory.h" +#import "TKInputKey.h" +#import "TKGlobal.h" +#import "UIImage+TKCategory.h" + +@implementation TKNumberInputWithNextKeyView + +- (instancetype) initWithFrame:(CGRect)frame{ + frame.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIDevice phoneIdiom] ? 216 : 352); + + CGFloat yPad = 0, xPad = 0, xMargin = 0; + CGFloat w = frame.size.width / 4; + CGFloat h = frame.size.height / 4; + + if([UIDevice padIdiom]){ + w = 108, h = 75, yPad = 10, xPad = 16, xMargin = 28; + } + + self.nextKey = [[TKInputKey alloc] initWithFrame:CGRectMake(xMargin+w*3 + (xPad*3), yPad, w+1, h*2+yPad) symbol:[UIImage imageNamedTK:@"keyboard/next-key"] normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:NO]; + self.backspaceKey = [[TKInputKey alloc] initWithFrame:CGRectMake(xMargin+w*3+ (xPad*3), h*2+yPad*3, w+1, h*2+yPad) symbol:[UIImage imageNamedTK:@"keyboard/backspace-key"] normalType:TKInputKeyTypeDefault selectedType:TKInputKeyTypeDark runner:NO]; + + CGRect pad = CGRectMake(0, 0, w*3, h*4); + + if(!(self=[super initWithFrame:frame withKeysModels:@[self.nextKey,self.backspaceKey] keypadFrame:pad])) return nil; + return self; +} + +@end diff --git a/TapkuLibrary/TKPegSlider.h b/TapkuLibrary/TKPegSlider.h new file mode 100644 index 00000000..4784abda --- /dev/null +++ b/TapkuLibrary/TKPegSlider.h @@ -0,0 +1,56 @@ +// +// TKPegSlider.h +// Created by Devin Ross on 6/30/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** `TKPegSlider` a slider control with set points. */ +@interface TKPegSlider : UIControl + +/** The index of the selected item. */ +@property (nonatomic,assign) NSInteger selectedPegIndex; + +/** The index of the selected item. */ +@property (nonatomic,assign) NSUInteger numberOfPegs; + +/** The left side image. */ +@property (nonatomic,strong) UIImage *leftEndImage; + +/** The right side image. */ +@property (nonatomic,strong) UIImage *rightEndImage; + +/** + Select an item manually. + @param index The index of the item. + @param animated Animate the selection of the item. + */ +- (void) selectPegAtIndex:(NSInteger)index animated:(BOOL)animated; + +@end diff --git a/TapkuLibrary/TKPegSlider.m b/TapkuLibrary/TKPegSlider.m new file mode 100644 index 00000000..72708ed7 --- /dev/null +++ b/TapkuLibrary/TKPegSlider.m @@ -0,0 +1,214 @@ +// +// TKPegSlider.m +// Created by Devin Ross on 6/30/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKPegSlider.h" +#import "TKGlobal.h" + +#define SCALE_DOWN CGScale(0.18,0.18) +#define OFF_PEG_ALPHA 0.5f + +@interface TKPegSlider () + +@property (nonatomic,strong) NSArray *pegs; +@property (nonatomic,strong) UIImageView *leftImageView; +@property (nonatomic,strong) UIImageView *rightImageView; + +@end + + +@implementation TKPegSlider + +- (instancetype) init{ + self = [self initWithFrame:CGRectZero]; + return self; +} +- (instancetype) initWithFrame:(CGRect)frame{ + frame.size = CGSizeMake(300, 40); + if(!(self=[super initWithFrame:frame])) return nil; + self.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1]; + self.clipsToBounds = NO; + self.layer.cornerRadius = CGRectGetHeight(self.frame)/2; + + self.leftImageView = [[UIImageView alloc] initWithFrame:CGRectInset(CGRectMake(0, 0, 40, 40), 6, 6)]; + [self addSubview:self.leftImageView]; + + self.rightImageView = [[UIImageView alloc] initWithFrame:CGRectInset(CGRectMake(CGRectGetWidth(self.frame)-40, 0, 40, 40), 6, 6)]; + [self addSubview:self.rightImageView]; + + _numberOfPegs = 3; + _selectedPegIndex = 0; + [self _setupPegs]; + + UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; + [self addGestureRecognizer:pan]; + + return self; +} + + + + +- (void) _setupPegs{ + NSMutableArray *pegReserves = [NSMutableArray array]; + [pegReserves addObjectsFromArray:self.pegs]; + [self.pegs makeObjectsPerformSelector:@selector(removeFromSuperview)]; + + if(_numberOfPegs == 0) return; + + CGFloat leftPad = 16 + (self.leftImageView.image ? 40 : 3); + CGFloat rightPad = 16 + (self.rightImageView.image ? 40 : 3); + CGFloat per = (CGRectGetWidth(self.frame)-leftPad-rightPad) / (_numberOfPegs-1); + + NSMutableArray *pegs = [NSMutableArray arrayWithCapacity:_numberOfPegs]; + + for(NSInteger i = 0; i < _numberOfPegs; i++){ + + UIView *peg; + if(pegReserves.count > 0){ + peg = [pegReserves lastObject]; + [pegReserves removeLastObject]; + }else{ + peg = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 24, 24)]; + peg.layer.cornerRadius = CGRectGetHeight(peg.frame)/2; + } + + peg.backgroundColor = self.tintColor; + peg.tag = i; + peg.alpha = _selectedPegIndex == i ? 1 : OFF_PEG_ALPHA; + peg.transform = _selectedPegIndex == i ? CGAffineTransformIdentity : SCALE_DOWN; + + CGFloat x = leftPad + per * i; + peg.center = CGPointMake(x, CGRectGetHeight(self.frame)/2); + [pegs addObject:peg]; + [self addSubview:peg]; + + } + + self.pegs = pegs.copy; + +} +- (void) tintColorDidChange{ + [super tintColorDidChange]; + [self _setupPegs]; + self.leftImageView.tintColor = self.rightImageView.tintColor = self.tintColor; + +} + +- (NSInteger) _indexOfSelectAtPoint:(CGFloat)point{ + CGFloat leftPad = 16 + (self.leftImageView.image ? 40 : 3); + CGFloat rightPad = 16 + (self.rightImageView.image ? 40 : 3); + CGFloat per = (CGRectGetWidth(self.frame)-leftPad-rightPad) / (_numberOfPegs-1); + NSInteger index = (point+(per/2)-leftPad) / per; + index = MAX(0,index); + return MAX(0,MIN(_numberOfPegs-1,index)); +} +- (void) pan:(UIPanGestureRecognizer*)gesture{ + CGPoint p = [gesture locationInView:self]; + NSInteger index = [self _indexOfSelectAtPoint:p.x]; + + [UIView beginAnimations:nil context:nil]; + NSInteger i = 0; + for(UIView *peg in self.pegs){ + peg.alpha = i == index ? 1 : OFF_PEG_ALPHA; + peg.transform = i == index ? CGAffineTransformIdentity : SCALE_DOWN; + i++; + } + [UIView commitAnimations]; + + if(index!= _selectedPegIndex){ + _selectedPegIndex = index; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + } +} +- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [super touchesBegan:touches withEvent:event]; + + UITouch *touch = [touches anyObject]; + + CGPoint p = [touch locationInView:self]; + NSInteger index = [self _indexOfSelectAtPoint:p.x]; + + [UIView beginAnimations:nil context:nil]; + NSInteger i = 0; + for(UIView *peg in self.pegs){ + peg.alpha = i == index ? 1 : OFF_PEG_ALPHA; + peg.transform = i == index ? CGAffineTransformIdentity : SCALE_DOWN; + i++; + } + [UIView commitAnimations]; + + if(index!= _selectedPegIndex){ + _selectedPegIndex = index; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + } + +} + + +#pragma mark Properties +- (void) setNumberOfPegs:(NSUInteger)numberOfPegs{ + _numberOfPegs = numberOfPegs; + if(_selectedPegIndex >= numberOfPegs) + _selectedPegIndex = numberOfPegs - 1; + [self _setupPegs]; +} +- (void) setSelectedPegIndex:(NSInteger)selectedPegIndex{ + [self selectPegAtIndex:selectedPegIndex animated:NO]; +} +- (void) selectPegAtIndex:(NSInteger)index animated:(BOOL)animated{ + _selectedPegIndex = index; + + if(animated) [UIView beginAnimations:nil context:nil]; + NSInteger i = 0; + for(UIView *peg in self.pegs){ + peg.alpha = i == index ? 1 : OFF_PEG_ALPHA; + peg.transform = i == index ? SCALE_DOWN : CGAffineTransformIdentity; + i++; + } + if(animated) [UIView commitAnimations]; + +} +- (void) setLeftEndImage:(UIImage *)leftEndImage{ + self.leftImageView.image = [leftEndImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [self _setupPegs]; +} +- (void) setRightEndImage:(UIImage *)rightEndImage{ + self.rightImageView.image = [rightEndImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [self _setupPegs]; +} +- (UIImage*) leftEndImage{ + return self.leftImageView.image; +} +- (UIImage*) rightEndImage{ + return self.rightImageView.image; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKProgressAlertView.m b/TapkuLibrary/TKProgressAlertView.m index 783e0198..075f3d62 100644 --- a/TapkuLibrary/TKProgressAlertView.m +++ b/TapkuLibrary/TKProgressAlertView.m @@ -30,6 +30,7 @@ */ #import "TKProgressAlertView.h" +#import "UIView+TKCategory.h" #import "TKGlobal.h" @implementation TKProgressAlertView diff --git a/TapkuLibrary/TKReorderTableView.m b/TapkuLibrary/TKReorderTableView.m index 087706ed..68d3fa14 100755 --- a/TapkuLibrary/TKReorderTableView.m +++ b/TapkuLibrary/TKReorderTableView.m @@ -34,6 +34,7 @@ Portions Copyright (c) 2013 Ben Vogelzang. #import "TKReorderTableView.h" +#import "UIGestureRecognizer+TKCategory.h" @interface TKReorderTableView () diff --git a/TapkuLibrary/TKShapeView.h b/TapkuLibrary/TKShapeView.h new file mode 100644 index 00000000..adbaf4ec --- /dev/null +++ b/TapkuLibrary/TKShapeView.h @@ -0,0 +1,42 @@ +// +// TKShapeView.h +// Created by Devin Ross on 6/24/12. +// +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +@import UIKit; +@import QuartzCore; + +/** This class implements `UIView` backed by a `CAShapeLayer`. */ +@interface TKShapeView : UIView + +/** The path defining the shape of the view. */ +@property CGPathRef path; + +@end diff --git a/TapkuLibrary/TKShapeView.m b/TapkuLibrary/TKShapeView.m new file mode 100644 index 00000000..eea5fcd1 --- /dev/null +++ b/TapkuLibrary/TKShapeView.m @@ -0,0 +1,53 @@ +// +// TKShapeView.m +// Created by Devin on 6/24/12. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#import "TKShapeView.h" + +@implementation TKShapeView + + ++ (Class)layerClass { + return [CAShapeLayer class]; +} +- (CAShapeLayer *) _shapeLayer{ + return (CAShapeLayer *)self.layer; +} + + + +- (CGPathRef) path{ + return [self _shapeLayer].path; +} +- (void) setPath:(CGPathRef)path{ + [self _shapeLayer].path = path; +} + +@end diff --git a/TapkuLibrary/TKShimmerLabel.h b/TapkuLibrary/TKShimmerLabel.h new file mode 100644 index 00000000..2ba6a3d1 --- /dev/null +++ b/TapkuLibrary/TKShimmerLabel.h @@ -0,0 +1,52 @@ +// +// TKShimmerLabel.h +// Created by Devin Ross on 7/20/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** The direction of the shimmering on the label. */ +typedef NS_ENUM(NSInteger, TKShimmerLabelDirection) { + TKShimmerLabelDirectionLeftToRight, + TKShimmerLabelDirectionRightToLeft +} ; + +/** `TKShimmerLabel` is a subclassed `UILabel` with a shimmer animation similiar to the unlock screen. */ +@interface TKShimmerLabel : UILabel + +///---------------------------- +/// @name Properties +///---------------------------- +/** The gradient layer that masks the text label to create the shimmer effect. */ +@property (nonatomic,strong) CAGradientLayer *textHighlightLayer; + +/** The direction the shimmer should move. */ +@property (nonatomic,assign) TKShimmerLabelDirection direction; + +@end diff --git a/TapkuLibrary/TKShimmerLabel.m b/TapkuLibrary/TKShimmerLabel.m new file mode 100644 index 00000000..f41e7c4b --- /dev/null +++ b/TapkuLibrary/TKShimmerLabel.m @@ -0,0 +1,106 @@ +// +// TKShimmerLabel.m +// Created by Devin Ross on 7/20/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKShimmerLabel.h" + +@implementation TKShimmerLabel + +- (instancetype) initWithFrame:(CGRect)frame{ + if (!(self = [super initWithFrame:frame])) return nil; + + self.textAlignment = NSTextAlignmentCenter; + self.backgroundColor = [UIColor clearColor]; + _direction = TKShimmerLabelDirectionLeftToRight; + + id dark = (id)[UIColor colorWithWhite:1 alpha:0.40].CGColor; + id light = (id)[UIColor colorWithWhite:1 alpha:1.0f].CGColor; + + self.textHighlightLayer = [CAGradientLayer layer]; + self.textHighlightLayer.frame = CGRectInset(self.bounds, -400, 0); + self.textHighlightLayer.colors = @[dark,dark,light,dark,dark]; + self.textHighlightLayer.locations = @[@0,@0.46,@0.5,@0.54,@1]; + self.textHighlightLayer.startPoint = CGPointZero; + self.textHighlightLayer.endPoint = CGPointMake(1.0, 0); + self.layer.mask = self.textHighlightLayer; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationDidBecomeActive:) + name:UIApplicationDidBecomeActiveNotification object:nil]; + + return self; +} +- (void) dealloc{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark Private Animation Methods +- (NSNumber*) _animationStartPoint{ + CGFloat x = CGRectGetWidth(self.textHighlightLayer.frame)/2.0f; + if(self.direction == TKShimmerLabelDirectionLeftToRight) + return @(-x + CGRectGetWidth(self.frame)); + return @(x); +} +- (NSNumber*) _animationEndPoint{ + CGFloat x = CGRectGetWidth(self.textHighlightLayer.frame)/2.0f; + if(self.direction == TKShimmerLabelDirectionLeftToRight) + return @(x); + return @(-x + CGRectGetWidth(self.frame)); +} +- (void) _startShimmerAnimation{ + if(!self.superview) return; + + [self.textHighlightLayer removeAllAnimations]; + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.x"]; + animation.repeatCount = HUGE_VALF; + animation.toValue = [self _animationEndPoint]; + animation.fromValue = [self _animationStartPoint]; + animation.duration = 4.0f; + [self.textHighlightLayer addAnimation:animation forKey:@"position.x"]; +} + +#pragma mark Methods That Trigger The Animation To Start +- (void) applicationDidBecomeActive:(id)sender{ + + [self _startShimmerAnimation]; + +} +- (void) willMoveToWindow:(UIWindow *)newWindow{ + [self _startShimmerAnimation]; +} + +#pragma mark Properties +- (void) setDirection:(TKShimmerLabelDirection)direction{ + _direction = direction; + [self _startShimmerAnimation]; +} + + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKSlideToUnlockView.h b/TapkuLibrary/TKSlideToUnlockView.h new file mode 100644 index 00000000..b2f41c09 --- /dev/null +++ b/TapkuLibrary/TKSlideToUnlockView.h @@ -0,0 +1,71 @@ +// +// TKSlideToUnlockView.h +// Created by Devin Ross on 5/21/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; +@import AudioToolbox; +@class TKShimmerLabel; + +/** The mode that the slider to unlock view is in. */ +typedef NS_ENUM(NSInteger, TKSlideToUnlockViewMode) { + TKSlideToUnlockViewModeNormal = 0, + TKSlideToUnlockViewModeDisabled = 1 +} ; + +/** `TKSlideToUnlockView` is a control that allows users to slide to unlock like you would the lock screen. */ +@interface TKSlideToUnlockView : UIControl + +///---------------------------- +/// @name Properties +///---------------------------- +/** The shimmering text label that directs the user to act. */ +@property (nonatomic,strong) TKShimmerLabel *textLabel; + +/** The scroll view that the user slides */ +@property (nonatomic,strong) UIScrollView *scrollView; + +/** The view behind the scroll view */ +@property (nonatomic,strong) UIImageView *backgroundView; + +/** The arrow */ +@property (nonatomic,strong) UIImageView *arrowView; + +/** A read-only property to tell whether to tell the state of the view */ +@property (nonatomic,readonly) BOOL isUnlocked; + +/** The mode flag to enable of disable the view from acting. If disabled the device will vibrate. */ +@property (nonatomic,assign) TKSlideToUnlockViewMode mode; + +/** Reset the slider view to the original position. + @param animated If yes, the view will animate to a reset position. + */ +- (void) resetSlider:(BOOL)animated; + +@end diff --git a/TapkuLibrary/TKSlideToUnlockView.m b/TapkuLibrary/TKSlideToUnlockView.m new file mode 100644 index 00000000..b85eeaac --- /dev/null +++ b/TapkuLibrary/TKSlideToUnlockView.m @@ -0,0 +1,251 @@ +// +// TKSlideToUnlockView.m +// Created by Devin Ross on 5/21/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKSlideToUnlockView.h" +#import "UIImageView+TKCategory.h" +#import "UIImage+TKCategory.h" +#import "TKGlobal.h" +#import "UIGestureRecognizer+TKCategory.h" +#import "TKShimmerLabel.h" + + +@interface CustomScrollView : UIScrollView + +@end + +@implementation CustomScrollView + +- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [self.nextResponder touchesBegan:touches withEvent:event]; +} + +- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ + if(!self.dragging){ + [self.nextResponder touchesMoved:touches withEvent:event]; + } +} + +- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ + [self.nextResponder touchesCancelled:touches withEvent:event]; +} + +- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + [self.nextResponder touchesEnded:touches withEvent:event]; +} + +@end + + +#define TRACK_PADDING 4.0 +#define SLIDER_VIEW_WIDTH 82.0f +#define FADE_TEXT_OVER_LENGTH 50.0f + +@interface TKSlideToUnlockView () +@property (nonatomic,strong) UIColor *stashedBackgroundColor; +@end + +@implementation TKSlideToUnlockView + +#pragma mark Init & Friends +- (instancetype) init{ + CGRect frame = CGRectInset(CGRectMake(0, 15, CGRectGetWidth([UIScreen mainScreen].bounds), 62), 15, 0) ; + self = [self initWithFrame:frame]; + return self; +} +- (instancetype) initWithFrame:(CGRect)frame{ + frame.size.height = 62; + if(!(self=[super initWithFrame:frame])) return nil; + [self _setupView]; + return self; +} +- (instancetype) initWithCoder:(NSCoder *)aDecoder{ + if(!(self=[super initWithCoder:aDecoder])) return nil; + [self _setupView]; + return self; +} + +- (void) layoutSubviews { + [self _renderScreen]; +} +- (void) awakeFromNib{ + [self _setupView]; +} + + +#pragma mark Private Methods +- (void) _setupView{ + + self.mode = TKSlideToUnlockViewModeNormal; + self.backgroundView = [UIImageView imageViewWithFrame:self.bounds]; + self.backgroundView.layer.cornerRadius = 5; + self.backgroundView.clipsToBounds = YES; + self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleHeight; + [self addSubview:self.backgroundView]; + + self.scrollView = [[CustomScrollView alloc] initWithFrame:self.bounds]; + self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.scrollView.frame)*2, 0); + self.scrollView.backgroundColor = [UIColor colorWithRed:76/255. green:217/255. blue:100/255. alpha:0.7]; + self.scrollView.layer.cornerRadius = 5; + self.scrollView.pagingEnabled = YES; + self.scrollView.bounces = NO; + self.scrollView.showsHorizontalScrollIndicator = NO; + self.scrollView.delegate = self; + self.scrollView.delaysContentTouches = NO; + self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight; + + [self addSubview:self.scrollView]; + + self.scrollView.contentOffset = CGPointMake(CGRectGetWidth(self.scrollView.frame), 0); + + UIImage *arrow = [UIImage imageNamedTK:@"unlockslider/arrow"]; + self.arrowView = [[UIImageView alloc] initWithImage:arrow]; + self.arrowView.center = CGPointMake(CGRectGetWidth(self.scrollView.frame) + 25, CGRectGetHeight(self.scrollView.frame)/2.0f); + [self.scrollView addSubview:self.arrowView]; + + + CGRect textFrame = self.scrollView.bounds; + textFrame.origin.x = CGRectGetWidth(self.scrollView.frame); + textFrame = CGRectInset(textFrame, 40, 10); + + + self.textLabel = [[TKShimmerLabel alloc] initWithFrame:textFrame]; + self.textLabel.text = NSLocalizedString(@"slide to unlock", @"Slide to Unlock"); + self.textLabel.textColor = [UIColor whiteColor]; + self.textLabel.font = [UIFont systemFontOfSize:25]; + self.textLabel.userInteractionEnabled = NO; + self.textLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight; + + [self.scrollView addSubview:self.textLabel]; + +} +- (void) _renderScreen{ + self.alpha = 0; + + CGPoint p = [self convertPoint:self.superview.bounds.origin fromView:self.superview]; + + UIGraphicsBeginImageContextWithOptions(self.backgroundView.frame.size, NO, 0); + + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSaveGState(context); + CGContextTranslateCTM(context, p.x, p.y); + [self.superview.layer renderInContext:context]; + + UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); + CGContextRestoreGState(context); + UIGraphicsEndImageContext(); + + newImage = [newImage imageByApplyingBlurWithRadius:2 tintColor:nil saturationDeltaFactor:1 maskImage:nil]; + + self.backgroundView.image = newImage; + self.alpha = 1; +} +- (void) _resetShimmer{ + [self layoutSubviews]; + id dark = (id)[UIColor colorWithWhite:1 alpha:0.40].CGColor; + id light = (id)[UIColor colorWithWhite:1 alpha:1.0f].CGColor; + self.textLabel.textHighlightLayer.colors = @[dark,dark,light,dark,dark]; +} + + +#pragma mark UIScrollViewDelegate +- (void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ + + if(scrollView.contentOffset.x == 0){ + _isUnlocked = YES; + [self sendActionsForControlEvents:UIControlEventValueChanged]; + } + [self _resetShimmer]; + +} +- (void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ + if(!decelerate) [self _resetShimmer]; +} +- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView{ + if(self.mode == TKSlideToUnlockViewModeDisabled){ + scrollView.scrollEnabled = NO; + scrollView.userInteractionEnabled = NO; + scrollView.scrollEnabled = YES; + scrollView.userInteractionEnabled = YES; + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + [self sendActionsForControlEvents:UIControlEventTouchCancel]; + } +} + + +#pragma mark UIView Touches +- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + id white = (id)[UIColor whiteColor].CGColor; + self.textLabel.textHighlightLayer.colors = @[white,white,white,white,white]; + + [self sendActionsForControlEvents:UIControlEventTouchDown]; + + if(self.mode == TKSlideToUnlockViewModeDisabled){ + self.stashedBackgroundColor = self.scrollView.backgroundColor; + [UIView beginAnimations:nil context:nil]; + self.scrollView.backgroundColor = [UIColor colorWithRed:233/255.0f green:52/255.0f blue:41/255.0f alpha:0.7]; + [UIView commitAnimations]; + } + +} +- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + [self _resetShimmer]; + + if(self.mode == TKSlideToUnlockViewModeDisabled){ + [UIView beginAnimations:nil context:nil]; + self.scrollView.backgroundColor = self.stashedBackgroundColor; + [UIView commitAnimations]; + [self resetSlider:YES]; + } + + [self sendActionsForControlEvents:UIControlEventTouchUpInside]; +} +- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ + [super touchesCancelled:touches withEvent:event]; + + [self _resetShimmer]; + + if(self.mode == TKSlideToUnlockViewModeDisabled){ + [UIView beginAnimations:nil context:nil]; + self.scrollView.backgroundColor = self.stashedBackgroundColor; + [UIView commitAnimations]; + [self resetSlider:YES]; + } + [self sendActionsForControlEvents:UIControlEventTouchUpInside]; + +} + + +#pragma mark Public Methods +- (void) resetSlider:(BOOL)animated{ + [self.scrollView setContentOffset:CGPointMake(CGRectGetWidth(self.scrollView.frame), 0) animated:animated]; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKSoundAlertController.h b/TapkuLibrary/TKSoundAlertController.h new file mode 100644 index 00000000..86c19b8c --- /dev/null +++ b/TapkuLibrary/TKSoundAlertController.h @@ -0,0 +1,75 @@ +// +// TKSoundAlertController.h +// Created by Devin Ross on 3/10/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import Foundation; +@import AVFoundation; +@import AudioToolbox; + +/** `TKSoundAlertController` plays simple user interface sounds. */ +@interface TKSoundAlertController : NSObject + +/** Returns the singleton sound alert controller. + @return The shared instance sound alert controller object. + */ ++ (TKSoundAlertController*) sharedInstance; + +/** Plays a sound file immediately. + @param soundName Plays a sound file with name 'insert-sound-name'.aif + */ ++ (void) playAIF:(NSString*)soundName; + +/** Plays a sound file immediately. + @param soundName Plays a sound file with name 'insert-sound-name'.aiff + */ ++ (void) playAIFF:(NSString*)soundName; + +/** Plays a sound file immediately. + @param soundName Plays a sound file with name 'insert-sound-name'.wav + */ ++ (void) playWAV:(NSString*)soundName; + +/** Plays a sound file immediately. + @param soundName Plays a sound file with name 'insert-sound-name'.caf + */ ++ (void) playCAF:(NSString*)soundName; + + +///---------------------------- +/// @name Properties +///---------------------------- +/** Flag to enable the play of the sound. If off, it will not play the sound. Default is off. */ +@property (assign,nonatomic,getter = isOn) BOOL on; + + +- (void) playSoundName:(NSString*)soundName type:(NSString*)type; + + +@end diff --git a/TapkuLibrary/TKSoundAlertController.m b/TapkuLibrary/TKSoundAlertController.m new file mode 100644 index 00000000..df84f575 --- /dev/null +++ b/TapkuLibrary/TKSoundAlertController.m @@ -0,0 +1,89 @@ +// +// TKSoundAlertController.m +// Created by Devin Ross on 12/17/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKSoundAlertController.h" + +@interface TKSoundAlertController () + +@property (nonatomic,strong) NSMutableDictionary *sounds; + +@end + +@implementation TKSoundAlertController + ++ (TKSoundAlertController*)sharedInstance { + static TKSoundAlertController *instance = nil; + if (!instance) { + instance = [[TKSoundAlertController alloc] init]; + } + return instance; +} +- (instancetype) init{ + if(!(self=[super init])) return nil; + self.sounds = [[NSMutableDictionary alloc] initWithCapacity:10]; + return self; +} ++ (void) playAIF:(NSString*)soundName { + [[TKSoundAlertController sharedInstance] playSoundName:soundName type:@"aif"]; +} ++ (void) playAIFF:(NSString*)soundName { + [[TKSoundAlertController sharedInstance] playSoundName:soundName type:@"aiff"]; +} ++ (void) playWAV:(NSString*)soundName { + [[TKSoundAlertController sharedInstance] playSoundName:soundName type:@"wav"]; +} + ++ (void) playCAF:(NSString*)soundName{ + [[TKSoundAlertController sharedInstance] playSoundName:soundName type:@"caf"]; +} + +- (void) playSoundName:(NSString*)soundName type:(NSString*)type{ + if (!self.on) + return; + + NSNumber *soundIDHolder = (self.sounds)[soundName]; + if (soundIDHolder) { + SystemSoundID soundID = (SystemSoundID) [soundIDHolder unsignedLongValue]; + AudioServicesPlaySystemSound(soundID); + } else { + NSString *path = [[NSBundle mainBundle] pathForResource:soundName ofType:type]; + if (path) { + NSURL *url = [NSURL fileURLWithPath:path]; + SystemSoundID soundID = 0; + if (AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &soundID) == noErr) { + (self.sounds)[soundName] = @(soundID); + AudioServicesPlaySystemSound(soundID); + } + } + } +} + +@end diff --git a/TapkuLibrary/TKStepperCell.h b/TapkuLibrary/TKStepperCell.h new file mode 100644 index 00000000..4aee2231 --- /dev/null +++ b/TapkuLibrary/TKStepperCell.h @@ -0,0 +1,38 @@ +// +// TKStepperCell.h +// Created by Devin Ross on 4/9/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface TKStepperCell : UITableViewCell + +@property (nonatomic,strong) UIStepper *stepper; + +@end diff --git a/TapkuLibrary/TKStepperCell.m b/TapkuLibrary/TKStepperCell.m new file mode 100644 index 00000000..8d90713d --- /dev/null +++ b/TapkuLibrary/TKStepperCell.m @@ -0,0 +1,63 @@ +// +// TKStepperCell.m +// Created by Devin Ross on 4/9/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKStepperCell.h" + +@interface TKStepperCell () +@property (nonatomic,assign) UITableViewCellStyle theStyle; +@end + +@implementation TKStepperCell + + +- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if(!(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; + self.theStyle = style; + self.stepper = [[UIStepper alloc] initWithFrame:CGRectZero]; + self.accessoryView = self.stepper; + + return self; +} +- (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { + return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; +} + +- (void) layoutSubviews{ + [super layoutSubviews]; + + if(self.theStyle == UITableViewCellStyleValue1){ + CGRect rect = self.detailTextLabel.frame; + rect.origin.x -= 4; + self.detailTextLabel.frame = rect; + } +} + +@end diff --git a/TapkuLibrary/TKSwitchCell.h b/TapkuLibrary/TKSwitchCell.h new file mode 100644 index 00000000..ddd90b0c --- /dev/null +++ b/TapkuLibrary/TKSwitchCell.h @@ -0,0 +1,39 @@ +// +// TKSwitchCell.h +// Created by Devin Ross on 6/13/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +@import UIKit; + +/** A `UITableViewCell` with a `UISwitch` */ +@interface TKSwitchCell : UITableViewCell + +/** A `UISwitch`. */ +@property (nonatomic,strong) UISwitch *switcher; + +@end diff --git a/TapkuLibrary/TKSwitchCell.m b/TapkuLibrary/TKSwitchCell.m new file mode 100644 index 00000000..57223d7c --- /dev/null +++ b/TapkuLibrary/TKSwitchCell.m @@ -0,0 +1,51 @@ +// +// TKSwitchCell.m +// Created by Devin Ross on 6/13/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +#import "TKSwitchCell.h" + +@implementation TKSwitchCell + + +- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if(!(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; + + self.textLabel.backgroundColor = [UIColor clearColor]; + self.switcher = [[UISwitch alloc] initWithFrame:CGRectMake(0,0,94,27)]; + self.accessoryView = self.switcher; + + return self; +} +- (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { + return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; +} + + + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKTableViewController.h b/TapkuLibrary/TKTableViewController.h new file mode 100644 index 00000000..969b9bf6 --- /dev/null +++ b/TapkuLibrary/TKTableViewController.h @@ -0,0 +1,80 @@ +// +// TKTableViewController.h +// Created by Devin Ross on 11/19/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; +#import "TKViewController.h" +@class TKEmptyView; + +/** + This class provides basic `UITableViewController` functionality under the `TKViewController` class. + + The key differences between `TKTableViewController` and `UITableViewController`: + - The `UITableView` is a subview of the base view. + - The content offset of the `UITableView` is remembered if the view is ever deconstructed by a memory warning. + - Built to easily allocate and handle an empty view and search functionality. + + */ +@interface TKTableViewController : TKViewController + + +/** Initializes a table-view controller to manage a table view of a given style. + @param style A constant that specifies the style of table view that the controller object is to manage (`UITableViewStylePlain` or `UITableViewStyleGrouped`). + @return An initialized `TKTableViewController` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER; + + + +///---------------------------- +/// @name Properties +///---------------------------- + +/** Returns the table view managed by the controller object. */ +@property (nonatomic,strong) UITableView *tableView; + +/** Returns the table view style. */ +@property (nonatomic,readonly) UITableViewStyle style; + +/** Returns the empty view. Good for displaying when the content of the table view is empty. */ +@property (nonatomic,strong) TKEmptyView *emptyView; + +/** Returns a `UISearchBar` view. */ +@property (nonatomic,strong) UISearchBar *searchBar; + +/** Returns a `UISearchDisplayController` for the search bar and table view. */ +@property (nonatomic,strong) UISearchDisplayController *searchBarDisplayController; + +/** The default value of this property is YES. When YES, the table view controller clears the table’s current selection when it receives a viewWillAppear: message. Setting this property to NO preserves the selection. */ +@property (nonatomic,assign) BOOL clearsSelectionOnViewWillAppear; + + +@end diff --git a/TapkuLibrary/TKTableViewController.m b/TapkuLibrary/TKTableViewController.m new file mode 100644 index 00000000..b26af59e --- /dev/null +++ b/TapkuLibrary/TKTableViewController.m @@ -0,0 +1,150 @@ +// +// TKTableViewController.m +// Created by Devin Ross on 11/19/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKTableViewController.h" +#import "TKEmptyView.h" +#import "UIScrollview+TKCategory.h" + + +@interface TKTableViewController () { +@private + CGPoint _tableViewContentOffset; + +} +@property (nonatomic,assign) UITableViewStyle style; + +@end + + +#pragma mark - TKTableViewController +@implementation TKTableViewController + + +// ----------------------------- +#pragma mark Init & Friends +- (instancetype) init{ + self = [self initWithStyle:UITableViewStylePlain]; + return self; +} +- (instancetype) initWithStyle:(UITableViewStyle)style{ + if(!(self = [super init])) return nil; + self.style = style; + _tableViewContentOffset = CGPointZero; + _clearsSelectionOnViewWillAppear = YES; + return self; +} +- (void) dealloc{ + self.tableView.delegate = nil; + self.tableView.dataSource = nil; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void) _unloadSubviews{ + + _tableViewContentOffset = self.tableView.contentOffset; + + self.tableView = nil; + self.emptyView = nil; + self.searchBar = nil; + self.searchBarDisplayController = nil; +} +- (void) viewDidUnload { + [self _unloadSubviews]; + [super viewDidUnload]; +} +// ----------------------------- + + +#pragma mark View Load / Events +- (void) loadView{ + [super loadView]; + + self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:_style]; + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.showsVerticalScrollIndicator = YES; + self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.tableView.contentOffset = _tableViewContentOffset; + [self.view addSubview:self.tableView]; +} +- (void) viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + + if(self.clearsSelectionOnViewWillAppear) + [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:animated]; +} + + +// ----------------------------- +#pragma mark TableView Delegate & DataSource +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 0; +} +- (NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section { + return 0; +} +- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { + return nil; +} +// ----------------------------- + + + +// ----------------------------- +#pragma mark Properties +- (TKEmptyView*) emptyView{ + if(_emptyView) return _emptyView; + + _emptyView = [[TKEmptyView alloc] initWithFrame:self.view.bounds emptyViewImage:TKEmptyViewImageSearch title:nil subtitle:nil]; + _emptyView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + return _emptyView; +} +- (UISearchBar*) searchBar{ + if(_searchBar) return _searchBar; + + _searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 44)]; + _searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; + return _searchBar; +} +- (UISearchDisplayController*) searchBarDisplayController{ + if(_searchBarDisplayController) return _searchBarDisplayController; + + _searchBarDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; + _searchBarDisplayController.delegate = self; + _searchBarDisplayController.searchResultsDataSource = self; + _searchBarDisplayController.searchResultsDelegate = self; + return _searchBarDisplayController; +} +// ----------------------------- + +@end diff --git a/TapkuLibrary/TKTextFieldCell.h b/TapkuLibrary/TKTextFieldCell.h new file mode 100644 index 00000000..86042314 --- /dev/null +++ b/TapkuLibrary/TKTextFieldCell.h @@ -0,0 +1,40 @@ +// +// TKTextfieldCell.h +// Created by Devin Ross on 5/18/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** A table view cell with a text field. */ +@interface TKTextFieldCell : UITableViewCell + +/** The text field. */ +@property (nonatomic,strong) UITextField *textField; + +@end diff --git a/TapkuLibrary/TKTextFieldCell.m b/TapkuLibrary/TKTextFieldCell.m new file mode 100644 index 00000000..aafdf7be --- /dev/null +++ b/TapkuLibrary/TKTextFieldCell.m @@ -0,0 +1,74 @@ +// +// TKTextfieldCell.m +// Created by Devin Ross on 5/18/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKTextFieldCell.h" + +@implementation TKTextFieldCell + +- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if(!(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; + + _textField = [[UITextField alloc] initWithFrame:CGRectZero]; + _textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + [self.contentView addSubview:_textField]; + + return self; +} + +- (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { + return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; +} + +- (void) layoutSubviews { + [super layoutSubviews]; + + CGRect frame = CGRectInset(self.contentView.bounds, 14, 4); + if(self.indentationLevel != 0 && self.indentationWidth != 0){ + frame.origin.x = self.indentationLevel * self.indentationWidth; + frame.size.width = CGRectGetWidth(self.contentView.frame) - CGRectGetMinX(frame) - 14; + } + _textField.frame = frame; +} + +- (void) _colorText:(BOOL)active{ + _textField.textColor = active ? [UIColor whiteColor] : [UIColor blackColor]; +} +- (void) setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + [self _colorText:selected]; +} +- (void) setHighlighted:(BOOL)highlight animated:(BOOL)animated { + [super setHighlighted:highlight animated:animated]; + [self _colorText:highlight]; +} + + +@end diff --git a/TapkuLibrary/TKTextView.h b/TapkuLibrary/TKTextView.h new file mode 100644 index 00000000..8a2e6c9e --- /dev/null +++ b/TapkuLibrary/TKTextView.h @@ -0,0 +1,51 @@ +// +// TKTextView.h +// Created by Devin Ross on 5/18/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** This class creates a `UITextView` with placeholder text. */ +@interface TKTextView : UITextView + +///---------------------------- +/// @name Properties +///---------------------------- + +/** The placeholder label. */ +@property (nonatomic,strong) UILabel *placeHolderLabel; + + +/** The placeholder text. */ +@property (nonatomic,strong) NSString *placeholder; + +/** The text color of the placehold text. */ +@property (nonatomic,strong) UIColor *placeholderColor; + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKTextView.m b/TapkuLibrary/TKTextView.m new file mode 100644 index 00000000..23536aad --- /dev/null +++ b/TapkuLibrary/TKTextView.m @@ -0,0 +1,148 @@ +// +// TKTextView.m +// Created by Devin Ross on 5/18/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKTextView.h" + +@implementation TKTextView + + +#pragma mark Init & Friends +- (instancetype) initWithFrame:(CGRect)frame{ + if(!(self=[super initWithFrame:frame])) return nil; + [self _setupView]; + return self; +} +- (instancetype) initWithCoder:(NSCoder *)aDecoder{ + if(!(self=[super initWithCoder:aDecoder])) return nil; + [self _setupView]; + return self; +} +- (void) awakeFromNib{ + [super awakeFromNib]; + [self _setupView]; +} +- (void) _setupView{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_textChanged:) name:UITextViewTextDidChangeNotification object:nil]; +} +- (void) dealloc{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void) drawRect:(CGRect)rect{ + [super drawRect:rect]; + + + if(_placeHolderLabel){ + if(self.placeHolderLabel.superview==nil){ + [self addSubview:self.placeHolderLabel]; + [self sendSubviewToBack:self.placeHolderLabel]; + } + + if([self respondsToSelector:@selector(textContainer)]) + self.placeHolderLabel.frame = CGRectMake(4, self.textContainerInset.top, CGRectGetWidth(self.bounds) - 8, 0); + else + self.placeHolderLabel.frame = CGRectMake(8,8,CGRectGetWidth(self.bounds) - 16,0); + + + + + [self.placeHolderLabel sizeToFit]; + + } + + _placeHolderLabel.alpha = self.text.length < 1 ? 1 : 0; + +} + + +- (void) _textChanged:(NSNotification *)notification{ + if(self.placeholder.length == 0) return; + _placeHolderLabel.alpha = self.text.length < 1 ? 1 : 0; +} + + +#pragma mark Properties +- (void) setFont:(UIFont *)font{ + [super setFont:font]; + self.placeHolderLabel.font = font; + [self setNeedsDisplay]; +} +- (void) setText:(NSString *)text{ + [super setText:text]; + [self _textChanged:nil]; +} +- (void) setPlaceholder:(NSString *)placeholder{ + + if(placeholder.length < 1){ + _placeHolderLabel.text = placeholder; + [self setNeedsDisplay]; + return; + } + + self.placeHolderLabel.text = placeholder; + [self setNeedsDisplay]; +} +- (NSString*) placeholder{ + return _placeHolderLabel.text; +} +- (void) setPlaceholderColor:(UIColor *)placeholderColor{ + self.placeHolderLabel.textColor = placeholderColor; + [self setNeedsDisplay]; +} +- (UIColor*) placeholderColor{ + return _placeHolderLabel.textColor; +} +- (UILabel*) placeHolderLabel{ + if(_placeHolderLabel) return _placeHolderLabel; + + _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(8,8,CGRectGetWidth(self.bounds) - 16,0)]; + _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping; + _placeHolderLabel.numberOfLines = 0; + _placeHolderLabel.font = self.font; + _placeHolderLabel.backgroundColor = [UIColor clearColor]; + _placeHolderLabel.textColor = [UIColor lightGrayColor]; + + + if([self respondsToSelector:@selector(textContainer)]){ + + _placeHolderLabel.textColor = [UIColor colorWithWhite:0.80 alpha:1]; + _placeHolderLabel.frame = CGRectMake(2, 8, CGRectGetWidth(self.bounds) - 8, 0); + + } + + + + + _placeHolderLabel.alpha = 0; + return _placeHolderLabel; +} + +@end diff --git a/TapkuLibrary/TKTextViewCell.m b/TapkuLibrary/TKTextViewCell.m index 8d6b2bb2..e66c171d 100644 --- a/TapkuLibrary/TKTextViewCell.m +++ b/TapkuLibrary/TKTextViewCell.m @@ -29,6 +29,7 @@ */ #import "TKTextViewCell.h" +#import "TKTextView.h" @implementation TKTextViewCell diff --git a/TapkuLibrary/TKViewController.m b/TapkuLibrary/TKViewController.m index 5b5d03c4..8e3b9249 100644 --- a/TapkuLibrary/TKViewController.m +++ b/TapkuLibrary/TKViewController.m @@ -31,6 +31,7 @@ #import "TKViewController.h" #import "TKHTTPRequest.h" +#import "NSArray+TKCategory.h" @interface TKViewController () { NSMutableArray *_activeRequests; diff --git a/TapkuLibrary/TKWebViewController.h b/TapkuLibrary/TKWebViewController.h new file mode 100644 index 00000000..d2338644 --- /dev/null +++ b/TapkuLibrary/TKWebViewController.h @@ -0,0 +1,73 @@ +// +// TKWebViewController.h +// Created by Devin Ross on 5/24/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; + + +/** This class creates a `UIViewController` with a basic `UIWebView` as the focal point view. */ +@interface TKWebViewController : UIViewController + + +/** Initializes a web vew controller that will load the given `NSURL` object. + @param URL A `NSURL` object that will loaded by the `UIWebView`. + @return An initialized `TKWebViewController` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithURL:(NSURL*)URL NS_DESIGNATED_INITIALIZER; + +/** Initializes a web vew controller that will load the given `URLRequest` object. + @param URLRequest A `URLRequest` object that will loaded by the `UIWebView`. + @return An initialized `TKWebViewController` object or nil if the object couldn’t be created. + */ +- (instancetype) initWithURLRequest:(NSURLRequest*)URLRequest NS_DESIGNATED_INITIALIZER; + +///---------------------------- +/// @name Properties +///---------------------------- +/** The URL that will be loaded by the web view. */ +@property (nonatomic,strong) NSURL *URL; + +/** The URLRequest that will be loaded by the web view. */ +@property (nonatomic,strong) NSURLRequest *URLRequest; + +/** Returns the `UIWebView` managed by the controller object. */ +@property (nonatomic,strong) UIWebView *webView; + +@property (nonatomic,strong) UIBarButtonItem *actionBarButtonItem; + + + +/** Show a `UIActivityViewController` to share the URL of the web view + @param sender The sender of the action. + */ +- (void) showActionSheet:(id)sender; + +@end diff --git a/TapkuLibrary/TKWebViewController.m b/TapkuLibrary/TKWebViewController.m new file mode 100644 index 00000000..c80772d2 --- /dev/null +++ b/TapkuLibrary/TKWebViewController.m @@ -0,0 +1,116 @@ +// +// TKWebViewController.m +// Created by Devin Ross on 5/24/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +#import "TKWebViewController.h" +#import "UIBarButtonItem+TKCategory.h" + +@implementation TKWebViewController + +- (instancetype) initWithURL:(NSURL*)URL{ + if(!(self=[super init])) return nil; + self.URL = URL; + return self; +} +- (instancetype) initWithURLRequest:(NSURLRequest*)URLRequest{ + if(!(self=[super init])) return nil; + self.URLRequest = URLRequest; + return self; +} + +#pragma mark View Lifecycle +- (void) loadView{ + [super loadView]; + self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds]; + self.webView.delegate = self; + self.webView.scalesPageToFit = YES; + self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.view addSubview:self.webView]; +} +- (void) viewDidLoad{ + [super viewDidLoad]; + if(self.URL) + [self.webView loadRequest:[NSURLRequest requestWithURL:self.URL]]; + else if(self.URLRequest) + [self.webView loadRequest:self.URLRequest]; +} + +#pragma mark Button Actions +- (void) showActionSheet:(id)sender{ + NSURL *currentURL = self.webView.request.URL; + UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[currentURL] applicationActivities:nil]; + activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeSaveToCameraRoll, UIActivityTypeAssignToContact]; + [self presentViewController:activityVC animated:YES completion:nil]; +} + +#pragma mark UIWebviewDelegate +- (void) webViewDidStartLoad:(UIWebView *)webView{ + + UIActivityIndicatorViewStyle style; + if(self.navigationController.navigationBar.barTintColor){ + UIColor *clr = self.navigationController.navigationBar.barTintColor; + const CGFloat *componentColors = CGColorGetComponents(clr.CGColor); + CGFloat colorBrightness = ((componentColors[0] * 299) + (componentColors[1] * 587) + (componentColors[2] * 114)) / 1000; + style = colorBrightness < 0.6 ? UIActivityIndicatorViewStyleWhite : UIActivityIndicatorViewStyleGray ; + }else{ + style = UIActivityIndicatorViewStyleGray; + } + + self.navigationItem.rightBarButtonItem = [UIBarButtonItem activityItemWithIndicatorStyle:style]; + +} +- (void) webViewDidFinishLoad:(UIWebView *)webView { + self.navigationItem.rightBarButtonItem = self.actionBarButtonItem; + self.title = [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]; +} +- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { + self.navigationItem.rightBarButtonItem = self.actionBarButtonItem; + self.title = [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]; +} +- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ + + if(self.navigationController && (navigationType == UIWebViewNavigationTypeFormSubmitted || navigationType == UIWebViewNavigationTypeLinkClicked)){ + TKWebViewController *vc = [[[self class] alloc] initWithURLRequest:request]; + [self.navigationController pushViewController:vc animated:YES]; + return NO; + } + + return YES; +} + + +- (UIBarButtonItem*) actionBarButtonItem{ + if(_actionBarButtonItem) return _actionBarButtonItem; + _actionBarButtonItem = [UIBarButtonItem actionItemWithTarget:self action:@selector(showActionSheet:)]; + return _actionBarButtonItem; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TKWindow.h b/TapkuLibrary/TKWindow.h new file mode 100755 index 00000000..200acf9d --- /dev/null +++ b/TapkuLibrary/TKWindow.h @@ -0,0 +1,52 @@ +// +// TKWindow.h +// Created by Devin Ross on 6/4/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; + +/** Posted when the a motion event begins. */ +extern NSString *TKWindowShakeBegan; + +/** Posted when the a motion event cancels. */ +extern NSString *TKWindowShakeCancelled; + +/** Posted when the a motion event ends. */ +extern NSString *TKWindowShakeEnded; + +/** Posted when the a remote control event is received. */ +extern NSString *TKWindowRemoteControlEvent; + + + +/** A subclass of `UIWindow` that posts notifications of any motion (ie. shake) events for the device. */ +@interface TKWindow : UIWindow + +@end diff --git a/TapkuLibrary/TKWindow.m b/TapkuLibrary/TKWindow.m new file mode 100755 index 00000000..727263fc --- /dev/null +++ b/TapkuLibrary/TKWindow.m @@ -0,0 +1,59 @@ +// +// TKWindow.m +// Created by Devin Ross on 6/4/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "TKWindow.h" + +NSString *TKWindowShakeBegan = @"TKWindowShakeBegan"; +NSString *TKWindowShakeCancelled = @"TKWindowShakeCancelled"; +NSString *TKWindowShakeEnded = @"TKWindowShakeEnded"; +NSString *TKWindowRemoteControlEvent = @"TKWindowRemoteControlEvent"; + + +@implementation TKWindow + +- (void) remoteControlReceivedWithEvent:(UIEvent *)event{ + [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowRemoteControlEvent object:event]; +} + + + +#pragma mark Motion Events +- (void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { + [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeBegan object:self]; +} +- (void) motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event { + [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeCancelled object:self]; +} +- (void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { + [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeEnded object:self]; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/TapkuLibrary.h b/TapkuLibrary/TapkuLibrary.h index f888b7e9..74982808 100755 --- a/TapkuLibrary/TapkuLibrary.h +++ b/TapkuLibrary/TapkuLibrary.h @@ -28,16 +28,45 @@ #import "TKGlobal.h" // ADDITIONS -//#import "NSDate+TKCategory.h" +#import "NSObject+TKCategory.h" +#import "NSString+TKCategory.h" +#import "NSDate+TKCategory.h" +#import "NSArray+TKCategory.h" +#import "NSMutableArray+TKCategory.h" +#import "UIDevice+TKCategory.h" +#import "UIScreen+TKCategory.h" +#import "UIView+TKCategory.h" #import "UIImage+TKCategory.h" - - - +#import "UIColor+TKCategory.h" +#import "UIImageView+TKCategory.h" +#import "UIScrollview+TKCategory.h" +#import "UIButton+TKCategory.h" +#import "UITextField+TKCategory.h" +#import "UIImagePickerController+TKCategory.h" +#import "UIViewController+TKCategory.h" +#import "UIBarButtonItem+TKCategory.h" +#import "UIActionSheet+TKCategory.h" +#import "UIAlertView+TKCategory.h" +#import "UIGestureRecognizer+TKCategory.h" +#import "UIFont+TKCategory.h" +#import "UINavigationBar+TKCategory.h" +#import "UILabel+TKCategory.h" + +#import "TKWindow.h" #import "TKViewController.h" +#import "TKTableViewController.h" +#import "TKKeyboardTableViewController.h" +#import "TKWebViewController.h" +#import "TKAlertViewController.h" #import "TKEmptyView.h" #import "TKAppDelegate.h" - +#import "TKGradientView.h" +#import "TKShapeView.h" +#import "TKTextView.h" +#import "TKSlideToUnlockView.h" +#import "TKMultiSwitch.h" +#import "TKPegSlider.h" // Network @@ -46,9 +75,13 @@ #import "TKImageCache.h" #import "TKRetroButton.h" +#import "TKGlowButton.h" +#import "TKShimmerLabel.h" #import "TKReorderTableView.h" +#import "TKSoundAlertController.h" +#import "TKCardModalViewController.h" // CELLS #import "TKLabelCell.h" @@ -57,14 +90,18 @@ #import "TKLabelFieldCell.h" #import "TKLabelSwitchCell.h" #import "TKButtonCell.h" +#import "TKTextFieldCell.h" #import "TKTextViewCell.h" +#import "TKSwitchCell.h" #import "TKTableViewCell.h" +#import "TKStepperCell.h" // HUD #import "TKAlertCenter.h" #import "TKProgressBarView.h" #import "TKProgressAlertView.h" #import "TKProgressCircleView.h" +#import "TKLoadingView.h" // Calendar @@ -72,11 +109,14 @@ #import "TKCalendarMonthTableViewController.h" #import "TKCalendarMonthView.h" #import "TKCalendarDayViewController.h" -#import "NSDate+CalendarGrid.h" - // Coverflow #import "TKCoverflowView.h" - - +// Keyboards +#import "TKInputView.h" +#import "TKInputKey.h" +#import "TKNumberInputView.h" +#import "TKDecimalInputView.h" +#import "TKDecimalInputWithNextKeyView.h" +#import "TKNumberInputWithNextKeyView.h" diff --git a/TapkuLibrary/UIActionSheet+TKCategory.h b/TapkuLibrary/UIActionSheet+TKCategory.h new file mode 100644 index 00000000..54febd83 --- /dev/null +++ b/TapkuLibrary/UIActionSheet+TKCategory.h @@ -0,0 +1,43 @@ +// +// UIActionSheet+TKCategory.h +// Created by Devin Ross on 10/4/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UIActionSheet`. */ +@interface UIActionSheet (TKCategory) + +/** Creates and returns a UIActionSheet with the delegate. + @param delegate The delegate for the sheet. + @return The `UIActionSheet` object. + */ ++ (UIActionSheet*) sheetWithDelegate:(id)delegate; + +@end diff --git a/TapkuLibrary/UIActionSheet+TKCategory.m b/TapkuLibrary/UIActionSheet+TKCategory.m new file mode 100644 index 00000000..65776f38 --- /dev/null +++ b/TapkuLibrary/UIActionSheet+TKCategory.m @@ -0,0 +1,45 @@ +// +// UIActionSheet+TKCategory.m +// Created by Devin Ross on 10/4/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIActionSheet+TKCategory.h" + +@implementation UIActionSheet (TKCategory) + ++ (UIActionSheet*) sheetWithDelegate:(id)delegate{ + + return [[UIActionSheet alloc] initWithTitle:nil + delegate:delegate + cancelButtonTitle:nil + destructiveButtonTitle:nil + otherButtonTitles:nil]; +} + +@end diff --git a/TapkuLibrary/UIAlertView+TKCategory.h b/TapkuLibrary/UIAlertView+TKCategory.h new file mode 100644 index 00000000..3019b043 --- /dev/null +++ b/TapkuLibrary/UIAlertView+TKCategory.h @@ -0,0 +1,46 @@ +// +// UIAlertView+TKCategory.h +// Created by Devin Ross on 10/4/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UIAlertView`. */ +@interface UIAlertView (TKCategory) + + +/** Creates, shows and returns a UIAlertView using with a button with the specified properties. + @param title The title of the alert view. + @param message The message of the alert view. + @param dismiss The cancel button title. + @return The `UIAlertView` object. + */ ++ (UIAlertView*) showAlertViewWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss; + +@end diff --git a/TapkuLibrary/UIAlertView+TKCategory.m b/TapkuLibrary/UIAlertView+TKCategory.m new file mode 100644 index 00000000..21d35f1d --- /dev/null +++ b/TapkuLibrary/UIAlertView+TKCategory.m @@ -0,0 +1,48 @@ +// +// UIAlertView+TKCategory.m +// Created by Devin Ross on 10/4/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIAlertView+TKCategory.h" + +@implementation UIAlertView (TKCategory) + + ++ (UIAlertView*) showAlertViewWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss{ + + if(!dismiss) dismiss = NSLocalizedString(@"Dismiss", @"Dismiss Alert View"); + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:dismiss otherButtonTitles:nil]; + [alert show]; + + return alert; + +} + +@end diff --git a/TapkuLibrary/UIBarButtonItem+TKCategory.h b/TapkuLibrary/UIBarButtonItem+TKCategory.h new file mode 100644 index 00000000..96ea089f --- /dev/null +++ b/TapkuLibrary/UIBarButtonItem+TKCategory.h @@ -0,0 +1,103 @@ +// +// UIBarButtonItem+TKCategory.h +// Created by Devin Ross on 3/23/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import Foundation; +@import UIKit; + +/** Additional functionality for `UIBarButtonItem`. */ +@interface UIBarButtonItem (TKCategory) + + + +/** Creates and returns a bar button item object using with a button with the specified properties. + @param image The normal state image. + @param highlighedImage The highlighted state image. + @param target The object that receives the action message. + @param selector The action to send to target when this item is selected. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) barButtonItemWithImage:(UIImage*)image highlightedImage:(UIImage*)highlighedImage target:(id)target selector:(SEL)selector; + +/** Creates and returns a Action button bar button item. + @param target The object that receives the action message. + @param action The action to send to target when this item is selected. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) actionItemWithTarget:(id)target action:(SEL)action; + +/** Creates and returns a Done button bar button item. + @param target The object that receives the action message. + @param action The action to send to target when this item is selected. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) doneItemWithTarget:(id)target action:(SEL)action; + +/** Creates and returns a Cancel button bar button item. + @param target The object that receives the action message. + @param action The action to send to target when this item is selected. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) cancelItemWithTarget:(id)target action:(SEL)action; + +/** Creates and returns a Save button bar button item. + @param target The object that receives the action message. + @param action The action to send to target when this item is selected. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) saveItemWithTarget:(id)target action:(SEL)action; + +/** Creates and returns a UIActivityIndicatorView bar button item. The style is white. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) activityItem; + +/** Creates and returns a UIActivityIndicatorView bar button item. + @param style The indicator style. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) activityItemWithIndicatorStyle:(UIActivityIndicatorViewStyle)style; + + +/** Creates and returns a fixed width bar button item. + @param width The width of the item; + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) fixedSpaceItemWithWidth:(CGFloat)width; + +/** Creates and returns a flexible bar button item. + @return The `UIBarButtonItem` object. + */ ++ (UIBarButtonItem*) flexibleSpaceItem; + + + +@end diff --git a/TapkuLibrary/UIBarButtonItem+TKCategory.m b/TapkuLibrary/UIBarButtonItem+TKCategory.m new file mode 100644 index 00000000..44c120f7 --- /dev/null +++ b/TapkuLibrary/UIBarButtonItem+TKCategory.m @@ -0,0 +1,93 @@ +// +// UIBarButtonItem+TKCategory.m +// Created by Devin Ross on 3/23/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIBarButtonItem+TKCategory.h" +#import "UIButton+TKCategory.h" + +@implementation UIBarButtonItem (TKCategory) + + ++ (UIBarButtonItem*) barButtonItemWithImage:(UIImage*)img highlightedImage:(UIImage*)highlighedImage target:(id)t selector:(SEL)s{ + + CGRect r = CGRectZero; + r.size = img.size; + + UIButton *btn = [UIButton buttonWithFrame:r image:img highlightedImage:highlighedImage]; + + [btn addTarget:t action:s forControlEvents:UIControlEventTouchUpInside]; + UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn]; + item.target = t; + item.action = s; + return item; + +} + + + ++ (UIBarButtonItem*) doneItemWithTarget:(id)target action:(SEL)action{ + return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:target action:action]; +} + ++ (UIBarButtonItem*) cancelItemWithTarget:(id)target action:(SEL)action{ + return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:target action:action]; +} ++ (UIBarButtonItem*) saveItemWithTarget:(id)target action:(SEL)action{ + UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:target action:action]; + item.style = UIBarButtonItemStyleDone; + return item; +} + ++ (UIBarButtonItem*) actionItemWithTarget:(id)target action:(SEL)action{ + return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:target action:action]; +} + ++ (UIBarButtonItem*) activityItemWithIndicatorStyle:(UIActivityIndicatorViewStyle)style{ + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:style]; + [indicator startAnimating]; + return [[UIBarButtonItem alloc] initWithCustomView:indicator]; +} + + ++ (UIBarButtonItem*) activityItem{ + return [UIBarButtonItem activityItemWithIndicatorStyle:UIActivityIndicatorViewStyleWhite]; +} + ++ (UIBarButtonItem*) fixedSpaceItemWithWidth:(CGFloat)width{ + UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; + item.width = width; + return item; +} ++ (UIBarButtonItem*) flexibleSpaceItem{ + return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; +} + + +@end diff --git a/TapkuLibrary/UIButton+TKCategory.h b/TapkuLibrary/UIButton+TKCategory.h new file mode 100644 index 00000000..af956b81 --- /dev/null +++ b/TapkuLibrary/UIButton+TKCategory.h @@ -0,0 +1,85 @@ +// +// UIImage+TKButton.h +// Created by Devin Ross on 1/9/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; + +/** Additional functionality for `UIButton`. */ +@interface UIButton (TKCategory) + + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame. + @param frame The frame for the button view. + @return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame; + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame and title. +@param frame The frame for the button view. +@param title The title for `UIControlStateNormal`. +@return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title; + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame, title and background image. + @param frame The frame for the button view. + @param title The title for `UIControlStateNormal`. + @param backgroundImage The background image for `UIControlStateNormal`. + @return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title backgroundImage:(UIImage*)backgroundImage; + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame, title and background image. + @param frame The frame for the button view. + @param title The title for `UIControlStateNormal`. + @param backgroundImage The background image for `UIControlStateNormal`. + @param highlightedBackgroundImage The background image for `UIControlStateHighlighted` + @return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title backgroundImage:(UIImage*)backgroundImage highlightedBackgroundImage:(UIImage*)highlightedBackgroundImage; + + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame and image. + @param frame The frame for the button view. + @param image The image for `UIControlStateNormal`. + @return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame image:(UIImage*)image; + +/** Creates and returns a new button of type `UIButtonCustom` with the specified frame, title and background image. + @param frame The frame for the button view. + @param image The image for `UIControlStateNormal`. + @param highlightedImage The image for `UIControlStateHighlighted`. + @return A newly create button. + */ ++ (instancetype) buttonWithFrame:(CGRect)frame image:(UIImage*)image highlightedImage:(UIImage*)highlightedImage; + +@end diff --git a/TapkuLibrary/UIButton+TKCategory.m b/TapkuLibrary/UIButton+TKCategory.m new file mode 100644 index 00000000..745c8ba5 --- /dev/null +++ b/TapkuLibrary/UIButton+TKCategory.m @@ -0,0 +1,70 @@ +// +// UIImage+TKButton.m +// Created by Devin Ross on 1/9/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + + +#import "UIButton+TKCategory.h" + + +@implementation UIButton (TKCategory) + + ++ (instancetype) buttonWithFrame:(CGRect)frame{ + return [[self class] buttonWithFrame:frame title:nil]; +} ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title{ + return [[self class] buttonWithFrame:frame title:title backgroundImage:nil]; +} ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title backgroundImage:(UIImage*)backgroundImage{ + return [[self class] buttonWithFrame:frame title:title backgroundImage:backgroundImage highlightedBackgroundImage:nil]; +} ++ (instancetype) buttonWithFrame:(CGRect)frame title:(NSString*)title backgroundImage:(UIImage*)backgroundImage highlightedBackgroundImage:(UIImage*)highlightedBackgroundImage{ + UIButton *btn = [[self class] buttonWithType:UIButtonTypeCustom]; + btn.frame = frame; + [btn setTitle:title forState:UIControlStateNormal]; + [btn setBackgroundImage:backgroundImage forState:UIControlStateNormal]; + [btn setBackgroundImage:highlightedBackgroundImage forState:UIControlStateHighlighted]; + return btn; +} + ++ (instancetype) buttonWithFrame:(CGRect)frame image:(UIImage*)image{ + return [[self class] buttonWithFrame:frame image:image highlightedImage:nil]; +} ++ (instancetype) buttonWithFrame:(CGRect)frame image:(UIImage*)image highlightedImage:(UIImage*)highlightedImage{ + UIButton *btn = [[self class] buttonWithType:UIButtonTypeCustom]; + btn.frame = frame; + [btn setImage:image forState:UIControlStateNormal]; + [btn setImage:image forState:UIControlStateHighlighted]; + return btn; +} + + +@end diff --git a/TapkuLibrary/UIColor+TKCategory.h b/TapkuLibrary/UIColor+TKCategory.h new file mode 100644 index 00000000..422ae3d9 --- /dev/null +++ b/TapkuLibrary/UIColor+TKCategory.h @@ -0,0 +1,56 @@ +// +// UIColor+TKCategory.h +// Created by Devin Ross on 5/14/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; + +/** Additional functionality for `UIColor`. */ +@interface UIColor (TKCategory) + +/** Creates and returns a color object using the specific hex value. + @param hex The hex value that will decide the color. + @return The `UIColor` object. +*/ ++ (UIColor *) colorWithHex:(unsigned int)hex; + +/** Creates and returns a color object using the specific hex value. + @param hex The hex value that will decide the color. + @param alpha The opacity of the color. + @return The `UIColor` object. +*/ ++ (UIColor *) colorWithHex:(unsigned int)hex alpha:(CGFloat)alpha; + +/** Creates and returns a color object with a random color value. The alpha property is 1.0. + @return The `UIColor` object. +*/ ++ (UIColor *) randomColor; + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIColor+TKCategory.m b/TapkuLibrary/UIColor+TKCategory.m new file mode 100644 index 00000000..3af1dfdd --- /dev/null +++ b/TapkuLibrary/UIColor+TKCategory.m @@ -0,0 +1,59 @@ +// +// UIColor+TKCategory.m +// Created by Devin Ross on 5/14/11. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIColor+TKCategory.h" + +@implementation UIColor (TKCategory) + + ++ (instancetype) colorWithHex:(unsigned int)hex{ + return [UIColor colorWithHex:hex alpha:1]; +} + ++ (instancetype) colorWithHex:(unsigned int)hex alpha:(CGFloat)alpha{ + + return [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16)) / 255.0 + green:((float)((hex & 0xFF00) >> 8)) / 255.0 + blue:((float)(hex & 0xFF)) / 255.0 + alpha:alpha]; + +} + ++ (UIColor*) randomColor{ + + NSInteger r = arc4random() % 255; + NSInteger g = arc4random() % 255; + NSInteger b = arc4random() % 255; + return [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]; + +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIDevice+TKCategory.h b/TapkuLibrary/UIDevice+TKCategory.h new file mode 100644 index 00000000..6a297dcb --- /dev/null +++ b/TapkuLibrary/UIDevice+TKCategory.h @@ -0,0 +1,39 @@ +// +// UIDevice+TKCategory.h +// Created by Devin Ross on 8/22/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface UIDevice (TKCategory) + ++ (BOOL) padIdiom; ++ (BOOL) phoneIdiom; + +@end diff --git a/TapkuLibrary/UIDevice+TKCategory.m b/TapkuLibrary/UIDevice+TKCategory.m new file mode 100644 index 00000000..e60d4b93 --- /dev/null +++ b/TapkuLibrary/UIDevice+TKCategory.m @@ -0,0 +1,50 @@ +// +// UIDevice+TKCategory.m +// Created by Devin Ross on 8/22/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIDevice+TKCategory.h" + +@implementation UIDevice (TKCategory) + +static NSInteger _interfaceIdiom = -1; + ++ (BOOL) padIdiom{ + if(_interfaceIdiom < 0) + _interfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom; + return _interfaceIdiom == UIUserInterfaceIdiomPad; +} ++ (BOOL) phoneIdiom{ + if(_interfaceIdiom < 0) + _interfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom; + return _interfaceIdiom == UIUserInterfaceIdiomPhone; +} + + +@end diff --git a/TapkuLibrary/UIFont+TKCategory.h b/TapkuLibrary/UIFont+TKCategory.h new file mode 100644 index 00000000..c40224d3 --- /dev/null +++ b/TapkuLibrary/UIFont+TKCategory.h @@ -0,0 +1,66 @@ +// +// UIFont+TKCategory.h +// Created by Devin Ross on 10/5/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface UIFont (TKCategory) + +#pragma mark Helvetica Neue ++ (UIFont*) helveticaNeueWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueBoldItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueLightWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueUltraLightItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueCondensedBoldWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueMediumItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueMediumWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueThinItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueLightItalicWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueUltraLightWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueBoldWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueCondensedBlackWithSize:(CGFloat)size; ++ (UIFont*) helveticaNeueThinWithSize:(CGFloat)size; + +#pragma mark Avenir ++ (UIFont*) avenirHeavyWithSize:(CGFloat)size; ++ (UIFont*) avenirObliqueWithSize:(CGFloat)size; ++ (UIFont*) avenirBlackWithSize:(CGFloat)size; ++ (UIFont*) avenirBookWithSize:(CGFloat)size; ++ (UIFont*) avenirBlackObliqueWithSize:(CGFloat)size; ++ (UIFont*) avenirHeavyObliqueWithSize:(CGFloat)size; ++ (UIFont*) avenirLightWithSize:(CGFloat)size; ++ (UIFont*) avenirMediumObliqueWithSize:(CGFloat)size; ++ (UIFont*) avenirMediumWithSize:(CGFloat)size; ++ (UIFont*) avenirLightObliqueWithSize:(CGFloat)size; ++ (UIFont*) avenirRomanWithSize:(CGFloat)size; ++ (UIFont*) avenirBookObliqueWithSize:(CGFloat)size; + +@end diff --git a/TapkuLibrary/UIFont+TKCategory.m b/TapkuLibrary/UIFont+TKCategory.m new file mode 100644 index 00000000..8f06164c --- /dev/null +++ b/TapkuLibrary/UIFont+TKCategory.m @@ -0,0 +1,120 @@ +// +// UIFont+TKCategory.m +// Created by Devin Ross on 10/5/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIFont+TKCategory.h" + +@implementation UIFont (TKCategory) + +#pragma mark Helvetica Neue ++ (UIFont*) helveticaNeueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue" size:size]; +} ++ (UIFont*) helveticaNeueBoldItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-BoldItalic" size:size]; +} ++ (UIFont*) helveticaNeueLightWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Light" size:size]; +} ++ (UIFont*) helveticaNeueItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Italic" size:size]; +} ++ (UIFont*) helveticaNeueUltraLightItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-UltraLightItalic" size:size]; +} ++ (UIFont*) helveticaNeueCondensedBoldWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:size]; +} ++ (UIFont*) helveticaNeueMediumItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-MediumItalic" size:size]; +} ++ (UIFont*) helveticaNeueMediumWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Medium" size:size]; +} ++ (UIFont*) helveticaNeueThinItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Thin_Italic" size:size]; +} ++ (UIFont*) helveticaNeueThinWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Thin" size:size]; +} ++ (UIFont*) helveticaNeueLightItalicWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-LightItalic" size:size]; +} ++ (UIFont*) helveticaNeueUltraLightWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:size]; +} ++ (UIFont*) helveticaNeueBoldWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-Bold" size:size]; +} ++ (UIFont*) helveticaNeueCondensedBlackWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:size]; +} + + +#pragma mark Avenir ++ (UIFont*) avenirHeavyWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Heavy" size:size]; +} ++ (UIFont*) avenirObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Oblique" size:size]; +} ++ (UIFont*) avenirBlackWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Black" size:size]; +} ++ (UIFont*) avenirBookWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Book" size:size]; +} ++ (UIFont*) avenirBlackObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-BlackOblique" size:size]; +} ++ (UIFont*) avenirHeavyObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-HeavyOblique" size:size]; +} ++ (UIFont*) avenirLightWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Light" size:size]; +} ++ (UIFont*) avenirMediumObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-MediumOblique" size:size]; +} ++ (UIFont*) avenirMediumWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Medium" size:size]; +} ++ (UIFont*) avenirLightObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-LightOblique" size:size]; +} ++ (UIFont*) avenirRomanWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-Roman" size:size]; +} ++ (UIFont*) avenirBookObliqueWithSize:(CGFloat)size{ + return [UIFont fontWithName:@"Avenir-BookOblique" size:size]; +} + + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIGestureRecognizer+TKCategory.h b/TapkuLibrary/UIGestureRecognizer+TKCategory.h new file mode 100644 index 00000000..2c900591 --- /dev/null +++ b/TapkuLibrary/UIGestureRecognizer+TKCategory.h @@ -0,0 +1,55 @@ +// +// UIGestureRecognizer+TKCategory.h +// Created by Devin Ross on 7/25/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UIGestureRecognizer`. */ +@interface UIGestureRecognizer (TKCategory) + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStateBegan`, otherwise NO. */ +@property (nonatomic, readonly) BOOL began; + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStateChanged`, otherwise NO. */ +@property (nonatomic, readonly) BOOL changed; + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStateEnded`, otherwise NO. */ +@property (nonatomic, readonly) BOOL ended; + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStateCancelled`, otherwise NO. */ +@property (nonatomic, readonly) BOOL cancelled; + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStateFailed`, otherwise NO. */ +@property (nonatomic, readonly) BOOL failed; + +/** Returns YES if the gesture recognizer state is `UIGestureRecognizerStatePossible`, otherwise NO. */ +@property (nonatomic, readonly) BOOL possible; + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIGestureRecognizer+TKCategory.m b/TapkuLibrary/UIGestureRecognizer+TKCategory.m new file mode 100644 index 00000000..d9e15936 --- /dev/null +++ b/TapkuLibrary/UIGestureRecognizer+TKCategory.m @@ -0,0 +1,61 @@ +// +// UIGestureRecognizer+TKCategory.m +// Created by Devin Ross on 7/25/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIGestureRecognizer+TKCategory.h" + +@implementation UIGestureRecognizer (TKCategory) + +- (BOOL) began{ + return self.state == UIGestureRecognizerStateBegan; +} + +- (BOOL) changed{ + return self.state == UIGestureRecognizerStateChanged; +} + +- (BOOL) ended{ + return self.state == UIGestureRecognizerStateEnded; +} + +- (BOOL) cancelled{ + return self.state == UIGestureRecognizerStateCancelled; +} + +- (BOOL) failed{ + return self.state == UIGestureRecognizerStateFailed; +} + +- (BOOL) possible{ + return self.state == UIGestureRecognizerStatePossible; +} + + +@end diff --git a/TapkuLibrary/UIImage+TKCategory.h b/TapkuLibrary/UIImage+TKCategory.h index e9c9cd01..da3b8928 100755 --- a/TapkuLibrary/UIImage+TKCategory.h +++ b/TapkuLibrary/UIImage+TKCategory.h @@ -33,10 +33,55 @@ @import UIKit; /** Additional functionality for `UIImage`. */ -@interface UIImage (Tapku) +@interface UIImage (TKCategory) + (UIImage*) imageNamedTK:(NSString*)path; +- (UIImage *) imageCroppedToRect:(CGRect)rect; + +@property (nonatomic, readonly, strong) UIImage *squareImage; + + +/** Creates and returns an image with the applyed lighting effect. + @return An image with the applied lighting effect. + */ +@property (nonatomic, readonly, strong) UIImage *imageByApplyingLightEffect; + +/** Creates and returns an image with the applyed lighting effect. + @return An image with the applied lighting effect. + */ +@property (nonatomic, readonly, strong) UIImage *imageByApplyingExtraLightEffect; + +/** Creates and returns an image with the applyed tint color. + @param blurRadius the blur radius applied to the image + @param saturation The saturation change applied to the original image. 1.0 is the default. + @return An image with the applied tint effect. + */ +- (UIImage*) imageByApplyingDarkEffectWithBlurRadius:(CGFloat)blurRadius saturationFactor:(CGFloat)saturation; + + +/** Creates and returns an image with the a dark tint color applied. + @return An image with the applied dark tint effect. + */ +@property (nonatomic, readonly, strong) UIImage *imageByApplyingDarkEffect; + + +/** Creates and returns an image with the applyed tint color. + @param tintColor The color that will applied to the image. For subtle changes, make sure the alpha of the color is less than 1. + @return An image with the applied tint effect. + */ +- (UIImage *) imageByApplyingTintEffectWithColor:(UIColor *)tintColor; + + +/** Creates and returns an image with the applyed blur, tint color, saturation change, and masked image. + @param blurRadius the blur radius applied to the image + @param tintColor The color that will applied to the image. For subtle changes, make sure the alpha of the color is less than 1. + @param saturationDeltaFactor The saturation change applied to the original image. 1.0 is the default. + @param maskImage The mask image applied to the original image. + @return An image with the applied blur. + */ +- (UIImage *) imageByApplyingBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage; + @end diff --git a/TapkuLibrary/UIImage+TKCategory.m b/TapkuLibrary/UIImage+TKCategory.m index a34f9d4f..ab631fb3 100755 --- a/TapkuLibrary/UIImage+TKCategory.m +++ b/TapkuLibrary/UIImage+TKCategory.m @@ -30,11 +30,12 @@ */ #import "UIImage+TKCategory.h" +#import "UIView+TKCategory.h" #import "TKGlobal.h" @import Accelerate; #import -@implementation UIImage (Tapku) +@implementation UIImage (TKCategory) + (UIImage*) imageNamedTK:(NSString*)str{ @@ -46,5 +47,187 @@ + (UIImage*) imageNamedTK:(NSString*)str{ return [UIImage imageWithCGImage:[UIImage imageWithContentsOfFile:TKBUNDLE(path)].CGImage scale:s orientation:UIImageOrientationUp]; } +- (UIImage *) imageCroppedToRect:(CGRect)rect{ + CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], rect); + UIImage *cropped = [UIImage imageWithCGImage:imageRef]; + CGImageRelease(imageRef); + return cropped; +} +- (UIImage *) squareImage{ + CGFloat min = self.size.width <= self.size.height ? self.size.width : self.size.height; + return [self imageCroppedToRect:CGRectMake(0,0,min,min)]; +} + + + + +- (UIImage *) imageByApplyingLightEffect{ + UIColor *tintColor = [UIColor colorWithWhite:1.0 alpha:0.3]; + return [self imageByApplyingBlurWithRadius:30 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; +} + +- (UIImage *) imageByApplyingExtraLightEffect{ + UIColor *tintColor = [UIColor colorWithWhite:0.97 alpha:0.82]; + return [self imageByApplyingBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; +} + +- (UIImage*) imageByApplyingDarkEffectWithBlurRadius:(CGFloat)blurRadius saturationFactor:(CGFloat)saturation{ + UIColor *tintColor = [UIColor colorWithWhite:0.11 alpha:0.63]; + return [self imageByApplyingBlurWithRadius:blurRadius tintColor:tintColor saturationDeltaFactor:saturation maskImage:nil]; +} + +- (UIImage *) imageByApplyingDarkEffect{ + UIColor *tintColor = [UIColor colorWithWhite:0.11 alpha:0.73]; + return [self imageByApplyingBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]; +} + +- (UIImage *) imageByApplyingTintEffectWithColor:(UIColor *)tintColor{ + const CGFloat EffectColorAlpha = 0.6; + UIColor *effectColor = tintColor; + NSInteger componentCount = CGColorGetNumberOfComponents(tintColor.CGColor); + if (componentCount == 2) { + CGFloat b; + if ([tintColor getWhite:&b alpha:NULL]) { + effectColor = [UIColor colorWithWhite:b alpha:EffectColorAlpha]; + } + } + else { + CGFloat r, g, b; + if ([tintColor getRed:&r green:&g blue:&b alpha:NULL]) { + effectColor = [UIColor colorWithRed:r green:g blue:b alpha:EffectColorAlpha]; + } + } + return [self imageByApplyingBlurWithRadius:10 tintColor:effectColor saturationDeltaFactor:-1.0 maskImage:nil]; +} + +- (UIImage *) imageByApplyingBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage{ + // Check pre-conditions. + if (self.size.width < 1 || self.size.height < 1) { + NSLog (@"*** error: invalid size: (%.2f x %.2f). Both dimensions must be >= 1: %@", self.size.width, self.size.height, self); + return nil; + } + if (!self.CGImage) { + NSLog (@"*** error: image must be backed by a CGImage: %@", self); + return nil; + } + if (maskImage && !maskImage.CGImage) { + NSLog (@"*** error: maskImage must be backed by a CGImage: %@", maskImage); + return nil; + } + + CGRect imageRect = { CGPointZero, self.size }; + UIImage *effectImage = self; + + BOOL hasBlur = blurRadius > __FLT_EPSILON__; + BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; + if (hasBlur || hasSaturationChange) { + UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef effectInContext = UIGraphicsGetCurrentContext(); + CGContextScaleCTM(effectInContext, 1.0, -1.0); + CGContextTranslateCTM(effectInContext, 0, -self.size.height); + CGContextDrawImage(effectInContext, imageRect, self.CGImage); + + vImage_Buffer effectInBuffer; + effectInBuffer.data = CGBitmapContextGetData(effectInContext); + effectInBuffer.width = CGBitmapContextGetWidth(effectInContext); + effectInBuffer.height = CGBitmapContextGetHeight(effectInContext); + effectInBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectInContext); + + UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef effectOutContext = UIGraphicsGetCurrentContext(); + vImage_Buffer effectOutBuffer; + effectOutBuffer.data = CGBitmapContextGetData(effectOutContext); + effectOutBuffer.width = CGBitmapContextGetWidth(effectOutContext); + effectOutBuffer.height = CGBitmapContextGetHeight(effectOutContext); + effectOutBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectOutContext); + + if (hasBlur) { + // A description of how to compute the box kernel width from the Gaussian + // radius (aka standard deviation) appears in the SVG spec: + // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement + // + // For larger values of 's' (s >= 2.0), an approximation can be used: Three + // successive box-blurs build a piece-wise quadratic convolution kernel, which + // approximates the Gaussian kernel to within roughly 3%. + // + // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) + // + // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. + // + CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale]; + NSUInteger radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5); + if (radius % 2 != 1) { + radius += 1; // force radius to be odd so that the three box-blur methodology works. + } + vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, (uint32_t)radius, (uint32_t)radius, 0, kvImageEdgeExtend); + vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, NULL, 0, 0, (uint32_t)radius, (uint32_t)radius, 0, kvImageEdgeExtend); + vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, (uint32_t)radius, (uint32_t)radius, 0, kvImageEdgeExtend); + } + BOOL effectImageBuffersAreSwapped = NO; + if (hasSaturationChange) { + CGFloat s = saturationDeltaFactor; + CGFloat floatingPointSaturationMatrix[] = { + 0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0, + 0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0, + 0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0, + 0, 0, 0, 1, + }; + const int32_t divisor = 256; + NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]); + int16_t saturationMatrix[matrixSize]; + for (NSUInteger i = 0; i < matrixSize; ++i) { + saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor); + } + if (hasBlur) { + vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); + effectImageBuffersAreSwapped = YES; + } + else { + vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); + } + } + if (!effectImageBuffersAreSwapped) + effectImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + if (effectImageBuffersAreSwapped) + effectImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + } + + // Set up output context. + UIGraphicsBeginImageContextWithOptions(self.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef outputContext = UIGraphicsGetCurrentContext(); + CGContextScaleCTM(outputContext, 1.0, -1.0); + CGContextTranslateCTM(outputContext, 0, -self.size.height); + + // Draw base image. + CGContextDrawImage(outputContext, imageRect, self.CGImage); + + // Draw effect image. + if (hasBlur) { + CGContextSaveGState(outputContext); + if (maskImage) { + CGContextClipToMask(outputContext, imageRect, maskImage.CGImage); + } + CGContextDrawImage(outputContext, imageRect, effectImage.CGImage); + CGContextRestoreGState(outputContext); + } + + // Add in color tint. + if (tintColor) { + CGContextSaveGState(outputContext); + CGContextSetFillColorWithColor(outputContext, tintColor.CGColor); + CGContextFillRect(outputContext, imageRect); + CGContextRestoreGState(outputContext); + } + + // Output image is ready. + UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return outputImage; +} + -@end +@end \ No newline at end of file diff --git a/TapkuLibrary/UIImagePickerController+TKCategory.h b/TapkuLibrary/UIImagePickerController+TKCategory.h new file mode 100644 index 00000000..d2742377 --- /dev/null +++ b/TapkuLibrary/UIImagePickerController+TKCategory.h @@ -0,0 +1,46 @@ +// +// UIImagePickerController+TKCategory.h +// Created by Devin Ross on 5/17/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UIImagePickerController`. */ +@interface UIImagePickerController (TKCategory) + +/** The device has a camera. */ ++ (BOOL) hasCamera; + +/** The device has a front facing camera. */ ++ (BOOL) hasFrontCamera; + +/** The device has a rear facing camera. */ ++ (BOOL) hasRearCamera; + +@end diff --git a/TapkuLibrary/UIImagePickerController+TKCategory.m b/TapkuLibrary/UIImagePickerController+TKCategory.m new file mode 100644 index 00000000..06a6bc85 --- /dev/null +++ b/TapkuLibrary/UIImagePickerController+TKCategory.m @@ -0,0 +1,48 @@ +// +// UIImagePickerController+TKCategory.m +// Created by Devin Ross on 5/17/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIImagePickerController+TKCategory.h" + +@implementation UIImagePickerController (TKCategory) + ++ (BOOL) hasCamera{ + return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; +} + ++ (BOOL) hasFrontCamera{ + return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]; +} + ++ (BOOL) hasRearCamera{ + return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]; +} + +@end diff --git a/TapkuLibrary/UIImageView+TKCategory.h b/TapkuLibrary/UIImageView+TKCategory.h new file mode 100644 index 00000000..50849da2 --- /dev/null +++ b/TapkuLibrary/UIImageView+TKCategory.h @@ -0,0 +1,50 @@ +// +// UIImageView+TKCategory.h +// Created by Devin Ross on 12/12/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; + +/** Additional functionality for `UIImageView`. */ +@interface UIImageView (TKCategory) + +/** Returns a image view with an image of the given image name. + @param imageName The name of the image to create the imagename with. + @return Returns `UIImageView` object. + */ ++ (UIImageView*) imageViewWithImageNamed:(NSString*)imageName; + +/** Returns a image view with the given frame. + @param frame The frame of the view. + @return Returns `UIImageView` object. + */ ++ (UIImageView*) imageViewWithFrame:(CGRect)frame; + +@end diff --git a/TapkuLibrary/UIImageView+TKCategory.m b/TapkuLibrary/UIImageView+TKCategory.m new file mode 100644 index 00000000..b86163a1 --- /dev/null +++ b/TapkuLibrary/UIImageView+TKCategory.m @@ -0,0 +1,45 @@ +// +// UIImageView+TKCategory.m +// Created by Devin Ross on 12/12/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIImageView+TKCategory.h" + + +@implementation UIImageView (TKCategory) + ++ (instancetype) imageViewWithImageNamed:(NSString*)imageName{ + return [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; +} + ++ (instancetype) imageViewWithFrame:(CGRect)frame{ + return [[UIImageView alloc] initWithFrame:frame]; +} + +@end diff --git a/TapkuLibrary/UILabel+TKCategory.h b/TapkuLibrary/UILabel+TKCategory.h new file mode 100644 index 00000000..1ff24929 --- /dev/null +++ b/TapkuLibrary/UILabel+TKCategory.h @@ -0,0 +1,39 @@ +// +// UILabel+TKCategory.h +// Created by Devin Ross on 10/7/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface UILabel (TKCategory) + +- (void) sizeToFitWithAlignment; +- (void) sizeToFitWithAlignmentAndVerticalCentering; + +@end diff --git a/TapkuLibrary/UILabel+TKCategory.m b/TapkuLibrary/UILabel+TKCategory.m new file mode 100644 index 00000000..c9f53ac3 --- /dev/null +++ b/TapkuLibrary/UILabel+TKCategory.m @@ -0,0 +1,66 @@ +// +// UILabel+TKCategory.m +// Created by Devin Ross on 10/7/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UILabel+TKCategory.h" + +@implementation UILabel (TKCategory) + +- (void) sizeToFitWithAlignment{ + + if(self.textAlignment != NSTextAlignmentCenter && self.textAlignment != NSTextAlignmentRight){ + [self sizeToFit]; + return; + } + + CGRect frame = self.frame; + [self sizeToFit]; + + CGRect newFrame = self.frame; + NSInteger xPad = (CGRectGetWidth(frame) - CGRectGetWidth(newFrame)); + if(self.textAlignment == NSTextAlignmentCenter) + xPad /= 2; + newFrame.origin.x = CGRectGetMinX(frame) + xPad; + self.frame = newFrame; + +} + +- (void) sizeToFitWithAlignmentAndVerticalCentering{ + + CGRect frame = self.frame; + [self sizeToFitWithAlignment]; + CGRect newFrame = self.frame; + NSInteger yPad = (CGRectGetHeight(frame) - CGRectGetHeight(newFrame)) / 2; + newFrame.origin.y = CGRectGetMinY(frame) + yPad; + self.frame = newFrame; + +} + +@end diff --git a/TapkuLibrary/UINavigationBar+TKCategory.h b/TapkuLibrary/UINavigationBar+TKCategory.h new file mode 100644 index 00000000..e52d9c3f --- /dev/null +++ b/TapkuLibrary/UINavigationBar+TKCategory.h @@ -0,0 +1,38 @@ +// +// UINavigationBar+TKCategory.h +// Created by Devin Ross on 3/4/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface UINavigationBar (TKCategory) + +@property (nonatomic, readonly, strong) UIView *hairlineDividerView; + +@end \ No newline at end of file diff --git a/TapkuLibrary/UINavigationBar+TKCategory.m b/TapkuLibrary/UINavigationBar+TKCategory.m new file mode 100644 index 00000000..1d4d525a --- /dev/null +++ b/TapkuLibrary/UINavigationBar+TKCategory.m @@ -0,0 +1,53 @@ +// +// UINavigationBar+TKCategory.m +// Created by Devin Ross on 3/4/14. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UINavigationBar+TKCategory.h" + +@implementation UINavigationBar (TKCategory) + +- (UIView*) hairlineDividerView{ + return [self _hairlineViewUnder:self]; +} + +- (UIView*) _hairlineViewUnder:(UIView *)view { + if (([view isKindOfClass:UIImageView.class] && CGRectGetHeight(view.bounds) == 0.5) || (CGRectGetHeight(view.frame) == 1)) { + return view; + } + for (UIView *subview in view.subviews) { + UIView *hairline = [self _hairlineViewUnder:subview]; + if (hairline) { + return hairline; + } + } + return nil; +} + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIScreen+TKCategory.h b/TapkuLibrary/UIScreen+TKCategory.h new file mode 100644 index 00000000..2b9ceda8 --- /dev/null +++ b/TapkuLibrary/UIScreen+TKCategory.h @@ -0,0 +1,38 @@ +// +// TKCategory+UIScreen.h +// Created by Devin Ross on 8/31/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + + +@interface UIScreen (TKCategory) + +@property (nonatomic, readonly) CGFloat onePixelSize; + +@end diff --git a/TapkuLibrary/UIScreen+TKCategory.m b/TapkuLibrary/UIScreen+TKCategory.m new file mode 100644 index 00000000..70dd99b8 --- /dev/null +++ b/TapkuLibrary/UIScreen+TKCategory.m @@ -0,0 +1,40 @@ +// +// UIScreen+TKCategory.m +// Created by Devin Ross on 8/31/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIScreen+TKCategory.h" + +@implementation UIScreen (TKCategory) + +- (CGFloat) onePixelSize{ + return 1.0f / self.scale; +} + +@end diff --git a/TapkuLibrary/UIScrollview+TKCategory.h b/TapkuLibrary/UIScrollview+TKCategory.h new file mode 100644 index 00000000..7a871522 --- /dev/null +++ b/TapkuLibrary/UIScrollview+TKCategory.h @@ -0,0 +1,40 @@ +// +// UIScrollview+TKCategory.h +// Created by Devin Ross on 11/17/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UIScrollView`. */ +@interface UIScrollView (TKCategory) + +/** Sets the content offset of the scrollview to zero (0,0). */ +- (void) scrollToTop; + +@end diff --git a/TapkuLibrary/UIScrollview+TKCategory.m b/TapkuLibrary/UIScrollview+TKCategory.m new file mode 100644 index 00000000..a11fcc9d --- /dev/null +++ b/TapkuLibrary/UIScrollview+TKCategory.m @@ -0,0 +1,41 @@ +// +// UIScrollview+TKCategory.m +// Created by Devin Ross on 11/17/10. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +#import "UIScrollview+TKCategory.h" + + +@implementation UIScrollView (TKCategory) + + +- (void) scrollToTop{ + self.contentOffset = CGPointMake( -self.contentInset.left, -self.contentInset.top); +} + +@end diff --git a/TapkuLibrary/UITextField+TKCategory.h b/TapkuLibrary/UITextField+TKCategory.h new file mode 100644 index 00000000..95219dd6 --- /dev/null +++ b/TapkuLibrary/UITextField+TKCategory.h @@ -0,0 +1,44 @@ +// +// UITextField+TKCategory.h +// Created by Devin Ross on 7/5/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +/** Additional functionality for `UITextField`. */ + +@interface UITextField (TKCategory) + + +/** Changes the cursor position. A range length of zero will move the cursor and not select text. + @param range The range of the selection. + */ +- (void) selectTextAtRange:(NSRange)range; + +@end \ No newline at end of file diff --git a/TapkuLibrary/UITextField+TKCategory.m b/TapkuLibrary/UITextField+TKCategory.m new file mode 100644 index 00000000..24472a51 --- /dev/null +++ b/TapkuLibrary/UITextField+TKCategory.m @@ -0,0 +1,42 @@ +// +// UITextField+TKCategory.m +// Created by Devin Ross on 7/5/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UITextField+TKCategory.h" + +@implementation UITextField (TKCategory) + +- (void) selectTextAtRange:(NSRange)range{ + UITextPosition *start = [self positionFromPosition:[self beginningOfDocument] offset:range.location]; + UITextPosition *end = [self positionFromPosition:start offset:range.length]; + [self setSelectedTextRange:[self textRangeFromPosition:start toPosition:end]]; +} + +@end diff --git a/TapkuLibrary/UIView+TKCategory.h b/TapkuLibrary/UIView+TKCategory.h new file mode 100755 index 00000000..23e45aff --- /dev/null +++ b/TapkuLibrary/UIView+TKCategory.h @@ -0,0 +1,50 @@ +// +// UIViewAdditions.h +// Created by Devin Ross on 7/25/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + + +@import UIKit; +@import QuartzCore; + +/** Additional functionality for `UIView`. */ +@interface UIView (TKCategory) + +/** Adds a view to the beginning of the receiver’s list of subviews. + @param view The view to be added. This view is retained by the receiver. After being added, this view appears below of any other subviews. + */ +- (void) addSubviewToBack:(UIView*)view; + +/** Rounds of views frame coordinates to the nearest integer. */ +- (void) roundOffFrame; + + +- (UIImage*) snapshotImageAfterScreenUpdates:(BOOL)updates; + +@end \ No newline at end of file diff --git a/TapkuLibrary/UIView+TKCategory.m b/TapkuLibrary/UIView+TKCategory.m new file mode 100755 index 00000000..1908f7fc --- /dev/null +++ b/TapkuLibrary/UIView+TKCategory.m @@ -0,0 +1,61 @@ +// +// UIViewAdditions.m +// Created by Devin Ross on 7/25/09. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ +#import "UIView+TKCategory.h" + + +@implementation UIView (TKCategory) + + +- (void) addSubviewToBack:(UIView*)view{ + [self insertSubview:view atIndex:0]; +} + + +- (void) roundOffFrame{ + self.frame = CGRectMake(roundf(CGRectGetMinX(self.frame)), roundf(CGRectGetMinY(self.frame)), roundf(CGRectGetWidth(self.frame)), roundf(CGRectGetHeight(self.frame))); +} + + + + +- (UIImage*) snapshotImageAfterScreenUpdates:(BOOL)updates{ + + UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, [UIScreen mainScreen].scale); + [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:updates]; + UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return img; +} + + + +@end diff --git a/TapkuLibrary/UIViewController+TKCategory.h b/TapkuLibrary/UIViewController+TKCategory.h new file mode 100644 index 00000000..1ae8ee08 --- /dev/null +++ b/TapkuLibrary/UIViewController+TKCategory.h @@ -0,0 +1,38 @@ +// +// UIViewController+TKCategory.h +// Created by Devin Ross on 8/23/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +@import UIKit; + +@interface UIViewController (TKCategory) + +- (void) presentNavigationControllerWithRoot:(UIViewController *)rootViewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion; + +@end diff --git a/TapkuLibrary/UIViewController+TKCategory.m b/TapkuLibrary/UIViewController+TKCategory.m new file mode 100644 index 00000000..6a0ce5f4 --- /dev/null +++ b/TapkuLibrary/UIViewController+TKCategory.m @@ -0,0 +1,44 @@ +// +// UIViewController+TKCategory.m +// Created by Devin Ross on 8/23/13. +// +/* + + tapku || http://github.com/devinross/tapkulibrary + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + */ + +#import "UIViewController+TKCategory.h" + +@implementation UIViewController (TKCategory) + +- (void) presentNavigationControllerWithRoot:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion{ + UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewControllerToPresent]; + nav.modalPresentationStyle = viewControllerToPresent.modalPresentationStyle; + [self presentViewController:nav animated:flag completion:completion]; +} + + + +@end diff --git a/Tests/FoundationTests.m b/Tests/FoundationTests.m deleted file mode 100644 index 71364c03..00000000 --- a/Tests/FoundationTests.m +++ /dev/null @@ -1,72 +0,0 @@ -// -// FoundationTests.m -// Created by Devin Ross on 4/6/11. -// -/* - - tapku || http://github.com/devinross/tapkulibrary - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - -*/ - -#import "FoundationTests.h" - -@implementation FoundationTests - - -- (void) testShouldCreateExpectedDate{ - - NSDate *date,*date2; - - date = [NSDate date]; - XCTAssertTrue([date isToday],@"Expected %@ is today.",date); - - date = [NSDate yesterday]; - XCTAssertFalse([date isToday],@"Expected %@ is not today.",date); - - date = [NSDate dateWithTimeIntervalSinceNow:-60 * 60 * 40]; - XCTAssertFalse([date isToday],@"Expected %@ is not today.",date); - - - date = [NSDate yesterday]; - date2 = [NSDate date]; - XCTAssertFalse([date isSameDay:date2],@"Expected %@ is not same day as %@.",date,date2); - - - date = [NSDate date]; - NSDateComponents *comp = [date dateComponentsWithTimeZone:[NSTimeZone defaultTimeZone]]; - comp.day = 1; - comp.hour = comp.minute = comp.second = 0; - date2 = [NSDate dateWithDateComponents:comp]; - - XCTAssertTrue([date2 isSameDay:[date monthDate] timeZone:[NSTimeZone defaultTimeZone]], @"Expected %@ is same day as %@.",date2,date); - - date = [NSDate date]; - date2 = [NSDate yesterday]; - NSInteger diff = [date daysBetweenDate:date2]; - XCTAssertEqualObjects(@(diff), @1, @"Expected difference between %@ and %@ is 1, but found %@.",date,date2,@(diff)); - -} - - -@end diff --git a/Vendor/curry b/Vendor/curry deleted file mode 160000 index 63720ea6..00000000 --- a/Vendor/curry +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 63720ea61457d228943e2c5086373f71620d4495 diff --git a/tapku.xcodeproj/project.pbxproj b/tapku.xcodeproj/project.pbxproj deleted file mode 100755 index 873f320f..00000000 --- a/tapku.xcodeproj/project.pbxproj +++ /dev/null @@ -1,929 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 20251C0F1ABA1E1A004D6851 /* NSDate+CalendarGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 207DFF9015E1E3BE00A0BC2A /* NSDate+CalendarGrid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C73E61ABA0EA600A68988 /* tapku.h in Headers */ = {isa = PBXBuildFile; fileRef = 204C73E51ABA0EA600A68988 /* tapku.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74061ABA0F9400A68988 /* TapkuLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A1B10953E5200F235F1 /* TapkuLibrary.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74071ABA0F9400A68988 /* TKGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A1D10953E5200F235F1 /* TKGlobal.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74151ABA0F9400A68988 /* UIImage+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A1F10953E5200F235F1 /* UIImage+TKCategory.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74251ABA0F9500A68988 /* TKAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B9D93D812F74F8F007D839C /* TKAppDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74271ABA0F9500A68988 /* TKViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B819B5214601DC400EC0097 /* TKViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C742A1ABA0F9500A68988 /* TKAlertViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 202DD0C9188EF01200D5541E /* TKAlertViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74311ABA0F9500A68988 /* TKNetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B17D287142E3CD40090616F /* TKNetworkQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74321ABA0F9500A68988 /* TKHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B17D26A142E31C40090616F /* TKHTTPRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74331ABA0F9500A68988 /* TKImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B560B7014574E30005FBDBF /* TKImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74341ABA0F9500A68988 /* TKCalendarMonthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC99FE10953E2400F235F1 /* TKCalendarMonthViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74351ABA0F9500A68988 /* TKCalendarMonthTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B879FC4109BFC07002012FD /* TKCalendarMonthTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74361ABA0F9600A68988 /* TKCalendarMonthView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B9724B911C54C5C0027A97F /* TKCalendarMonthView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74381ABA0F9600A68988 /* TKCalendarDayViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74391ABA0F9600A68988 /* TKCalendarDayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C743A1ABA0F9600A68988 /* TKCalendarDayEventView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C743C1ABA0F9600A68988 /* TKAlertCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BD32970125B753900BE5EAF /* TKAlertCenter.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C743D1ABA0F9600A68988 /* TKProgressAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BA577B81199DF1600ECB85B /* TKProgressAlertView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C743E1ABA0F9600A68988 /* TKProgressBarView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB92D2011896022002FA0F9 /* TKProgressBarView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C743F1ABA0F9600A68988 /* TKProgressCircleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEE1CB912CFB78300FECF6D /* TKProgressCircleView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74401ABA0F9600A68988 /* TKLabelCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A2710953E5200F235F1 /* TKLabelCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74411ABA0F9600A68988 /* TKLabelFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A2910953E5200F235F1 /* TKLabelFieldCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74421ABA0F9600A68988 /* TKLabelSwitchCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A2B10953E5200F235F1 /* TKLabelSwitchCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74431ABA0F9600A68988 /* TKLabelTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A2D10953E5200F235F1 /* TKLabelTextFieldCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74441ABA0F9600A68988 /* TKLabelTextViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A2F10953E5200F235F1 /* TKLabelTextViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74451ABA0F9600A68988 /* TKButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A3110953E5200F235F1 /* TKButtonCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74481ABA0F9700A68988 /* TKTextViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A3510953E5200F235F1 /* TKTextViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74491ABA0F9700A68988 /* TKTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A3C10953E5200F235F1 /* TKTableViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C744B1ABA0F9700A68988 /* TKCoverflowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2057363216A330E700F8CDE6 /* TKCoverflowView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C744C1ABA0F9700A68988 /* TKEmptyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A4E10953E5200F235F1 /* TKEmptyView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C744D1ABA0F9700A68988 /* TKReorderTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2014592617A1077D00629488 /* TKReorderTableView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C74521ABA0F9800A68988 /* TKRetroButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 20DAFB011814BAAC00EF525B /* TKRetroButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 204C745D1ABA0FFC00A68988 /* TKGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A1E10953E5200F235F1 /* TKGlobal.m */; }; - 204C746B1ABA0FFC00A68988 /* UIImage+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2010953E5200F235F1 /* UIImage+TKCategory.m */; }; - 204C747B1ABA0FFC00A68988 /* TKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B9D93D912F74F8F007D839C /* TKAppDelegate.m */; }; - 204C747D1ABA0FFC00A68988 /* TKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B819B5314601DC500EC0097 /* TKViewController.m */; }; - 204C74801ABA0FFC00A68988 /* TKAlertViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 202DD0CA188EF01200D5541E /* TKAlertViewController.m */; }; - 204C74871ABA0FFC00A68988 /* TKNetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B17D288142E3CD40090616F /* TKNetworkQueue.m */; }; - 204C74881ABA0FFC00A68988 /* TKHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B17D26B142E31C40090616F /* TKHTTPRequest.m */; }; - 204C74891ABA0FFC00A68988 /* TKImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B560B7114574E30005FBDBF /* TKImageCache.m */; }; - 204C748A1ABA0FFC00A68988 /* TKCalendarMonthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC99FF10953E2400F235F1 /* TKCalendarMonthViewController.m */; }; - 204C748B1ABA0FFC00A68988 /* TKCalendarMonthTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B879FC5109BFC07002012FD /* TKCalendarMonthTableViewController.m */; }; - 204C748C1ABA0FFC00A68988 /* TKCalendarMonthView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B9724BA11C54C5C0027A97F /* TKCalendarMonthView.m */; }; - 204C748D1ABA0FFC00A68988 /* NSDate+CalendarGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 207DFF9115E1E3BE00A0BC2A /* NSDate+CalendarGrid.m */; }; - 204C748E1ABA0FFC00A68988 /* TKCalendarDayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */; }; - 204C748F1ABA0FFC00A68988 /* TKCalendarDayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */; }; - 204C74901ABA0FFC00A68988 /* TKCalendarDayEventView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */; }; - 204C74921ABA0FFC00A68988 /* TKAlertCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BD32971125B753900BE5EAF /* TKAlertCenter.m */; }; - 204C74931ABA0FFC00A68988 /* TKProgressAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BA577B91199DF1600ECB85B /* TKProgressAlertView.m */; }; - 204C74941ABA0FFC00A68988 /* TKProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB92D2111896022002FA0F9 /* TKProgressBarView.m */; }; - 204C74951ABA0FFC00A68988 /* TKProgressCircleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEE1CBA12CFB78300FECF6D /* TKProgressCircleView.m */; }; - 204C74961ABA0FFC00A68988 /* TKLabelCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2810953E5200F235F1 /* TKLabelCell.m */; }; - 204C74971ABA0FFC00A68988 /* TKLabelFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2A10953E5200F235F1 /* TKLabelFieldCell.m */; }; - 204C74981ABA0FFC00A68988 /* TKLabelSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2C10953E5200F235F1 /* TKLabelSwitchCell.m */; }; - 204C74991ABA0FFC00A68988 /* TKLabelTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2E10953E5200F235F1 /* TKLabelTextFieldCell.m */; }; - 204C749A1ABA0FFC00A68988 /* TKLabelTextViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A3010953E5200F235F1 /* TKLabelTextViewCell.m */; }; - 204C749B1ABA0FFC00A68988 /* TKButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A3210953E5200F235F1 /* TKButtonCell.m */; }; - 204C749E1ABA0FFC00A68988 /* TKTextViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A3610953E5200F235F1 /* TKTextViewCell.m */; }; - 204C749F1ABA0FFC00A68988 /* TKTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A3D10953E5200F235F1 /* TKTableViewCell.m */; }; - 204C74A11ABA0FFC00A68988 /* TKCoverflowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2057363316A330E700F8CDE6 /* TKCoverflowView.m */; }; - 204C74A21ABA0FFC00A68988 /* TKEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A4F10953E5200F235F1 /* TKEmptyView.m */; }; - 204C74A31ABA0FFC00A68988 /* TKReorderTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2014592717A1077D00629488 /* TKReorderTableView.m */; }; - 204C74A81ABA0FFC00A68988 /* TKRetroButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 20DAFB021814BAAC00EF525B /* TKRetroButton.m */; }; - 20CE10C41860A6A500249216 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20CE10C21860A62B00249216 /* XCTest.framework */; }; - 20F1563E1B44A33700D49391 /* curry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20F1563A1B44A31700D49391 /* curry.framework */; }; - 3B859EAD134C73D600661088 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BAC995710953DF400F235F1 /* UIKit.framework */; }; - 3B859EAE134C73DE00661088 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - 3B859EB0134C73EF00661088 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BAC995810953DF400F235F1 /* QuartzCore.framework */; }; - 3B89162B134D93D000BD2B31 /* FoundationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B89162A134D93D000BD2B31 /* FoundationTests.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 2002F2361BB54A0900B565DA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 20F156331B44A31600D49391 /* curry.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 20CEA42B1BA1105D0009D60C; - remoteInfo = curryTV; - }; - 2002F2381BB54A0900B565DA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 20F156331B44A31600D49391 /* curry.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2010DCB01BB0E40E00810A98; - remoteInfo = curryWatch; - }; - 2002F23A1BB54A0900B565DA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 20F156331B44A31600D49391 /* curry.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 20B5FE1F1BB3613F00C0F848; - remoteInfo = curryMac; - }; - 20F156391B44A31700D49391 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 20F156331B44A31600D49391 /* curry.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 200B62551AD7FB460049E35C; - remoteInfo = curry; - }; - 20F1563B1B44A31700D49391 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 20F156331B44A31600D49391 /* curry.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 200B62601AD7FB460049E35C; - remoteInfo = curryTests; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 2014592617A1077D00629488 /* TKReorderTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKReorderTableView.h; sourceTree = ""; }; - 2014592717A1077D00629488 /* TKReorderTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKReorderTableView.m; sourceTree = ""; }; - 202DD0C9188EF01200D5541E /* TKAlertViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAlertViewController.h; sourceTree = ""; }; - 202DD0CA188EF01200D5541E /* TKAlertViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAlertViewController.m; sourceTree = ""; }; - 204C73E11ABA0EA600A68988 /* tapku.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = tapku.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 204C73E41ABA0EA600A68988 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = tapku/Info.plist; sourceTree = ""; }; - 204C73E51ABA0EA600A68988 /* tapku.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tapku.h; path = tapku/tapku.h; sourceTree = ""; }; - 2057363216A330E700F8CDE6 /* TKCoverflowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCoverflowView.h; sourceTree = ""; }; - 2057363316A330E700F8CDE6 /* TKCoverflowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCoverflowView.m; sourceTree = ""; }; - 207DFF9015E1E3BE00A0BC2A /* NSDate+CalendarGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+CalendarGrid.h"; sourceTree = ""; }; - 207DFF9115E1E3BE00A0BC2A /* NSDate+CalendarGrid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+CalendarGrid.m"; sourceTree = ""; }; - 20CE10C21860A62B00249216 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - 20DAFB011814BAAC00EF525B /* TKRetroButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRetroButton.h; sourceTree = ""; }; - 20DAFB021814BAAC00EF525B /* TKRetroButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRetroButton.m; sourceTree = ""; }; - 20F156331B44A31600D49391 /* curry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = curry.xcodeproj; path = Vendor/curry/curry.xcodeproj; sourceTree = ""; }; - 20F6153917E6741D007F443C /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - 3B17D26A142E31C40090616F /* TKHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKHTTPRequest.h; sourceTree = ""; }; - 3B17D26B142E31C40090616F /* TKHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKHTTPRequest.m; sourceTree = ""; }; - 3B17D287142E3CD40090616F /* TKNetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKNetworkQueue.h; sourceTree = ""; }; - 3B17D288142E3CD40090616F /* TKNetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKNetworkQueue.m; sourceTree = ""; }; - 3B45DDF1134C736600D24C1A /* LogicTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LogicTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 3B45DDF2134C736600D24C1A /* LogicTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LogicTests-Info.plist"; sourceTree = ""; }; - 3B560B7014574E30005FBDBF /* TKImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKImageCache.h; sourceTree = ""; }; - 3B560B7114574E30005FBDBF /* TKImageCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKImageCache.m; sourceTree = ""; }; - 3B819B5214601DC400EC0097 /* TKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKViewController.h; sourceTree = ""; }; - 3B819B5314601DC500EC0097 /* TKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKViewController.m; sourceTree = ""; }; - 3B879FC4109BFC07002012FD /* TKCalendarMonthTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthTableViewController.h; sourceTree = ""; }; - 3B879FC5109BFC07002012FD /* TKCalendarMonthTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthTableViewController.m; sourceTree = ""; }; - 3B891629134D93D000BD2B31 /* FoundationTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FoundationTests.h; path = Tests/FoundationTests.h; sourceTree = ""; }; - 3B89162A134D93D000BD2B31 /* FoundationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FoundationTests.m; path = Tests/FoundationTests.m; sourceTree = ""; }; - 3B9724B911C54C5C0027A97F /* TKCalendarMonthView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthView.h; sourceTree = ""; }; - 3B9724BA11C54C5C0027A97F /* TKCalendarMonthView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthView.m; sourceTree = ""; }; - 3B9D93D812F74F8F007D839C /* TKAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAppDelegate.h; sourceTree = ""; }; - 3B9D93D912F74F8F007D839C /* TKAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAppDelegate.m; sourceTree = ""; }; - 3BA577B81199DF1600ECB85B /* TKProgressAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressAlertView.h; sourceTree = ""; }; - 3BA577B91199DF1600ECB85B /* TKProgressAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressAlertView.m; sourceTree = ""; }; - 3BAC995610953DF400F235F1 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 3BAC995710953DF400F235F1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 3BAC995810953DF400F235F1 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 3BAC99FE10953E2400F235F1 /* TKCalendarMonthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthViewController.h; sourceTree = ""; }; - 3BAC99FF10953E2400F235F1 /* TKCalendarMonthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthViewController.m; sourceTree = ""; }; - 3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayEventView.h; sourceTree = ""; }; - 3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayEventView.m; sourceTree = ""; }; - 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayView.h; sourceTree = ""; }; - 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayView.m; sourceTree = ""; }; - 3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayViewController.h; sourceTree = ""; }; - 3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayViewController.m; sourceTree = ""; }; - 3BAC9A1B10953E5200F235F1 /* TapkuLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TapkuLibrary.h; sourceTree = ""; }; - 3BAC9A1D10953E5200F235F1 /* TKGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGlobal.h; sourceTree = ""; }; - 3BAC9A1E10953E5200F235F1 /* TKGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGlobal.m; sourceTree = ""; }; - 3BAC9A1F10953E5200F235F1 /* UIImage+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TKCategory.h"; sourceTree = ""; }; - 3BAC9A2010953E5200F235F1 /* UIImage+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TKCategory.m"; sourceTree = ""; }; - 3BAC9A2710953E5200F235F1 /* TKLabelCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelCell.h; sourceTree = ""; }; - 3BAC9A2810953E5200F235F1 /* TKLabelCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelCell.m; sourceTree = ""; }; - 3BAC9A2910953E5200F235F1 /* TKLabelFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelFieldCell.h; sourceTree = ""; }; - 3BAC9A2A10953E5200F235F1 /* TKLabelFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelFieldCell.m; sourceTree = ""; }; - 3BAC9A2B10953E5200F235F1 /* TKLabelSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelSwitchCell.h; sourceTree = ""; }; - 3BAC9A2C10953E5200F235F1 /* TKLabelSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelSwitchCell.m; sourceTree = ""; }; - 3BAC9A2D10953E5200F235F1 /* TKLabelTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelTextFieldCell.h; sourceTree = ""; }; - 3BAC9A2E10953E5200F235F1 /* TKLabelTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelTextFieldCell.m; sourceTree = ""; }; - 3BAC9A2F10953E5200F235F1 /* TKLabelTextViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKLabelTextViewCell.h; sourceTree = ""; }; - 3BAC9A3010953E5200F235F1 /* TKLabelTextViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKLabelTextViewCell.m; sourceTree = ""; }; - 3BAC9A3110953E5200F235F1 /* TKButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKButtonCell.h; sourceTree = ""; }; - 3BAC9A3210953E5200F235F1 /* TKButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKButtonCell.m; sourceTree = ""; }; - 3BAC9A3510953E5200F235F1 /* TKTextViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTextViewCell.h; sourceTree = ""; }; - 3BAC9A3610953E5200F235F1 /* TKTextViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTextViewCell.m; sourceTree = ""; }; - 3BAC9A3C10953E5200F235F1 /* TKTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKTableViewCell.h; sourceTree = ""; }; - 3BAC9A3D10953E5200F235F1 /* TKTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKTableViewCell.m; sourceTree = ""; }; - 3BAC9A4E10953E5200F235F1 /* TKEmptyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKEmptyView.h; sourceTree = ""; }; - 3BAC9A4F10953E5200F235F1 /* TKEmptyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKEmptyView.m; sourceTree = ""; }; - 3BB92D2011896022002FA0F9 /* TKProgressBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressBarView.h; sourceTree = ""; }; - 3BB92D2111896022002FA0F9 /* TKProgressBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressBarView.m; sourceTree = ""; }; - 3BD32970125B753900BE5EAF /* TKAlertCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAlertCenter.h; sourceTree = ""; }; - 3BD32971125B753900BE5EAF /* TKAlertCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAlertCenter.m; sourceTree = ""; }; - 3BEE1CB912CFB78300FECF6D /* TKProgressCircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKProgressCircleView.h; sourceTree = ""; }; - 3BEE1CBA12CFB78300FECF6D /* TKProgressCircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKProgressCircleView.m; sourceTree = ""; }; - AA747D9E0F9514B9006C5449 /* tapku_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tapku_Prefix.pch; sourceTree = ""; }; - AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 204C73DD1ABA0EA600A68988 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 20F1563E1B44A33700D49391 /* curry.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3B45DDEE134C736600D24C1A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 20CE10C41860A6A500249216 /* XCTest.framework in Frameworks */, - 3B859EAD134C73D600661088 /* UIKit.framework in Frameworks */, - 3B859EAE134C73DE00661088 /* Foundation.framework in Frameworks */, - 3B859EB0134C73EF00661088 /* QuartzCore.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 3B45DDF1134C736600D24C1A /* LogicTests.xctest */, - 204C73E11ABA0EA600A68988 /* tapku.framework */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* TapkuLibrary */ = { - isa = PBXGroup; - children = ( - 3BAC98C910953DCC00F235F1 /* tapku */, - 3B859EDF134C753E00661088 /* UnitTests */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 20F1563D1B44A31D00D49391 /* Vendor */, - 0867D69AFE84028FC02AAC07 /* Frameworks */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = TapkuLibrary; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 20CE10C21860A62B00249216 /* XCTest.framework */, - AACBBE490F95108600F1A2B1 /* Foundation.framework */, - 3BAC995710953DF400F235F1 /* UIKit.framework */, - 3BAC995610953DF400F235F1 /* CoreGraphics.framework */, - 3BAC995810953DF400F235F1 /* QuartzCore.framework */, - 20F6153917E6741D007F443C /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 20F156341B44A31600D49391 /* Products */ = { - isa = PBXGroup; - children = ( - 20F1563A1B44A31700D49391 /* curry.framework */, - 20F1563C1B44A31700D49391 /* curryTests.xctest */, - 2002F2371BB54A0900B565DA /* curryTV.framework */, - 2002F2391BB54A0900B565DA /* curryWatch.framework */, - 2002F23B1BB54A0900B565DA /* curryMac.framework */, - ); - name = Products; - sourceTree = ""; - }; - 20F1563D1B44A31D00D49391 /* Vendor */ = { - isa = PBXGroup; - children = ( - 20F156331B44A31600D49391 /* curry.xcodeproj */, - ); - name = Vendor; - sourceTree = ""; - }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - AA747D9E0F9514B9006C5449 /* tapku_Prefix.pch */, - 204C73E51ABA0EA600A68988 /* tapku.h */, - 204C73E41ABA0EA600A68988 /* Info.plist */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 3B345A6E142E4F870075E654 /* Network */ = { - isa = PBXGroup; - children = ( - 3B17D287142E3CD40090616F /* TKNetworkQueue.h */, - 3B17D288142E3CD40090616F /* TKNetworkQueue.m */, - 3B17D26A142E31C40090616F /* TKHTTPRequest.h */, - 3B17D26B142E31C40090616F /* TKHTTPRequest.m */, - 3B560B7014574E30005FBDBF /* TKImageCache.h */, - 3B560B7114574E30005FBDBF /* TKImageCache.m */, - ); - name = Network; - sourceTree = ""; - }; - 3B859EDF134C753E00661088 /* UnitTests */ = { - isa = PBXGroup; - children = ( - 3B45DDF2134C736600D24C1A /* LogicTests-Info.plist */, - 3B891629134D93D000BD2B31 /* FoundationTests.h */, - 3B89162A134D93D000BD2B31 /* FoundationTests.m */, - ); - name = UnitTests; - sourceTree = ""; - }; - 3BAC98C910953DCC00F235F1 /* tapku */ = { - isa = PBXGroup; - children = ( - 3BAC9A1B10953E5200F235F1 /* TapkuLibrary.h */, - 3BBF8A4012970B10008AB2B1 /* Core */, - 3B345A6E142E4F870075E654 /* Network */, - 3BBF8A4112970B3E008AB2B1 /* UI */, - ); - name = tapku; - path = TapkuLibrary; - sourceTree = ""; - }; - 3BAC99F910953E2400F235F1 /* Calendar */ = { - isa = PBXGroup; - children = ( - 3BF002FE109662E30062DA49 /* Month */, - 3BAC9A0010953E2400F235F1 /* Day */, - ); - name = Calendar; - sourceTree = ""; - }; - 3BAC9A0010953E2400F235F1 /* Day */ = { - isa = PBXGroup; - children = ( - 3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */, - 3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */, - 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */, - 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */, - 3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */, - 3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */, - ); - name = Day; - sourceTree = ""; - }; - 3BAC9A2510953E5200F235F1 /* Cells */ = { - isa = PBXGroup; - children = ( - 3BAC9A2610953E5200F235F1 /* Label */, - 3BAC9A3110953E5200F235F1 /* TKButtonCell.h */, - 3BAC9A3210953E5200F235F1 /* TKButtonCell.m */, - 3BAC9A3510953E5200F235F1 /* TKTextViewCell.h */, - 3BAC9A3610953E5200F235F1 /* TKTextViewCell.m */, - 3BAC9A3C10953E5200F235F1 /* TKTableViewCell.h */, - 3BAC9A3D10953E5200F235F1 /* TKTableViewCell.m */, - ); - name = Cells; - sourceTree = ""; - }; - 3BAC9A2610953E5200F235F1 /* Label */ = { - isa = PBXGroup; - children = ( - 3BAC9A2710953E5200F235F1 /* TKLabelCell.h */, - 3BAC9A2810953E5200F235F1 /* TKLabelCell.m */, - 3BAC9A2910953E5200F235F1 /* TKLabelFieldCell.h */, - 3BAC9A2A10953E5200F235F1 /* TKLabelFieldCell.m */, - 3BAC9A2B10953E5200F235F1 /* TKLabelSwitchCell.h */, - 3BAC9A2C10953E5200F235F1 /* TKLabelSwitchCell.m */, - 3BAC9A2D10953E5200F235F1 /* TKLabelTextFieldCell.h */, - 3BAC9A2E10953E5200F235F1 /* TKLabelTextFieldCell.m */, - 3BAC9A2F10953E5200F235F1 /* TKLabelTextViewCell.h */, - 3BAC9A3010953E5200F235F1 /* TKLabelTextViewCell.m */, - ); - name = Label; - sourceTree = ""; - }; - 3BAC9A3E10953E5200F235F1 /* Indicators */ = { - isa = PBXGroup; - children = ( - 3BD32970125B753900BE5EAF /* TKAlertCenter.h */, - 3BD32971125B753900BE5EAF /* TKAlertCenter.m */, - 3BA577B81199DF1600ECB85B /* TKProgressAlertView.h */, - 3BA577B91199DF1600ECB85B /* TKProgressAlertView.m */, - 3BB92D2011896022002FA0F9 /* TKProgressBarView.h */, - 3BB92D2111896022002FA0F9 /* TKProgressBarView.m */, - 3BEE1CB912CFB78300FECF6D /* TKProgressCircleView.h */, - 3BEE1CBA12CFB78300FECF6D /* TKProgressCircleView.m */, - ); - name = Indicators; - sourceTree = ""; - }; - 3BB3A1D1117814BC00553093 /* Categories */ = { - isa = PBXGroup; - children = ( - 3BAC9A1F10953E5200F235F1 /* UIImage+TKCategory.h */, - 3BAC9A2010953E5200F235F1 /* UIImage+TKCategory.m */, - ); - name = Categories; - sourceTree = ""; - }; - 3BBF8A4012970B10008AB2B1 /* Core */ = { - isa = PBXGroup; - children = ( - 3BAC9A1D10953E5200F235F1 /* TKGlobal.h */, - 3BAC9A1E10953E5200F235F1 /* TKGlobal.m */, - 3BB3A1D1117814BC00553093 /* Categories */, - 3B9D93D812F74F8F007D839C /* TKAppDelegate.h */, - 3B9D93D912F74F8F007D839C /* TKAppDelegate.m */, - 3B819B5214601DC400EC0097 /* TKViewController.h */, - 3B819B5314601DC500EC0097 /* TKViewController.m */, - 202DD0C9188EF01200D5541E /* TKAlertViewController.h */, - 202DD0CA188EF01200D5541E /* TKAlertViewController.m */, - ); - name = Core; - sourceTree = ""; - }; - 3BBF8A4112970B3E008AB2B1 /* UI */ = { - isa = PBXGroup; - children = ( - 3BAC99F910953E2400F235F1 /* Calendar */, - 3BAC9A3E10953E5200F235F1 /* Indicators */, - 3BAC9A2510953E5200F235F1 /* Cells */, - 2057363216A330E700F8CDE6 /* TKCoverflowView.h */, - 2057363316A330E700F8CDE6 /* TKCoverflowView.m */, - 3BAC9A4E10953E5200F235F1 /* TKEmptyView.h */, - 3BAC9A4F10953E5200F235F1 /* TKEmptyView.m */, - 2014592617A1077D00629488 /* TKReorderTableView.h */, - 2014592717A1077D00629488 /* TKReorderTableView.m */, - 20DAFB011814BAAC00EF525B /* TKRetroButton.h */, - 20DAFB021814BAAC00EF525B /* TKRetroButton.m */, - ); - name = UI; - sourceTree = ""; - }; - 3BF002FE109662E30062DA49 /* Month */ = { - isa = PBXGroup; - children = ( - 3BAC99FE10953E2400F235F1 /* TKCalendarMonthViewController.h */, - 3BAC99FF10953E2400F235F1 /* TKCalendarMonthViewController.m */, - 3B879FC4109BFC07002012FD /* TKCalendarMonthTableViewController.h */, - 3B879FC5109BFC07002012FD /* TKCalendarMonthTableViewController.m */, - 3B9724B911C54C5C0027A97F /* TKCalendarMonthView.h */, - 3B9724BA11C54C5C0027A97F /* TKCalendarMonthView.m */, - 207DFF9015E1E3BE00A0BC2A /* NSDate+CalendarGrid.h */, - 207DFF9115E1E3BE00A0BC2A /* NSDate+CalendarGrid.m */, - ); - name = Month; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 204C73DE1ABA0EA600A68988 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 204C74061ABA0F9400A68988 /* TapkuLibrary.h in Headers */, - 204C74071ABA0F9400A68988 /* TKGlobal.h in Headers */, - 204C74151ABA0F9400A68988 /* UIImage+TKCategory.h in Headers */, - 204C74251ABA0F9500A68988 /* TKAppDelegate.h in Headers */, - 204C74271ABA0F9500A68988 /* TKViewController.h in Headers */, - 204C742A1ABA0F9500A68988 /* TKAlertViewController.h in Headers */, - 204C74311ABA0F9500A68988 /* TKNetworkQueue.h in Headers */, - 204C74321ABA0F9500A68988 /* TKHTTPRequest.h in Headers */, - 204C74331ABA0F9500A68988 /* TKImageCache.h in Headers */, - 204C74341ABA0F9500A68988 /* TKCalendarMonthViewController.h in Headers */, - 204C74351ABA0F9500A68988 /* TKCalendarMonthTableViewController.h in Headers */, - 204C74361ABA0F9600A68988 /* TKCalendarMonthView.h in Headers */, - 204C74381ABA0F9600A68988 /* TKCalendarDayViewController.h in Headers */, - 204C74391ABA0F9600A68988 /* TKCalendarDayView.h in Headers */, - 204C743A1ABA0F9600A68988 /* TKCalendarDayEventView.h in Headers */, - 204C743C1ABA0F9600A68988 /* TKAlertCenter.h in Headers */, - 204C743D1ABA0F9600A68988 /* TKProgressAlertView.h in Headers */, - 204C743E1ABA0F9600A68988 /* TKProgressBarView.h in Headers */, - 204C743F1ABA0F9600A68988 /* TKProgressCircleView.h in Headers */, - 204C74401ABA0F9600A68988 /* TKLabelCell.h in Headers */, - 204C74411ABA0F9600A68988 /* TKLabelFieldCell.h in Headers */, - 204C74421ABA0F9600A68988 /* TKLabelSwitchCell.h in Headers */, - 204C74431ABA0F9600A68988 /* TKLabelTextFieldCell.h in Headers */, - 204C74441ABA0F9600A68988 /* TKLabelTextViewCell.h in Headers */, - 204C74451ABA0F9600A68988 /* TKButtonCell.h in Headers */, - 204C74481ABA0F9700A68988 /* TKTextViewCell.h in Headers */, - 204C74491ABA0F9700A68988 /* TKTableViewCell.h in Headers */, - 204C744B1ABA0F9700A68988 /* TKCoverflowView.h in Headers */, - 204C744C1ABA0F9700A68988 /* TKEmptyView.h in Headers */, - 204C744D1ABA0F9700A68988 /* TKReorderTableView.h in Headers */, - 204C74521ABA0F9800A68988 /* TKRetroButton.h in Headers */, - 20251C0F1ABA1E1A004D6851 /* NSDate+CalendarGrid.h in Headers */, - 204C73E61ABA0EA600A68988 /* tapku.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 204C73E01ABA0EA600A68988 /* tapku */ = { - isa = PBXNativeTarget; - buildConfigurationList = 204C73F81ABA0EA600A68988 /* Build configuration list for PBXNativeTarget "tapku" */; - buildPhases = ( - 204C73DC1ABA0EA600A68988 /* Sources */, - 204C73DD1ABA0EA600A68988 /* Frameworks */, - 204C73DE1ABA0EA600A68988 /* Headers */, - 204C73DF1ABA0EA600A68988 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = tapku; - productName = tapku; - productReference = 204C73E11ABA0EA600A68988 /* tapku.framework */; - productType = "com.apple.product-type.framework"; - }; - 3B45DDF0134C736600D24C1A /* LogicTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3B45DDF5134C736600D24C1A /* Build configuration list for PBXNativeTarget "LogicTests" */; - buildPhases = ( - 3B45DDEC134C736600D24C1A /* Resources */, - 3B45DDED134C736600D24C1A /* Sources */, - 3B45DDEE134C736600D24C1A /* Frameworks */, - 3B45DDEF134C736600D24C1A /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = LogicTests; - productName = LogicTests; - productReference = 3B45DDF1134C736600D24C1A /* LogicTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = TK; - LastUpgradeCheck = 0700; - TargetAttributes = { - 204C73E01ABA0EA600A68988 = { - CreatedOnToolsVersion = 6.3; - }; - }; - }; - buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "tapku" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* TapkuLibrary */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 20F156341B44A31600D49391 /* Products */; - ProjectRef = 20F156331B44A31600D49391 /* curry.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 204C73E01ABA0EA600A68988 /* tapku */, - 3B45DDF0134C736600D24C1A /* LogicTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 2002F2371BB54A0900B565DA /* curryTV.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = curryTV.framework; - remoteRef = 2002F2361BB54A0900B565DA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2002F2391BB54A0900B565DA /* curryWatch.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = curryWatch.framework; - remoteRef = 2002F2381BB54A0900B565DA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2002F23B1BB54A0900B565DA /* curryMac.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = curryMac.framework; - remoteRef = 2002F23A1BB54A0900B565DA /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 20F1563A1B44A31700D49391 /* curry.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = curry.framework; - remoteRef = 20F156391B44A31700D49391 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 20F1563C1B44A31700D49391 /* curryTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = curryTests.xctest; - remoteRef = 20F1563B1B44A31700D49391 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 204C73DF1ABA0EA600A68988 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3B45DDEC134C736600D24C1A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B45DDEF134C736600D24C1A /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\""; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 204C73DC1ABA0EA600A68988 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 204C745D1ABA0FFC00A68988 /* TKGlobal.m in Sources */, - 204C746B1ABA0FFC00A68988 /* UIImage+TKCategory.m in Sources */, - 204C747B1ABA0FFC00A68988 /* TKAppDelegate.m in Sources */, - 204C747D1ABA0FFC00A68988 /* TKViewController.m in Sources */, - 204C74801ABA0FFC00A68988 /* TKAlertViewController.m in Sources */, - 204C74871ABA0FFC00A68988 /* TKNetworkQueue.m in Sources */, - 204C74881ABA0FFC00A68988 /* TKHTTPRequest.m in Sources */, - 204C74891ABA0FFC00A68988 /* TKImageCache.m in Sources */, - 204C748A1ABA0FFC00A68988 /* TKCalendarMonthViewController.m in Sources */, - 204C748B1ABA0FFC00A68988 /* TKCalendarMonthTableViewController.m in Sources */, - 204C748C1ABA0FFC00A68988 /* TKCalendarMonthView.m in Sources */, - 204C748D1ABA0FFC00A68988 /* NSDate+CalendarGrid.m in Sources */, - 204C748E1ABA0FFC00A68988 /* TKCalendarDayViewController.m in Sources */, - 204C748F1ABA0FFC00A68988 /* TKCalendarDayView.m in Sources */, - 204C74901ABA0FFC00A68988 /* TKCalendarDayEventView.m in Sources */, - 204C74921ABA0FFC00A68988 /* TKAlertCenter.m in Sources */, - 204C74931ABA0FFC00A68988 /* TKProgressAlertView.m in Sources */, - 204C74941ABA0FFC00A68988 /* TKProgressBarView.m in Sources */, - 204C74951ABA0FFC00A68988 /* TKProgressCircleView.m in Sources */, - 204C74961ABA0FFC00A68988 /* TKLabelCell.m in Sources */, - 204C74971ABA0FFC00A68988 /* TKLabelFieldCell.m in Sources */, - 204C74981ABA0FFC00A68988 /* TKLabelSwitchCell.m in Sources */, - 204C74991ABA0FFC00A68988 /* TKLabelTextFieldCell.m in Sources */, - 204C749A1ABA0FFC00A68988 /* TKLabelTextViewCell.m in Sources */, - 204C749B1ABA0FFC00A68988 /* TKButtonCell.m in Sources */, - 204C749E1ABA0FFC00A68988 /* TKTextViewCell.m in Sources */, - 204C749F1ABA0FFC00A68988 /* TKTableViewCell.m in Sources */, - 204C74A11ABA0FFC00A68988 /* TKCoverflowView.m in Sources */, - 204C74A21ABA0FFC00A68988 /* TKEmptyView.m in Sources */, - 204C74A31ABA0FFC00A68988 /* TKReorderTableView.m in Sources */, - 204C74A81ABA0FFC00A68988 /* TKRetroButton.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3B45DDED134C736600D24C1A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3B89162B134D93D000BD2B31 /* FoundationTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB922308733DC00010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = ""; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; - SDKROOT = iphoneos; - WARNING_CFLAGS = "-Wno-arc-performSelector-leaks"; - }; - name = Debug; - }; - 1DEB922408733DC00010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_VERSION = ""; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - ONLY_ACTIVE_ARCH = NO; - OTHER_LDFLAGS = ""; - SDKROOT = iphoneos; - WARNING_CFLAGS = "-Wno-arc-performSelector-leaks"; - }; - name = Release; - }; - 204C73F41ABA0EA600A68988 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = tapku_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = tapku/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.devinross.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 204C73F51ABA0EA600A68988 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = tapku_Prefix.pch; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = tapku/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.devinross.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 3B45DDF3134C736600D24C1A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "\"$(SDKROOT)/Developer/Library/Frameworks\"", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = "LogicTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - UIKit, - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = LogicTests; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 3B45DDF4134C736600D24C1A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "\"$(SDKROOT)/Developer/Library/Frameworks\"", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = "LogicTests-Info.plist"; - OTHER_LDFLAGS = ( - "-framework", - Foundation, - "-framework", - UIKit, - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = LogicTests; - SDKROOT = iphoneos; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "tapku" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB922308733DC00010E9CD /* Debug */, - 1DEB922408733DC00010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 204C73F81ABA0EA600A68988 /* Build configuration list for PBXNativeTarget "tapku" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 204C73F41ABA0EA600A68988 /* Debug */, - 204C73F51ABA0EA600A68988 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3B45DDF5134C736600D24C1A /* Build configuration list for PBXNativeTarget "LogicTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3B45DDF3134C736600D24C1A /* Debug */, - 3B45DDF4134C736600D24C1A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/tapku.xcodeproj/project.xcworkspace/xcshareddata/tapku.xccheckout b/tapku.xcodeproj/project.xcworkspace/xcshareddata/tapku.xccheckout deleted file mode 100644 index 4d3e797e..00000000 --- a/tapku.xcodeproj/project.xcworkspace/xcshareddata/tapku.xccheckout +++ /dev/null @@ -1,53 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 7F91018C-F646-4DD6-892F-661B1A7E8A09 - IDESourceControlProjectName - tapku - IDESourceControlProjectOriginsDictionary - - 771CDDC8828BA5C85B70BAEAFD5C3B58BF9E0AE2 - github.com:devinross/curry.git - EE5017F42780957232AFF14DD75D9A51833942BE - github.com:devinross/tapkulibrary.git - - IDESourceControlProjectPath - tapku.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - 771CDDC8828BA5C85B70BAEAFD5C3B58BF9E0AE2 - ../..Vendor/curry - EE5017F42780957232AFF14DD75D9A51833942BE - ../.. - - IDESourceControlProjectURL - github.com:devinross/tapkulibrary.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - EE5017F42780957232AFF14DD75D9A51833942BE - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 771CDDC8828BA5C85B70BAEAFD5C3B58BF9E0AE2 - IDESourceControlWCCName - curry - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - EE5017F42780957232AFF14DD75D9A51833942BE - IDESourceControlWCCName - tapkulibrary - - - - diff --git a/tapku/tapku.h b/tapku/tapku.h deleted file mode 100644 index ec893573..00000000 --- a/tapku/tapku.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// tapku.h -// tapku -// -// Created by Devin Ross on 3/18/15. -// -// - -#import - -//! Project version number for tapku. -FOUNDATION_EXPORT double tapkuVersionNumber; - -//! Project version string for tapku. -FOUNDATION_EXPORT const unsigned char tapkuVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - -#import "TapkuLibrary.h" \ No newline at end of file