diff --git a/LMGaugeView.podspec b/LMGaugeView.podspec index 8e45b09..7462fb6 100644 --- a/LMGaugeView.podspec +++ b/LMGaugeView.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "LMGaugeView" - s.version = "1.0.0" + s.version = "1.0.1" s.summary = "LMGaugeView is a simple and customizable gauge control for iOS." s.homepage = "https://github.com/lminhtm/LMGaugeView" s.license = 'MIT' diff --git a/LMGaugeView/LMGaugeView.m b/LMGaugeView/LMGaugeView.m index 6ce15d1..2e9264e 100755 --- a/LMGaugeView/LMGaugeView.m +++ b/LMGaugeView/LMGaugeView.m @@ -127,7 +127,7 @@ - (void)strokeGauge /*! * Set progress for ring layer */ - CGFloat progress = (self.value - self.minValue)/self.maxValue; + CGFloat progress = self.maxValue ? (self.value - self.minValue)/self.maxValue : 0; self.progressLayer.strokeEnd = progress; /*! @@ -148,8 +148,8 @@ - (void)drawRect:(CGRect)rect /*! * Prepare drawing */ - self.divisionUnitValue = (self.maxValue - self.minValue)/self.numOfDivisions; - self.divisionUnitAngle = (M_PI * 2 - ABS(self.endAngle - self.startAngle))/self.numOfDivisions; + self.divisionUnitValue = self.numOfDivisions ? (self.maxValue - self.minValue)/self.numOfDivisions : 0; + self.divisionUnitAngle = self.numOfDivisions ? (M_PI * 2 - ABS(self.endAngle - self.startAngle))/self.numOfDivisions : 0; CGPoint center = CGPointMake(CGRectGetWidth(self.bounds)/2, CGRectGetHeight(self.bounds)/2); CGFloat ringRadius = MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds))/2 - self.ringThickness/2; CGFloat dotRadius = ringRadius - self.ringThickness/2 - self.divisionsPadding - self.divisionsRadius/2; @@ -176,11 +176,11 @@ - (void)drawRect:(CGRect)rect /*! * Draw divisions and subdivisions */ - for (int i = 0; i <= self.numOfDivisions; i++) + for (int i = 0; i <= self.numOfDivisions && self.numOfDivisions != 0; i++) { if (i != self.numOfDivisions) { - for (int j = 0; j <= self.numOfSubDivisions; j++) + for (int j = 0; j <= self.numOfSubDivisions && self.numOfSubDivisions != 0; j++) { // Subdivisions CGFloat value = i * self.divisionUnitValue + j * self.divisionUnitValue/self.numOfSubDivisions; @@ -206,7 +206,7 @@ - (void)drawRect:(CGRect)rect /*! * Draw the limit dot */ - if (self.showLimitDot) + if (self.showLimitDot && self.numOfDivisions != 0) { CGFloat angle = [self angleFromValue:self.limitValue]; CGPoint dotCenter = CGPointMake(dotRadius * cos(angle) + center.x, dotRadius * sin(angle) + center.y); @@ -288,7 +288,7 @@ - (void)drawRect:(CGRect)rect - (CGFloat)angleFromValue:(CGFloat)value { - CGFloat level = ((value - self.minValue)/self.divisionUnitValue); + CGFloat level = self.divisionUnitValue ? (value - self.minValue)/self.divisionUnitValue : 0; CGFloat angle = level * self.divisionUnitAngle + self.startAngle; return angle; } diff --git a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.pbxproj b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.pbxproj index 7de65e9..6779c65 100755 --- a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.pbxproj +++ b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 5C8E55721BF977A0009C38FC /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5C8E55711BF977A0009C38FC /* Launch Screen.storyboard */; }; 5CE9FFE71B6C7058004C633B /* LMGaugeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CE9FFE61B6C7058004C633B /* LMGaugeView.m */; }; 62166421198AB252009AD267 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62166420198AB252009AD267 /* Foundation.framework */; }; 62166423198AB252009AD267 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62166422198AB252009AD267 /* CoreGraphics.framework */; }; @@ -20,6 +21,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 5C8E55711BF977A0009C38FC /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 5CE9FFE51B6C7058004C633B /* LMGaugeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LMGaugeView.h; sourceTree = ""; }; 5CE9FFE61B6C7058004C633B /* LMGaugeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LMGaugeView.m; sourceTree = ""; }; 6216641D198AB252009AD267 /* LMGaugeView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LMGaugeView.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -107,6 +109,7 @@ isa = PBXGroup; children = ( 62166438198AB252009AD267 /* Images.xcassets */, + 5C8E55711BF977A0009C38FC /* Launch Screen.storyboard */, 62166428198AB252009AD267 /* LMGaugeViewDemo-Info.plist */, 62166429198AB252009AD267 /* InfoPlist.strings */, 6216642C198AB252009AD267 /* main.m */, @@ -142,7 +145,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = LM; - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0710; ORGANIZATIONNAME = LMinh; }; buildConfigurationList = 62166418198AB252009AD267 /* Build configuration list for PBXProject "LMGaugeViewDemo" */; @@ -170,6 +173,7 @@ files = ( 62166439198AB252009AD267 /* Images.xcassets in Resources */, 6216642B198AB252009AD267 /* InfoPlist.strings in Resources */, + 5C8E55721BF977A0009C38FC /* Launch Screen.storyboard in Resources */, 62166434198AB252009AD267 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -228,6 +232,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; @@ -289,6 +294,7 @@ GCC_PREFIX_HEADER = "LMGaugeViewDemo/LMGaugeViewDemo-Prefix.pch"; INFOPLIST_FILE = "LMGaugeViewDemo/LMGaugeViewDemo-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.lminh.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = LMGaugeView; WRAPPER_EXTENSION = app; }; @@ -303,6 +309,7 @@ GCC_PREFIX_HEADER = "LMGaugeViewDemo/LMGaugeViewDemo-Prefix.pch"; INFOPLIST_FILE = "LMGaugeViewDemo/LMGaugeViewDemo-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.lminh.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = LMGaugeView; WRAPPER_EXTENSION = app; }; diff --git a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/lminh.xcuserdatad/UserInterfaceState.xcuserstate b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/lminh.xcuserdatad/UserInterfaceState.xcuserstate index 08c5b44..45cffa3 100644 Binary files a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/lminh.xcuserdatad/UserInterfaceState.xcuserstate and b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/lminh.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/xcuserdata/lminh.xcuserdatad/xcschemes/LMGaugeViewDemo.xcscheme b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/xcuserdata/lminh.xcuserdatad/xcschemes/LMGaugeViewDemo.xcscheme index eb7be0d..379019b 100644 --- a/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/xcuserdata/lminh.xcuserdatad/xcschemes/LMGaugeViewDemo.xcscheme +++ b/LMGaugeViewDemo/LMGaugeViewDemo.xcodeproj/xcuserdata/lminh.xcuserdatad/xcschemes/LMGaugeViewDemo.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,15 +38,18 @@ ReferencedContainer = "container:LMGaugeViewDemo.xcodeproj"> + + @@ -62,10 +65,10 @@ diff --git a/LMGaugeViewDemo/LMGaugeViewDemo/Base.lproj/Main.storyboard b/LMGaugeViewDemo/LMGaugeViewDemo/Base.lproj/Main.storyboard index c5f94ba..9b81c12 100755 --- a/LMGaugeViewDemo/LMGaugeViewDemo/Base.lproj/Main.storyboard +++ b/LMGaugeViewDemo/LMGaugeViewDemo/Base.lproj/Main.storyboard @@ -1,12 +1,12 @@ - + - + - + @@ -20,6 +20,7 @@ + @@ -38,12 +39,14 @@ + + @@ -76,9 +80,4 @@ - - - - - diff --git a/LMGaugeViewDemo/LMGaugeViewDemo/LMGaugeViewDemo-Info.plist b/LMGaugeViewDemo/LMGaugeViewDemo/LMGaugeViewDemo-Info.plist index 0aec53b..af7e9f0 100755 --- a/LMGaugeViewDemo/LMGaugeViewDemo/LMGaugeViewDemo-Info.plist +++ b/LMGaugeViewDemo/LMGaugeViewDemo/LMGaugeViewDemo-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.lminh.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,6 +24,8 @@ 1.0 LSRequiresIPhoneOS + UILaunchStoryboardName + Launch Screen UIMainStoryboardFile Main UIRequiredDeviceCapabilities diff --git a/LMGaugeViewDemo/LMGaugeViewDemo/Launch Screen.storyboard b/LMGaugeViewDemo/LMGaugeViewDemo/Launch Screen.storyboard new file mode 100644 index 0000000..2d177be --- /dev/null +++ b/LMGaugeViewDemo/LMGaugeViewDemo/Launch Screen.storyboard @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +