Delete duplicate utils classes, move Product View code into proper folder

parent fae235ec
......@@ -48,12 +48,10 @@
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B911BB08FF500FC456E /* SummaryItemsTableViewCell.m */; };
9079F5F41BB1AAA100CB1B35 /* CollectionListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */; };
90A6F42D1BA8BCAC003E7C4F /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90A6F42C1BA8BCAC003E7C4F /* PassKit.framework */; };
90B2623E1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B2623D1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m */; };
90B262411BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262401BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m */; };
90B262441BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B262431BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m */; };
9A0B0C871CEC8F370037D68F /* BUYPaymentButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B0C861CEC8F370037D68F /* BUYPaymentButton.m */; };
9A0B0C921CEC90D40037D68F /* BUYImageKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B0C8F1CEC90D40037D68F /* BUYImageKit.m */; };
9A0B0C931CEC90D40037D68F /* UIFont+BUYAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B0C911CEC90D40037D68F /* UIFont+BUYAdditions.m */; };
B2C560B91CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B41CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m */; };
B2C560BA1CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B61CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m */; };
B2C560BB1CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B81CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m */; };
BE3437A21BC5C19D00C71330 /* Buy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; };
BE3437A31BC5C19D00C71330 /* Buy.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BE8B82511B8CF49D00E3F871 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8B82501B8CF49D00E3F871 /* main.m */; };
......@@ -202,18 +200,14 @@
9079F5F21BB1AAA100CB1B35 /* CollectionListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionListViewController.h; sourceTree = "<group>"; };
9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionListViewController.m; sourceTree = "<group>"; };
90A6F42C1BA8BCAC003E7C4F /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; };
90B2623C1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductViewControllerThemeStyleTableViewCell.h; sourceTree = "<group>"; };
90B2623D1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewControllerThemeStyleTableViewCell.m; sourceTree = "<group>"; };
90B2623F1BB0A726006D888F /* ProductViewControllerToggleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ProductViewControllerToggleTableViewCell.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
90B262401BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewControllerToggleTableViewCell.m; sourceTree = "<group>"; };
90B262421BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductViewControllerThemeTintColorTableViewCell.h; sourceTree = "<group>"; };
90B262431BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewControllerThemeTintColorTableViewCell.m; sourceTree = "<group>"; };
9A0B0C851CEC8F370037D68F /* BUYPaymentButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYPaymentButton.h; sourceTree = "<group>"; };
9A0B0C861CEC8F370037D68F /* BUYPaymentButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYPaymentButton.m; sourceTree = "<group>"; };
9A0B0C8E1CEC90D40037D68F /* BUYImageKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYImageKit.h; sourceTree = "<group>"; };
9A0B0C8F1CEC90D40037D68F /* BUYImageKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYImageKit.m; sourceTree = "<group>"; };
9A0B0C901CEC90D40037D68F /* UIFont+BUYAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+BUYAdditions.h"; sourceTree = "<group>"; };
9A0B0C911CEC90D40037D68F /* UIFont+BUYAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+BUYAdditions.m"; sourceTree = "<group>"; };
B2C560B31CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProductViewControllerThemeStyleTableViewCell.h; path = "Product View/ProductViewControllerThemeStyleTableViewCell.h"; sourceTree = "<group>"; };
B2C560B41CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProductViewControllerThemeStyleTableViewCell.m; path = "Product View/ProductViewControllerThemeStyleTableViewCell.m"; sourceTree = "<group>"; };
B2C560B51CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProductViewControllerThemeTintColorTableViewCell.h; path = "Product View/ProductViewControllerThemeTintColorTableViewCell.h"; sourceTree = "<group>"; };
B2C560B61CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProductViewControllerThemeTintColorTableViewCell.m; path = "Product View/ProductViewControllerThemeTintColorTableViewCell.m"; sourceTree = "<group>"; };
B2C560B71CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProductViewControllerToggleTableViewCell.h; path = "Product View/ProductViewControllerToggleTableViewCell.h"; sourceTree = "<group>"; };
B2C560B81CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProductViewControllerToggleTableViewCell.m; path = "Product View/ProductViewControllerToggleTableViewCell.m"; sourceTree = "<group>"; };
BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "Mobile Buy SDK.xcodeproj"; path = "../../Mobile Buy SDK/Mobile Buy SDK.xcodeproj"; sourceTree = "<group>"; };
BE5E28451B94F5C300D2ECB5 /* Mobile Buy SDK Advanced Sample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Mobile Buy SDK Advanced Sample.entitlements"; sourceTree = "<group>"; };
BE8B824B1B8CF49D00E3F871 /* Mobile Buy SDK Advanced Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mobile Buy SDK Advanced Sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -371,12 +365,12 @@
90B262451BB18BEF006D888F /* Table View Cells */ = {
isa = PBXGroup;
children = (
90B2623C1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.h */,
90B2623D1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m */,
90B262421BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.h */,
90B262431BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m */,
90B2623F1BB0A726006D888F /* ProductViewControllerToggleTableViewCell.h */,
90B262401BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m */,
B2C560B31CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.h */,
B2C560B41CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m */,
B2C560B51CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.h */,
B2C560B61CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m */,
B2C560B71CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.h */,
B2C560B81CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m */,
902C9B8D1BB0729F00FC456E /* ShippingRateTableViewCell.h */,
902C9B8E1BB0729F00FC456E /* ShippingRateTableViewCell.m */,
902C9B901BB08FF500FC456E /* SummaryItemsTableViewCell.h */,
......@@ -385,17 +379,6 @@
name = "Table View Cells";
sourceTree = "<group>";
};
9A0B0C8D1CEC90D40037D68F /* Utils */ = {
isa = PBXGroup;
children = (
9A0B0C8E1CEC90D40037D68F /* BUYImageKit.h */,
9A0B0C8F1CEC90D40037D68F /* BUYImageKit.m */,
9A0B0C901CEC90D40037D68F /* UIFont+BUYAdditions.h */,
9A0B0C911CEC90D40037D68F /* UIFont+BUYAdditions.m */,
);
path = Utils;
sourceTree = "<group>";
};
BE3437901BC5C18400C71330 /* Products */ = {
isa = PBXGroup;
children = (
......@@ -429,7 +412,6 @@
children = (
BE8B82521B8CF49D00E3F871 /* AppDelegate.h */,
BE8B82531B8CF49D00E3F871 /* AppDelegate.m */,
9A0B0C8D1CEC90D40037D68F /* Utils */,
847612231CAB047600AB17AA /* Appearance */,
8476128F1CAB059100AB17AA /* PaymentButton */,
BE948D4C1B95087A009AB20B /* Images.xcassets */,
......@@ -602,15 +584,16 @@
8476127F1CAB047600AB17AA /* OptionSelectionViewController.m in Sources */,
9A0B0C871CEC8F370037D68F /* BUYPaymentButton.m in Sources */,
8476127C1CAB047600AB17AA /* HeaderOverlayView.m in Sources */,
B2C560BA1CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */,
8476127A1CAB047600AB17AA /* ProductViewHeader.m in Sources */,
847612841CAB047600AB17AA /* VariantSelectionViewController.m in Sources */,
90B2623E1BB0A47B006D888F /* ProductViewControllerThemeStyleTableViewCell.m in Sources */,
847612801CAB047600AB17AA /* OptionValueCell.m in Sources */,
847612821CAB047600AB17AA /* OptionBreadCrumbsView.m in Sources */,
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */,
8476127D1CAB047600AB17AA /* ProductViewNavigationController.m in Sources */,
8476126F1CAB047600AB17AA /* ErrorView.m in Sources */,
847612811CAB047600AB17AA /* VariantSelectionPresentationController.m in Sources */,
B2C560BB1CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m in Sources */,
847612781CAB047600AB17AA /* ProductViewController.m in Sources */,
8476126A1CAB047600AB17AA /* VisualEffectView.m in Sources */,
847612721CAB047600AB17AA /* ProductViewPresentationController.m in Sources */,
......@@ -620,18 +603,14 @@
902C9B8F1BB0729F00FC456E /* ShippingRateTableViewCell.m in Sources */,
BE8B829A1B8E72CC00E3F871 /* CheckoutViewController.m in Sources */,
847612681CAB047600AB17AA /* Theme+Additions.m in Sources */,
9A0B0C931CEC90D40037D68F /* UIFont+BUYAdditions.m in Sources */,
847612831CAB047600AB17AA /* VariantOptionView.m in Sources */,
847612981CAB059100AB17AA /* UIImage+PaymentButton.m in Sources */,
8476126E1CAB047600AB17AA /* CheckoutButton.m in Sources */,
8476127E1CAB047600AB17AA /* OptionSelectionNavigationController.m in Sources */,
847612971CAB059100AB17AA /* UIButton+PaymentButton.m in Sources */,
9A0B0C921CEC90D40037D68F /* BUYImageKit.m in Sources */,
847612761CAB047600AB17AA /* ProductVariantCell.m in Sources */,
847612691CAB047600AB17AA /* Theme.m in Sources */,
847612701CAB047600AB17AA /* GradientView.m in Sources */,
90B262441BB18B10006D888F /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */,
90B262411BB0A726006D888F /* ProductViewControllerToggleTableViewCell.m in Sources */,
847612961CAB059100AB17AA /* ImageKit.m in Sources */,
847612A21CAB05BE00AB17AA /* UIImage+BUYAdditions.m in Sources */,
847612771CAB047600AB17AA /* ProductView.m in Sources */,
......@@ -646,6 +625,7 @@
847612711CAB047600AB17AA /* AsyncImageView.m in Sources */,
84BA52EE1CB2E83C00AB1560 /* NavigationController.m in Sources */,
847612751CAB047600AB17AA /* ProductImageCell.m in Sources */,
B2C560B91CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m in Sources */,
847612741CAB047600AB17AA /* ProductHeaderCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
//
// BUYImageKit.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// 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;
/**
* Image generator for a variety of images using the BUYProductViewController.
*/
@interface BUYImageKit : NSObject
/**
* Generates a close button image for the variant selection navigation bar.
*
* @param frame The frame size of the image
*
* @return A close button image
*/
+ (UIImage*)imageOfVariantCloseImageWithFrame: (CGRect)frame;
/**
* Generates a checkmark image for use of displaying the previously selected variant
*
* @param frame The frame size of the image
*
* @return A checkmark for the previous variant selection
*/
+ (UIImage*)imageOfPreviousSelectionIndicatorImageWithFrame: (CGRect)frame;
/**
* Generates a custom disclosure indicator image
*
* @param frame The frame size of the image
* @param color The color for the disclosure indicator
*
* @return A disclusore indicator image
*/
+ (UIImage*)imageOfDisclosureIndicatorImageWithFrame: (CGRect)frame color:(UIColor*)color;
/**
* Generates a close button image for the product view's navigation bar
*
* @param frame The frame size of the image
* @param color The color for the close button image
* @param hasShadow True if the X should have a drop shadow
*
* @return A close button image
*/
+ (UIImage*)imageOfProductViewCloseImageWithFrame: (CGRect)frame color:(UIColor*)color hasShadow:(BOOL)hasShadow;
/**
* Generates a custom back button image for the variant selection navigation bar
*
* @param frame The frame size of the image
*
* @return A custom back button image
*/
+ (UIImage*)imageOfVariantBackImageWithFrame: (CGRect)frame;
@end
//
// BUYImageKit.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// 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 "BUYImageKit.h"
@implementation BUYImageKit
#pragma mark Drawing Methods
+ (void)drawVariantCloseImageWithFrame: (CGRect)frame
{
//// Color Declarations
UIColor* closeColor = [UIColor colorWithRed: 0.596f green: 0.596f blue: 0.596f alpha: 1];
//// Variant Close Icon Drawing
UIBezierPath* variantCloseIconPath = UIBezierPath.bezierPath;
[variantCloseIconPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.13971f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.16669f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.93886f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.87988f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.86029f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.95000f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.06114f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.23681f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.13971f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.16669f * CGRectGetHeight(frame))];
[variantCloseIconPath closePath];
[variantCloseIconPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.86029f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.16669f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.93886f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.23681f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.13971f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.95000f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.06114f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.87988f * CGRectGetHeight(frame))];
[variantCloseIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.86029f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.16669f * CGRectGetHeight(frame))];
[variantCloseIconPath closePath];
[closeColor setFill];
[variantCloseIconPath fill];
}
+ (void)drawPreviousSelectionIndicatorImageWithFrame: (CGRect)frame
{
//// Color Declarations
UIColor* indicatorColor = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 1];
//// Previous Selection Indicator Drawing
UIBezierPath* previousSelectionIndicatorPath = UIBezierPath.bezierPath;
[previousSelectionIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.50000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 1.00000f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addCurveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.50000f * CGRectGetHeight(frame)) controlPoint1: CGPointMake(CGRectGetMinX(frame) + 0.22386f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 1.00000f * CGRectGetHeight(frame)) controlPoint2: CGPointMake(CGRectGetMinX(frame) + 0.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.77614f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addCurveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.50000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.00000f * CGRectGetHeight(frame)) controlPoint1: CGPointMake(CGRectGetMinX(frame) + 0.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.22386f * CGRectGetHeight(frame)) controlPoint2: CGPointMake(CGRectGetMinX(frame) + 0.22386f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.00000f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addCurveToPoint: CGPointMake(CGRectGetMinX(frame) + 1.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.50000f * CGRectGetHeight(frame)) controlPoint1: CGPointMake(CGRectGetMinX(frame) + 0.77614f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.00000f * CGRectGetHeight(frame)) controlPoint2: CGPointMake(CGRectGetMinX(frame) + 1.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.22386f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addCurveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.50000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 1.00000f * CGRectGetHeight(frame)) controlPoint1: CGPointMake(CGRectGetMinX(frame) + 1.00000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.77614f * CGRectGetHeight(frame)) controlPoint2: CGPointMake(CGRectGetMinX(frame) + 0.77614f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 1.00000f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath closePath];
[previousSelectionIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.74926f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.28003f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.40000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.62929f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.25074f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.48003f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.18002f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.55074f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.39926f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.76997f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.40000f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.76924f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.40073f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.76997f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.81997f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.35074f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.74926f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.28003f * CGRectGetHeight(frame))];
[previousSelectionIndicatorPath closePath];
[indicatorColor setFill];
[previousSelectionIndicatorPath fill];
}
+ (void)drawDisclosureIndicatorImageWithFrame: (CGRect)frame color:(UIColor*)arrowColor
{
//// Disclosure Indicator Drawing
UIBezierPath* disclosureIndicatorPath = UIBezierPath.bezierPath;
[disclosureIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.25149f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.06878f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.93995f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.49908f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79854f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.58746f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.11004f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.15717f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.25149f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.06878f * CGRectGetHeight(frame))];
[disclosureIndicatorPath closePath];
[disclosureIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79854f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.41253f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.93995f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.50092f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.25149f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.93121f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.11004f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.84282f * CGRectGetHeight(frame))];
[disclosureIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79854f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.41253f * CGRectGetHeight(frame))];
[disclosureIndicatorPath closePath];
[arrowColor setFill];
[disclosureIndicatorPath fill];
}
+ (void)drawProductViewCloseImageWithFrame: (CGRect)frame color:(UIColor *)closeColor2 hasShadow:(BOOL)hasShadow
{
//// General Declarations
CGContextRef context = UIGraphicsGetCurrentContext();
//// Color Declarations
UIColor* closeShadowColor = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 1];
//// Shadow Declarations
NSShadow* closeDropShadow = [[NSShadow alloc] init];
[closeDropShadow setShadowColor: [closeShadowColor colorWithAlphaComponent: 0.15f]];
[closeDropShadow setShadowOffset: CGSizeMake(0.1f, 1.1f)];
[closeDropShadow setShadowBlurRadius: 2];
//// Close Icon Drawing
UIBezierPath* closeIconPath = UIBezierPath.bezierPath;
[closeIconPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.11431f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.09548f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.85907f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.84024f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79479f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.90452f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.05002f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.15976f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.11431f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.09548f * CGRectGetHeight(frame))];
[closeIconPath closePath];
[closeIconPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79479f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.09548f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.85907f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.15976f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.11431f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.90452f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.05002f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.84024f * CGRectGetHeight(frame))];
[closeIconPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79479f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.09548f * CGRectGetHeight(frame))];
[closeIconPath closePath];
CGContextSaveGState(context);
if (hasShadow) {
CGContextSetShadowWithColor(context, closeDropShadow.shadowOffset, closeDropShadow.shadowBlurRadius, [closeDropShadow.shadowColor CGColor]);
}
[closeColor2 setFill];
[closeIconPath fill];
CGContextRestoreGState(context);
}
+ (void)drawVariantBackImageWithFrame: (CGRect)frame
{
//// Color Declarations
UIColor* indicatorColor3 = [UIColor colorWithRed: 0.596f green: 0.596f blue: 0.596f alpha: 1];
//// Variant Back Indicator Drawing
UIBezierPath* variantBackIndicatorPath = UIBezierPath.bezierPath;
[variantBackIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.20956f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.42225f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.86663f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.86029f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.74878f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.93886f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.09171f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.50082f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.20956f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.42225f * CGRectGetHeight(frame))];
[variantBackIndicatorPath closePath];
[variantBackIndicatorPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.74878f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.06114f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.86663f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.13971f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.20956f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.57775f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.09171f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.49918f * CGRectGetHeight(frame))];
[variantBackIndicatorPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.74878f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.06114f * CGRectGetHeight(frame))];
[variantBackIndicatorPath closePath];
[indicatorColor3 setFill];
[variantBackIndicatorPath fill];
}
#pragma mark Generated Images
+ (UIImage*)imageOfVariantCloseImageWithFrame: (CGRect)frame
{
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
[BUYImageKit drawVariantCloseImageWithFrame: frame];
UIImage* imageOfVariantCloseImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfVariantCloseImage;
}
+ (UIImage*)imageOfPreviousSelectionIndicatorImageWithFrame: (CGRect)frame
{
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
[BUYImageKit drawPreviousSelectionIndicatorImageWithFrame: frame];
UIImage* imageOfPreviousSelectionIndicatorImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfPreviousSelectionIndicatorImage;
}
+ (UIImage*)imageOfDisclosureIndicatorImageWithFrame: (CGRect)frame color:(UIColor*)color;
{
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
[BUYImageKit drawDisclosureIndicatorImageWithFrame: frame color:color];
UIImage* imageOfDisclosureIndicatorImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfDisclosureIndicatorImage;
}
+ (UIImage*)imageOfProductViewCloseImageWithFrame: (CGRect)frame color:(UIColor*)color hasShadow:(BOOL)hasShadow;
{
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
[BUYImageKit drawProductViewCloseImageWithFrame: frame color:color hasShadow:hasShadow];
UIImage* imageOfProductViewCloseImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfProductViewCloseImage;
}
+ (UIImage*)imageOfVariantBackImageWithFrame: (CGRect)frame
{
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
[BUYImageKit drawVariantBackImageWithFrame: frame];
UIImage* imageOfVariantBackImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfVariantBackImage;
}
@end
//
// BUYFont.h
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// 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 (BUYAdditions)
/**
* Class method to allow system fonts to have increased point sizes from the OS default.
*
* @param style The text style for the font.
* @param size A positive value to increase the default font's point size by.
*
* @return A system font with an optionally increased point size.
*/
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size;
@end
//
// BUYFont.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// 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+BUYAdditions.h"
@implementation UIFont (BUYAdditions)
+ (UIFont *)preferredFontForTextStyle:(NSString *)style increasedPointSize:(CGFloat)size
{
UIFontDescriptor *descriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:style];
return [UIFont fontWithDescriptor:descriptor size:descriptor.pointSize + size];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment