Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deployment target to 7.0 and fix warnings #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DCRoundSwitch/DCRoundSwitch.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ - (void)sizeToFit
NSString *onString = self.toggleLayer.onString;
NSString *offString = self.toggleLayer.offString;

CGFloat width = [onString sizeWithFont:self.toggleLayer.labelFont].width;
CGFloat offWidth = [offString sizeWithFont:self.toggleLayer.labelFont].width;
CGFloat width = [onString sizeWithAttributes:@{NSFontAttributeName: self.toggleLayer.labelFont}].width;
CGFloat offWidth = [offString sizeWithAttributes:@{NSFontAttributeName: self.toggleLayer.labelFont}].width;
if(offWidth > width)
width = offWidth;

Expand Down
19 changes: 10 additions & 9 deletions DCRoundSwitch/DCRoundSwitchToggleLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,22 @@ - (void)drawInContext:(CGContextRef)context
UIGraphicsPushContext(context);

// 'ON' state label (self.onString)
CGSize onTextSize = [self.onString sizeWithFont:self.labelFont];
CGSize onTextSize = [self.onString sizeWithAttributes:@{NSFontAttributeName: self.labelFont}];

CGPoint onTextPoint = CGPointMake((textSpaceWidth - onTextSize.width) / 2.0 + knobRadius * .15, floorf((self.bounds.size.height - onTextSize.height) / 2.0) + 1.0);
[[UIColor colorWithWhite:0.45 alpha:1.0] set]; // .2 & .4
[self.onString drawAtPoint:CGPointMake(onTextPoint.x, onTextPoint.y - 1.0) withFont:self.labelFont];
[self.onString drawAtPoint:CGPointMake(onTextPoint.x, onTextPoint.y -1.0) withAttributes:@{NSFontAttributeName: self.labelFont}];
[[UIColor whiteColor] set];
[self.onString drawAtPoint:onTextPoint withFont:self.labelFont];

[self.onString drawAtPoint:onTextPoint withAttributes:@{NSFontAttributeName: self.labelFont}];
// 'OFF' state label (self.offString)
CGSize offTextSize = [self.offString sizeWithFont:self.labelFont];
CGSize offTextSize = [self.offString sizeWithAttributes:@{NSFontAttributeName: self.labelFont}];

CGPoint offTextPoint = CGPointMake(textSpaceWidth + (textSpaceWidth - offTextSize.width) / 2.0 + knobRadius * .86, floorf((self.bounds.size.height - offTextSize.height) / 2.0) + 1.0);
[[UIColor whiteColor] set];
[self.offString drawAtPoint:CGPointMake(offTextPoint.x, offTextPoint.y + 1.0) withFont:self.labelFont];
[[UIColor colorWithWhite:0.52 alpha:1.0] set];
[self.offString drawAtPoint:offTextPoint withFont:self.labelFont];

[self.offString drawAtPoint:CGPointMake(offTextPoint.x, offTextPoint.y + 1.0) withAttributes:@{NSFontAttributeName: self.labelFont}];
[[UIColor colorWithWhite:0.52 alpha:1.0] set];
[self.offString drawAtPoint:offTextPoint withAttributes:@{NSFontAttributeName: self.labelFont}];
UIGraphicsPopContext();
}

Expand Down
12 changes: 9 additions & 3 deletions DCRoundSwitchDemo/DCRoundSwitchDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
3D592E4D1A8E86A600F3399B /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3D592E4C1A8E86A600F3399B /* [email protected] */; };
AB6FE5D313C420A3006BCDBB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB6FE5D213C420A3006BCDBB /* UIKit.framework */; };
AB6FE5D513C420A3006BCDBB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB6FE5D413C420A3006BCDBB /* Foundation.framework */; };
AB6FE5D713C420A3006BCDBB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB6FE5D613C420A3006BCDBB /* CoreGraphics.framework */; };
Expand All @@ -26,6 +27,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3D592E4C1A8E86A600F3399B /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
AB6FE5CE13C420A3006BCDBB /* DCRoundSwitchDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DCRoundSwitchDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
AB6FE5D213C420A3006BCDBB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
AB6FE5D413C420A3006BCDBB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -74,6 +76,7 @@
AB6FE5C313C420A3006BCDBB = {
isa = PBXGroup;
children = (
3D592E4C1A8E86A600F3399B /* [email protected] */,
AB6FE5D813C420A3006BCDBB /* DCRoundSwitchDemo */,
AB6FE5D113C420A3006BCDBB /* Frameworks */,
AB6FE5CF13C420A3006BCDBB /* Products */,
Expand Down Expand Up @@ -171,7 +174,7 @@
AB6FE5C513C420A3006BCDBB /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0610;
};
buildConfigurationList = AB6FE5C813C420A3006BCDBB /* Build configuration list for PBXProject "DCRoundSwitchDemo" */;
compatibilityVersion = "Xcode 3.2";
Expand All @@ -197,6 +200,7 @@
buildActionMask = 2147483647;
files = (
DA7A60B613FEA495000F7F8D /* MainWindow.xib in Resources */,
3D592E4D1A8E86A600F3399B /* [email protected] in Resources */,
DA7A60B813FEA4A2000F7F8D /* DCRoundSwitchDemoViewController.xib in Resources */,
DA7A60BC13FEA655000F7F8D /* Localizable.strings in Resources */,
);
Expand Down Expand Up @@ -239,7 +243,6 @@
AB6FE5ED13C420A3006BCDBB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -249,14 +252,14 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
AB6FE5EE13C420A3006BCDBB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvmgcc42;
Expand All @@ -278,6 +281,8 @@
GCC_PREFIX_HEADER = "DCRoundSwitchDemo/DCRoundSwitchDemo-Prefix.pch";
GCC_VERSION = "";
INFOPLIST_FILE = "DCRoundSwitchDemo/DCRoundSwitchDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
WRAPPER_EXTENSION = app;
Expand All @@ -293,6 +298,7 @@
GCC_PREFIX_HEADER = "DCRoundSwitchDemo/DCRoundSwitchDemo-Prefix.pch";
GCC_VERSION = "";
INFOPLIST_FILE = "DCRoundSwitchDemo/DCRoundSwitchDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
VALIDATE_PRODUCT = YES;
Expand Down
Binary file added DCRoundSwitchDemo/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.