diff --git a/CountingTestProject.xcodeproj/project.pbxproj b/CountingTestProject.xcodeproj/project.pbxproj index d9d931c..aa4e929 100644 --- a/CountingTestProject.xcodeproj/project.pbxproj +++ b/CountingTestProject.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 33EFDA461C56C4C40084A36A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33EFDA451C56C4C40084A36A /* QuartzCore.framework */; }; 4C5DC2A416C576E30043204D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C5DC2A316C576E30043204D /* UIKit.framework */; }; 4C5DC2A616C576E30043204D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C5DC2A516C576E30043204D /* Foundation.framework */; }; 4C5DC2A816C576E30043204D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C5DC2A716C576E30043204D /* CoreGraphics.framework */; }; @@ -22,6 +23,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 33EFDA451C56C4C40084A36A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 4C5DC2A016C576E30043204D /* CountingTestProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CountingTestProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4C5DC2A316C576E30043204D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 4C5DC2A516C576E30043204D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -47,6 +49,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 33EFDA461C56C4C40084A36A /* QuartzCore.framework in Frameworks */, 4C5DC2A416C576E30043204D /* UIKit.framework in Frameworks */, 4C5DC2A616C576E30043204D /* Foundation.framework in Frameworks */, 4C5DC2A816C576E30043204D /* CoreGraphics.framework in Frameworks */, @@ -76,6 +79,7 @@ 4C5DC2A216C576E30043204D /* Frameworks */ = { isa = PBXGroup; children = ( + 33EFDA451C56C4C40084A36A /* QuartzCore.framework */, 4C5DC2A316C576E30043204D /* UIKit.framework */, 4C5DC2A516C576E30043204D /* Foundation.framework */, 4C5DC2A716C576E30043204D /* CoreGraphics.framework */, @@ -139,7 +143,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = CTP; - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0720; ORGANIZATIONNAME = "Tim Gostony"; }; buildConfigurationList = 4C5DC29B16C576E30043204D /* Build configuration list for PBXProject "CountingTestProject" */; @@ -222,6 +226,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -271,6 +276,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "CountingTestProject/CountingTestProject-Prefix.pch"; INFOPLIST_FILE = "CountingTestProject/CountingTestProject-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.timgostony.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -283,6 +289,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "CountingTestProject/CountingTestProject-Prefix.pch"; INFOPLIST_FILE = "CountingTestProject/CountingTestProject-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.timgostony.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/CountingTestProject/CountingTestProject-Info.plist b/CountingTestProject/CountingTestProject-Info.plist index 0f66f26..5860c3f 100644 --- a/CountingTestProject/CountingTestProject-Info.plist +++ b/CountingTestProject/CountingTestProject-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.timgostony.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/UICountingLabel.m b/UICountingLabel.m index 87bd0cb..cb08010 100755 --- a/UICountingLabel.m +++ b/UICountingLabel.m @@ -1,3 +1,5 @@ +#import + #import "UICountingLabel.h" #if !__has_feature(objc_arc) @@ -86,7 +88,7 @@ @interface UICountingLabel () @property NSTimeInterval totalTime; @property CGFloat easingRate; -@property (nonatomic, weak) NSTimer *timer; +@property (nonatomic, strong) CADisplayLink *timer; @property (nonatomic, strong) id counter; @end @@ -142,9 +144,10 @@ -(void)countFrom:(CGFloat)startValue to:(CGFloat)endValue withDuration:(NSTimeIn break; } - NSTimer *timer = [NSTimer timerWithTimeInterval:(1.0f/30.0f) target:self selector:@selector(updateValue:) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; - [[NSRunLoop mainRunLoop] addTimer:timer forMode:UITrackingRunLoopMode]; + CADisplayLink *timer = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateValue:)]; + timer.frameInterval = 2; + [timer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; + [timer addToRunLoop:[NSRunLoop mainRunLoop] forMode:UITrackingRunLoopMode]; self.timer = timer; }