Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial code commit

  • Loading branch information...
commit cc20fe76a137135bf77176fbe38539d5df5ee1dd 1 parent 752723c
@khanlou khanlou authored
View
341 FTWButton.xcodeproj/project.pbxproj
@@ -0,0 +1,341 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1A07AF6E1630902D00BB6ADE /* planet.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A07AF6A1630902D00BB6ADE /* planet.png */; };
+ 1A07AF6F1630902D00BB6ADE /* planet@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A07AF6B1630902D00BB6ADE /* planet@2x.png */; };
+ 1A07AF701630902D00BB6ADE /* weather.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A07AF6C1630902D00BB6ADE /* weather.png */; };
+ 1A07AF711630902D00BB6ADE /* weather@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A07AF6D1630902D00BB6ADE /* weather@2x.png */; };
+ 1A88DAEC16288DD400CC9EDC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A88DAEB16288DD400CC9EDC /* UIKit.framework */; };
+ 1A88DAEE16288DD400CC9EDC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A88DAED16288DD400CC9EDC /* Foundation.framework */; };
+ 1A88DAF016288DD400CC9EDC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A88DAEF16288DD400CC9EDC /* CoreGraphics.framework */; };
+ 1A88DAF616288DD400CC9EDC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A88DAF416288DD400CC9EDC /* InfoPlist.strings */; };
+ 1A88DAF816288DD400CC9EDC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A88DAF716288DD400CC9EDC /* main.m */; };
+ 1A88DAFC16288DD500CC9EDC /* FTWAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A88DAFB16288DD500CC9EDC /* FTWAppDelegate.m */; };
+ 1A88DAFE16288DD500CC9EDC /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A88DAFD16288DD500CC9EDC /* Default.png */; };
+ 1A88DB0016288DD500CC9EDC /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A88DAFF16288DD500CC9EDC /* Default@2x.png */; };
+ 1A88DB0216288DD500CC9EDC /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A88DB0116288DD500CC9EDC /* Default-568h@2x.png */; };
+ 1A88DB0516288DD500CC9EDC /* FTWViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A88DB0416288DD500CC9EDC /* FTWViewController.m */; };
+ 1A88DB0816288DD500CC9EDC /* FTWViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A88DB0616288DD500CC9EDC /* FTWViewController.xib */; };
+ 1A88DB1016288DFC00CC9EDC /* FTWButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A88DB0E16288DFC00CC9EDC /* FTWButton.m */; };
+ 1A88DB1316288E0400CC9EDC /* SKInnerShadowLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A88DB1216288E0400CC9EDC /* SKInnerShadowLayer.m */; };
+ 1A88DB151628A63A00CC9EDC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A88DB141628A63A00CC9EDC /* QuartzCore.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1A07AF6A1630902D00BB6ADE /* planet.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = planet.png; sourceTree = "<group>"; };
+ 1A07AF6B1630902D00BB6ADE /* planet@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "planet@2x.png"; sourceTree = "<group>"; };
+ 1A07AF6C1630902D00BB6ADE /* weather.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = weather.png; sourceTree = "<group>"; };
+ 1A07AF6D1630902D00BB6ADE /* weather@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "weather@2x.png"; sourceTree = "<group>"; };
+ 1A88DAE716288DD400CC9EDC /* FTWButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FTWButton.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1A88DAEB16288DD400CC9EDC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 1A88DAED16288DD400CC9EDC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1A88DAEF16288DD400CC9EDC /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 1A88DAF316288DD400CC9EDC /* FTWButton-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FTWButton-Info.plist"; sourceTree = "<group>"; };
+ 1A88DAF516288DD400CC9EDC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1A88DAF716288DD400CC9EDC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1A88DAF916288DD400CC9EDC /* FTWButton-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FTWButton-Prefix.pch"; sourceTree = "<group>"; };
+ 1A88DAFA16288DD500CC9EDC /* FTWAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FTWAppDelegate.h; sourceTree = "<group>"; };
+ 1A88DAFB16288DD500CC9EDC /* FTWAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FTWAppDelegate.m; sourceTree = "<group>"; };
+ 1A88DAFD16288DD500CC9EDC /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 1A88DAFF16288DD500CC9EDC /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
+ 1A88DB0116288DD500CC9EDC /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
+ 1A88DB0316288DD500CC9EDC /* FTWViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FTWViewController.h; sourceTree = "<group>"; };
+ 1A88DB0416288DD500CC9EDC /* FTWViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FTWViewController.m; sourceTree = "<group>"; };
+ 1A88DB0716288DD500CC9EDC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/FTWViewController.xib; sourceTree = "<group>"; };
+ 1A88DB0E16288DFC00CC9EDC /* FTWButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTWButton.m; sourceTree = "<group>"; };
+ 1A88DB0F16288DFC00CC9EDC /* FTWButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTWButton.h; sourceTree = "<group>"; };
+ 1A88DB1116288E0400CC9EDC /* SKInnerShadowLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKInnerShadowLayer.h; sourceTree = "<group>"; };
+ 1A88DB1216288E0400CC9EDC /* SKInnerShadowLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKInnerShadowLayer.m; sourceTree = "<group>"; };
+ 1A88DB141628A63A00CC9EDC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1A88DAE416288DD400CC9EDC /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A88DB151628A63A00CC9EDC /* QuartzCore.framework in Frameworks */,
+ 1A88DAEC16288DD400CC9EDC /* UIKit.framework in Frameworks */,
+ 1A88DAEE16288DD400CC9EDC /* Foundation.framework in Frameworks */,
+ 1A88DAF016288DD400CC9EDC /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 1A07AF731630903100BB6ADE /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 1A07AF6A1630902D00BB6ADE /* planet.png */,
+ 1A07AF6B1630902D00BB6ADE /* planet@2x.png */,
+ 1A07AF6C1630902D00BB6ADE /* weather.png */,
+ 1A07AF6D1630902D00BB6ADE /* weather@2x.png */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 1A88DADC16288DD400CC9EDC = {
+ isa = PBXGroup;
+ children = (
+ 1A88DB141628A63A00CC9EDC /* QuartzCore.framework */,
+ 1A88DAF116288DD400CC9EDC /* FTWButton */,
+ 1A88DAEA16288DD400CC9EDC /* Frameworks */,
+ 1A88DAE816288DD400CC9EDC /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 1A88DAE816288DD400CC9EDC /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1A88DAE716288DD400CC9EDC /* FTWButton.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 1A88DAEA16288DD400CC9EDC /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1A88DAEB16288DD400CC9EDC /* UIKit.framework */,
+ 1A88DAED16288DD400CC9EDC /* Foundation.framework */,
+ 1A88DAEF16288DD400CC9EDC /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 1A88DAF116288DD400CC9EDC /* FTWButton */ = {
+ isa = PBXGroup;
+ children = (
+ 1A88DAFA16288DD500CC9EDC /* FTWAppDelegate.h */,
+ 1A88DAFB16288DD500CC9EDC /* FTWAppDelegate.m */,
+ 1A88DB0316288DD500CC9EDC /* FTWViewController.h */,
+ 1A88DB0416288DD500CC9EDC /* FTWViewController.m */,
+ 1A88DB0616288DD500CC9EDC /* FTWViewController.xib */,
+ 1A88DB0F16288DFC00CC9EDC /* FTWButton.h */,
+ 1A88DB0E16288DFC00CC9EDC /* FTWButton.m */,
+ 1A88DB1116288E0400CC9EDC /* SKInnerShadowLayer.h */,
+ 1A88DB1216288E0400CC9EDC /* SKInnerShadowLayer.m */,
+ 1A07AF731630903100BB6ADE /* Resources */,
+ 1A88DAF216288DD400CC9EDC /* Supporting Files */,
+ );
+ path = FTWButton;
+ sourceTree = "<group>";
+ };
+ 1A88DAF216288DD400CC9EDC /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 1A88DAF316288DD400CC9EDC /* FTWButton-Info.plist */,
+ 1A88DAF416288DD400CC9EDC /* InfoPlist.strings */,
+ 1A88DAF716288DD400CC9EDC /* main.m */,
+ 1A88DAF916288DD400CC9EDC /* FTWButton-Prefix.pch */,
+ 1A88DAFD16288DD500CC9EDC /* Default.png */,
+ 1A88DAFF16288DD500CC9EDC /* Default@2x.png */,
+ 1A88DB0116288DD500CC9EDC /* Default-568h@2x.png */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1A88DAE616288DD400CC9EDC /* FTWButton */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1A88DB0B16288DD500CC9EDC /* Build configuration list for PBXNativeTarget "FTWButton" */;
+ buildPhases = (
+ 1A88DAE316288DD400CC9EDC /* Sources */,
+ 1A88DAE416288DD400CC9EDC /* Frameworks */,
+ 1A88DAE516288DD400CC9EDC /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = FTWButton;
+ productName = FTWButton;
+ productReference = 1A88DAE716288DD400CC9EDC /* FTWButton.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 1A88DADE16288DD400CC9EDC /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ CLASSPREFIX = FTW;
+ LastUpgradeCheck = 0450;
+ ORGANIZATIONNAME = FTW;
+ };
+ buildConfigurationList = 1A88DAE116288DD400CC9EDC /* Build configuration list for PBXProject "FTWButton" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 1A88DADC16288DD400CC9EDC;
+ productRefGroup = 1A88DAE816288DD400CC9EDC /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1A88DAE616288DD400CC9EDC /* FTWButton */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1A88DAE516288DD400CC9EDC /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A88DAF616288DD400CC9EDC /* InfoPlist.strings in Resources */,
+ 1A88DAFE16288DD500CC9EDC /* Default.png in Resources */,
+ 1A88DB0016288DD500CC9EDC /* Default@2x.png in Resources */,
+ 1A88DB0216288DD500CC9EDC /* Default-568h@2x.png in Resources */,
+ 1A88DB0816288DD500CC9EDC /* FTWViewController.xib in Resources */,
+ 1A07AF6E1630902D00BB6ADE /* planet.png in Resources */,
+ 1A07AF6F1630902D00BB6ADE /* planet@2x.png in Resources */,
+ 1A07AF701630902D00BB6ADE /* weather.png in Resources */,
+ 1A07AF711630902D00BB6ADE /* weather@2x.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1A88DAE316288DD400CC9EDC /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1A88DAF816288DD400CC9EDC /* main.m in Sources */,
+ 1A88DAFC16288DD500CC9EDC /* FTWAppDelegate.m in Sources */,
+ 1A88DB0516288DD500CC9EDC /* FTWViewController.m in Sources */,
+ 1A88DB1016288DFC00CC9EDC /* FTWButton.m in Sources */,
+ 1A88DB1316288E0400CC9EDC /* SKInnerShadowLayer.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 1A88DAF416288DD400CC9EDC /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1A88DAF516288DD400CC9EDC /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 1A88DB0616288DD500CC9EDC /* FTWViewController.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1A88DB0716288DD500CC9EDC /* en */,
+ );
+ name = FTWViewController.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 1A88DB0916288DD500CC9EDC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 1A88DB0A16288DD500CC9EDC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 1A88DB0C16288DD500CC9EDC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "FTWButton/FTWButton-Prefix.pch";
+ INFOPLIST_FILE = "FTWButton/FTWButton-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 1A88DB0D16288DD500CC9EDC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "FTWButton/FTWButton-Prefix.pch";
+ INFOPLIST_FILE = "FTWButton/FTWButton-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1A88DAE116288DD400CC9EDC /* Build configuration list for PBXProject "FTWButton" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1A88DB0916288DD500CC9EDC /* Debug */,
+ 1A88DB0A16288DD500CC9EDC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 1A88DB0B16288DD500CC9EDC /* Build configuration list for PBXNativeTarget "FTWButton" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1A88DB0C16288DD500CC9EDC /* Debug */,
+ 1A88DB0D16288DD500CC9EDC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 1A88DADE16288DD400CC9EDC /* Project object */;
+}
View
BIN  FTWButton/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  FTWButton/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  FTWButton/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 FTWButton/FTWAppDelegate.h
@@ -0,0 +1,19 @@
+//
+// FTWAppDelegate.h
+// FTWButton
+//
+// Created by Soroush Khanlou on 10/12/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class FTWViewController;
+
+@interface FTWAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@property (strong, nonatomic) FTWViewController *viewController;
+
+@end
View
26 FTWButton/FTWAppDelegate.m
@@ -0,0 +1,26 @@
+//
+// FTWAppDelegate.m
+// FTWButton
+//
+// Created by Soroush Khanlou on 10/12/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+#import "FTWAppDelegate.h"
+
+#import "FTWViewController.h"
+
+@implementation FTWAppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ // Override point for customization after application launch.
+ self.viewController = [[FTWViewController alloc] initWithNibName:@"FTWViewController" bundle:nil];
+ self.window.rootViewController = self.viewController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+
+@end
View
38 FTWButton/FTWButton-Info.plist
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>co.ftw.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
14 FTWButton/FTWButton-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'FTWButton' target in the 'FTWButton' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_4_0
+#warning "This project uses features only available in iOS SDK 4.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
View
108 FTWButton/FTWButton.h
@@ -0,0 +1,108 @@
+//
+// FTWAnimatableGradientButton.h
+// FTW
+//
+// Created by Soroush Khanlou on 1/26/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+//todo
+
+//override setframe
+
+#import <UIKit/UIKit.h>
+#import <QuartzCore/QuartzCore.h>
+
+typedef enum {
+ FTWAnimatableGradientButtonStyleDelete = 0,
+ FTWAnimatableGradientButtonStyleCancel,
+ FTWAnimatableGradientButtonStyleDisabled,
+ FTWAnimatableGradientButtonStyleBlue
+} FTWAnimatableGradientButtonStyle;
+
+@interface FTWButton : UIControl
+
+@property (nonatomic, assign) NSTextAlignment textAlignment;
+
+//a few default styles
+- (void) addDisabledStyleForState:(UIControlState)state;
+- (void) addDeleteStyleForState:(UIControlState)state;
+- (void) addGrayStyleForState:(UIControlState)state;
+- (void) addLightBlueStyleForState:(UIControlState)state;
+- (void) addBlueStyleForState:(UIControlState)state;
+- (void) addYellowStyleForState:(UIControlState)state;
+- (void) addBlackStyleForState:(UIControlState)state;
+
+
+
+- (void) setFrame:(CGRect)frame forControlState:(UIControlState)controlState;
+- (CGRect) frameForControlState:(UIControlState)controlState;
+
+- (void) setSelected:(BOOL)newSelected animated:(BOOL)animated;
+- (void) setHighlighted:(BOOL)highlighted animated:(BOOL)animated;
+
+//backrounds
+- (void) setBackgroundColor:(UIColor*)color forControlState:(UIControlState)controlState;
+- (UIColor*) backgroundColorForControlState:(UIControlState)controlState;
+
+- (void) setColors:(NSArray*)colors forControlState:(UIControlState)controlState;
+- (NSArray*) colorsForControlState:(UIControlState)controlState;
+
+//borders
+- (void) setBorderWidth:(CGFloat)borderWidth forControlState:(UIControlState)controlState;
+- (CGFloat) borderWidthForControlState:(UIControlState)controlState;
+
+- (void) setBorderColor:(UIColor*)borderColor forControlState:(UIControlState)controlState;
+- (UIColor*) borderColorForControlState:(UIControlState)controlState;
+
+- (void) setBorderColors:(NSArray*)borderColor forControlState:(UIControlState)controlState;
+- (NSArray*) borderColorsForControlState:(UIControlState)controlState;
+
+- (void) setCornerRadius:(CGFloat)cornerRadius forControlState:(UIControlState)controlState;
+- (CGFloat) cornerRadiusForControlState:(UIControlState)controlState;
+
+- (void) setIcon:(UIImage*)icon forControlState:(UIControlState)controlState;
+- (UIImage*) iconForControlState:(UIControlState)controlState;
+
+//text
+- (void) setText:(NSString*)text forControlState:(UIControlState)controlState;
+- (NSString*) textForControlState:(UIControlState)controlState;
+
+- (void) setTextColor:(UIColor*)textColor forControlState:(UIControlState)controlState;
+- (UIColor*) textColorForControlState:(UIControlState)controlState;
+
+- (void) setTextShadowColor:(UIColor*)textShadowColor forControlState:(UIControlState)controlState;
+- (UIColor*) textShadowColorForControlState:(UIControlState)controlState;
+
+- (void) setTextShadowOffset:(CGSize)textShadowOffset forControlState:(UIControlState)controlState;
+- (CGSize) textShadowOffsetForControlState:(UIControlState)controlState;
+
+- (void) setFont:(UIFont *)font;
+
+
+//shadow
+- (void) setShadowColor:(UIColor*)shadowColor forControlState:(UIControlState)controlState;
+- (UIColor*) shadowColorForControlState:(UIControlState)controlState;
+
+- (void) setShadowOffset:(CGSize)shadowOffset forControlState:(UIControlState)controlState;
+- (CGSize) shadowOffsetForControlState:(UIControlState)controlState;
+
+- (void) setShadowRadius:(CGFloat)shadowRadius forControlState:(UIControlState)controlState;
+- (CGFloat) shadowRadiusForControlState:(UIControlState)controlState;
+
+- (void) setShadowOpacity:(CGFloat)shadowOpacity forControlState:(UIControlState)controlState;
+- (CGFloat) shadowOpacityForControlState:(UIControlState)controlState;
+
+
+//inner shadow
+- (void) setInnerShadowColor:(UIColor*)shadowColor forControlState:(UIControlState)controlState;
+- (UIColor*) innerShadowColorForControlState:(UIControlState)controlState;
+
+- (void) setInnerShadowOffset:(CGSize)shadowOffset forControlState:(UIControlState)controlState;
+- (CGSize) innerShadowOffsetForControlState:(UIControlState)controlState;
+
+- (void) setInnerShadowRadius:(CGFloat)shadowRadius forControlState:(UIControlState)controlState;
+- (CGFloat) innerShadowRadiusForControlState:(UIControlState)controlState;
+
+
+@end
View
854 FTWButton/FTWButton.m
@@ -0,0 +1,854 @@
+//
+// FTWAnimatableGradientButton.m
+// FTW
+//
+// Created by Soroush Khanlou on 1/26/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+
+#import "FTWButton.h"
+#import "SKInnerShadowLayer.h"
+
+@interface FTWButton()
+
+@property (strong, nonatomic) SKInnerShadowLayer *backgroundLayer;
+@property (strong, nonatomic) CAGradientLayer *borderLayer;
+
+@property (strong, nonatomic) UIImageView *normalIcon;
+@property (strong, nonatomic) UIImageView *selectedIcon;
+
+@property (strong, nonatomic) UILabel *label;
+@property (strong, nonatomic) UILabel *selectedLabel;
+@property (strong, nonatomic) NSMutableDictionary *texts;
+
+@property (strong, nonatomic) NSMutableDictionary *textColors;
+@property (strong, nonatomic) NSMutableDictionary *textShadowColors;
+@property (strong, nonatomic) NSMutableDictionary *textShadowOffsets;
+
+@property (strong, nonatomic) NSMutableDictionary *borderWidths;
+@property (strong, nonatomic) NSMutableDictionary *borderColors;
+@property (strong, nonatomic) NSMutableDictionary *borderGradients;
+
+@property (strong, nonatomic) NSMutableDictionary *cornerRadii;
+
+@property (strong, nonatomic) NSMutableDictionary *gradients;
+@property (strong, nonatomic) NSMutableDictionary *backgroundColors;
+@property (strong, nonatomic) NSMutableDictionary *frames;
+
+@property (strong, nonatomic) NSMutableDictionary *shadowColors;
+@property (strong, nonatomic) NSMutableDictionary *shadowOffsets;
+@property (strong, nonatomic) NSMutableDictionary *shadowRadii;
+@property (strong, nonatomic) NSMutableDictionary *shadowOpacities;
+
+@property (strong, nonatomic) NSMutableDictionary *innerShadowColors;
+@property (strong, nonatomic) NSMutableDictionary *innerShadowOffsets;
+@property (strong, nonatomic) NSMutableDictionary *innerShadowRadii;
+
+@property (strong, nonatomic) NSMutableDictionary *icons;
+
+
+- (id) getValueFromDictionary:(NSDictionary*)dictionary forControlState:(UIControlState)controlState;
+- (void) setValue:(id)value inDictionary:(NSDictionary*)dictionary forControlState:(UIControlState)controlState;
+
+
+- (void) configureViewForControlState:(UIControlState)controlState;
+- (void) configureLayerPropertiesForControlState:(UIControlState)controlState;
+- (void) configureViewPropertiesForControlState:(UIControlState)controlState;
+- (UIControlState) currentControlState;
+
+- (void) commonInit;
+
+@end
+
+@implementation FTWButton
+
+@synthesize borderLayer, backgroundLayer;
+@synthesize normalIcon, selectedIcon;
+@synthesize label, selectedLabel;
+@synthesize texts;
+@synthesize textColors, textShadowColors, textShadowOffsets, textAlignment;
+@synthesize borderWidths, borderColors, borderGradients, cornerRadii;
+@synthesize gradients, backgroundColors, frames;
+@synthesize shadowColors, shadowOffsets, shadowRadii, shadowOpacities;
+@synthesize innerShadowColors, innerShadowOffsets, innerShadowRadii;
+@synthesize icons;
+
+
+#pragma mark - init methods
+
+- (id) init {
+ self = [super init];
+ if (self) {
+ [self commonInit];
+ }
+ return self;
+}
+
+- (id) initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:aDecoder];
+ if (self) {
+ [self commonInit];
+ }
+ return self;
+}
+
+- (id) initWithFrame:(CGRect)frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ [self commonInit];
+ self.frame = frame;
+ }
+ return self;
+}
+
+
+- (void) commonInit {
+ self.backgroundColor = [UIColor clearColor];
+
+ self.label = [[UILabel alloc] init];
+ label.font = [UIFont boldSystemFontOfSize:12.0f];
+ label.textColor = [UIColor whiteColor];
+ label.shadowColor = [UIColor colorWithRed:107.0f/255.0f green:107.0f/255.0f blue:107.0f/255.0f alpha:0.5f];
+ label.shadowOffset = CGSizeMake(0, 1);
+ label.backgroundColor = [UIColor clearColor];
+ [self addSubview:label];
+
+ self.selectedLabel = [[UILabel alloc] init];
+ selectedLabel.font = [UIFont boldSystemFontOfSize:12.0f];
+ selectedLabel.textColor = [UIColor whiteColor];
+ selectedLabel.shadowColor = [UIColor colorWithRed:50.0f/255.0f green:50.0f/255.0f blue:50.0f/255.0f alpha:0.3f];
+ selectedLabel.shadowOffset = CGSizeMake(0, 1);
+ selectedLabel.backgroundColor = [UIColor clearColor];
+ selectedLabel.alpha = 0;
+ [self addSubview:selectedLabel];
+
+ normalIcon = [[UIImageView alloc] initWithFrame:CGRectZero];
+ selectedIcon = [[UIImageView alloc] initWithFrame:CGRectZero];
+ normalIcon.contentMode = UIViewContentModeScaleAspectFit;
+ selectedIcon.contentMode = UIViewContentModeScaleAspectFit;
+
+ label.lineBreakMode = NSLineBreakByClipping;
+ selectedLabel.lineBreakMode = NSLineBreakByClipping;
+
+
+ [self addSubview:normalIcon];
+ [self addSubview:selectedIcon];
+
+ backgroundLayer = [SKInnerShadowLayer layer];
+ [self.layer insertSublayer:backgroundLayer atIndex:0];
+ // backgroundLayer.delegate = self;
+
+ borderLayer = [CAGradientLayer layer];
+ [self.layer insertSublayer:borderLayer atIndex:0];
+ // borderLayer.delegate = self;
+
+
+
+ backgroundColors = [NSMutableDictionary new];
+ gradients = [NSMutableDictionary new];
+ borderColors = [NSMutableDictionary new];
+ borderGradients = [NSMutableDictionary new];
+
+ borderWidths = [NSMutableDictionary new];
+ cornerRadii = [NSMutableDictionary new];
+
+ shadowRadii = [NSMutableDictionary new];
+ shadowOffsets = [NSMutableDictionary new];
+ shadowColors = [NSMutableDictionary new];
+ shadowOpacities = [NSMutableDictionary new];
+
+ innerShadowOffsets = [NSMutableDictionary new];
+ innerShadowColors = [NSMutableDictionary new];
+ innerShadowRadii = [NSMutableDictionary new];
+
+ textColors = [NSMutableDictionary new];
+ textShadowOffsets = [NSMutableDictionary new];
+ textShadowColors = [NSMutableDictionary new];
+
+ frames = [NSMutableDictionary new];
+ texts = [NSMutableDictionary new];
+ icons = [NSMutableDictionary new];
+
+ self.textAlignment = NSTextAlignmentCenter;
+ [self setFont:[UIFont boldSystemFontOfSize:15.0f]];
+ [self setCornerRadius:3.0f forControlState:UIControlStateNormal];
+}
+
+
+#pragma mark - layout
+
+- (void) layoutSubviews {
+ [super layoutSubviews];
+ NSInteger horizontalPadding = 7;
+ NSInteger verticalPadding = 6;
+
+ NSInteger imageSize = 0;
+ if (normalIcon.image != nil) {
+ imageSize = MAX(normalIcon.image.size.height, normalIcon.image.size.width);
+ NSInteger padding = (self.frame.size.height - imageSize)/2;
+ horizontalPadding = padding;
+ verticalPadding = padding;
+ normalIcon.layer.frame = CGRectMake(horizontalPadding, verticalPadding, imageSize, imageSize);
+ selectedIcon.layer.frame = CGRectMake(horizontalPadding, verticalPadding, imageSize, imageSize);
+ imageSize += horizontalPadding;
+ }
+
+ CGRect labelRect = CGRectMake(horizontalPadding + imageSize, verticalPadding, self.frame.size.width - horizontalPadding*2 - imageSize, self.frame.size.height - verticalPadding*2);
+
+ label.frame = labelRect;
+ selectedLabel.frame = labelRect;
+}
+
+- (void) setFrame:(CGRect)aFrame {
+ [self setFrame:aFrame forControlState:UIControlStateNormal];
+ [self configureViewForControlState:[self currentControlState]];
+}
+
+- (void) setFrameInternal:(CGRect)aFrame {
+ [super setFrame:aFrame];
+
+}
+
+- (void) setTextAlignment:(NSTextAlignment)newTextAlignment {
+ label.textAlignment = newTextAlignment;
+ selectedLabel.textAlignment = newTextAlignment;
+}
+
+- (NSTextAlignment) textAlignment {
+ return label.textAlignment;
+}
+
+- (void) setFont:(UIFont *)font {
+ label.font = font;
+ selectedLabel.font = font;
+}
+
+- (UIFont*) font {
+ return label.font;
+}
+
+
+- (void) setSelected:(BOOL)selected {
+ if (selected != self.selected) {
+ super.selected = selected;
+ [self setSelected:selected animated:YES];
+ }
+}
+
+
+- (void) setHighlighted:(BOOL)highlighted {
+ if (highlighted != self.highlighted) {
+ super.highlighted = highlighted;
+ [self setHighlighted:highlighted animated:YES];
+ }
+}
+
+- (void) setEnabled:(BOOL)newEnabled {
+ [super setEnabled:newEnabled];
+ [self configureViewForControlState:[self currentControlState]];
+}
+
+- (void) setSelected:(BOOL)newSelected animated:(BOOL)animated {
+ UIControlState controlState = [self currentControlState];
+ if (animated) {
+ NSTimeInterval duration = 0.2;
+
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:duration];
+ [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] ];
+ [self configureLayerPropertiesForControlState:controlState];
+ [CATransaction commit];
+
+ [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationCurveEaseInOut animations:^{
+ [self configureViewPropertiesForControlState:controlState];
+ } completion:^(BOOL finished) { }];
+ } else {
+ [self configureViewForControlState:controlState];
+ }
+}
+
+- (void) setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
+ UIControlState controlState = [self currentControlState];
+ if (animated) {
+ CGFloat duration = 0.18f;
+
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:duration];
+ [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] ];
+ [self configureLayerPropertiesForControlState:controlState];
+ [CATransaction commit];
+
+ [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationCurveEaseInOut animations:^{
+ [self configureViewPropertiesForControlState:controlState];
+ } completion:^(BOOL finished) { }];
+ } else {
+ [self configureViewForControlState:controlState];
+ }
+}
+
+
+- (void) configureViewForControlState:(UIControlState)controlState {
+ [self configureLayerPropertiesForControlState:controlState];
+ [self configureViewPropertiesForControlState:controlState];
+}
+
+- (void) configureLayerPropertiesForControlState:(UIControlState)controlState {
+ //rename layers to ease readability
+ SKInnerShadowLayer *innerShadowLayer = backgroundLayer;
+ CALayer *dropShadowLayer = self.layer;
+
+
+ //set background colors and gradients
+ backgroundLayer.colors = [self colorsForControlState:controlState];
+ backgroundLayer.backgroundColor = [self backgroundColorForControlState:controlState].CGColor;
+
+ //set border widths, colors, and gradients
+ if ([self borderWidthForControlState:controlState] > 0) {
+ if ([self borderColorsForControlState:controlState]) {
+ borderLayer.colors = [self borderColorsForControlState:controlState];
+ borderLayer.backgroundColor = [UIColor clearColor].CGColor;
+ } else {
+ if ([self borderColorForControlState:controlState]) {
+ borderLayer.backgroundColor = [self borderColorForControlState:controlState].CGColor;
+ } else {
+ borderLayer.backgroundColor = [self backgroundColorForControlState:controlState].CGColor;
+ }
+ }
+ }
+
+ //set corner radii appropriately
+ CGFloat cornerRadiusForControlState = [self cornerRadiusForControlState:[self currentControlState]];
+ backgroundLayer.cornerRadius = cornerRadiusForControlState - [self borderWidthForControlState:[self currentControlState]];
+ backgroundLayer.cornerRadius = MAX(0, backgroundLayer.cornerRadius);
+ borderLayer.cornerRadius = cornerRadiusForControlState;
+
+ //add drop shadow
+ if ([self shadowColorForControlState:controlState]) {
+ dropShadowLayer.shadowColor = [self shadowColorForControlState:controlState].CGColor;
+ if ([self shadowOpacityForControlState:controlState]) {
+ dropShadowLayer.shadowOpacity = [self shadowOpacityForControlState:controlState];
+ } else {
+ dropShadowLayer.shadowOpacity = 0.0f;
+ }
+ }
+ dropShadowLayer.shadowOffset = [self shadowOffsetForControlState:controlState];
+ dropShadowLayer.shadowRadius = [self shadowRadiusForControlState:controlState];
+
+
+ //add inner shadow
+ if ([self innerShadowColorForControlState:controlState]) {
+ innerShadowLayer.innerShadowColor = [self innerShadowColorForControlState:controlState].CGColor;
+ innerShadowLayer.innerShadowOpacity = 1.0f;
+ }
+ innerShadowLayer.innerShadowOffset = [self innerShadowOffsetForControlState:controlState];
+ innerShadowLayer.innerShadowRadius = [self innerShadowRadiusForControlState:controlState];
+
+ CGFloat borderWidth = [self borderWidthForControlState:controlState];
+ CGRect rectForState = [self frameForControlState:controlState];
+ borderLayer.frame = CGRectMake(0, 0, CGRectGetWidth(rectForState), CGRectGetHeight(rectForState));
+ backgroundLayer.frame = CGRectMake(
+ 0 + borderWidth,
+ 0 + borderWidth,
+ CGRectGetWidth(rectForState) - borderWidth*2,
+ CGRectGetHeight(rectForState) - borderWidth*2
+ );
+
+
+}
+
+- (void) configureViewPropertiesForControlState:(UIControlState)controlState {
+ [self setFrameInternal:[self frameForControlState:controlState]];
+ [self layoutSubviews];
+
+ //set text shadow
+ UILabel *labelForControlState = label;
+ if (controlState & UIControlStateSelected) {
+ labelForControlState = selectedLabel;
+ }
+ labelForControlState.shadowColor = [self textShadowColorForControlState:controlState];
+ labelForControlState.shadowOffset = [self textShadowOffsetForControlState:controlState];
+ if ([self textColorForControlState:controlState]) {
+ labelForControlState.textColor = [self textColorForControlState:controlState];
+ }
+
+ CGFloat alpha = 1.0f;
+
+ //show the selected icon and label, if necessary
+ if (self.selected) {
+ alpha = 0.0f;
+ }
+ label.alpha = alpha;
+ normalIcon.alpha = alpha;
+ selectedIcon.alpha = 1.0f - alpha;
+ selectedLabel.alpha = 1.0f - alpha;
+}
+
+
+- (UIControlState) currentControlState {
+ UIControlState controlState = UIControlStateNormal;
+ if (self.selected) {
+ controlState += UIControlStateSelected;
+ }
+ if (self.highlighted) {
+ controlState += UIControlStateHighlighted;
+ }
+ if (!self.enabled) {
+ controlState += UIControlStateDisabled;
+ }
+ return controlState;
+}
+
+
+
+#pragma mark - default setter and getter
+
+- (void) setValue:(id)value inDictionary:(NSDictionary*)dictionary forControlState:(UIControlState)controlState {
+ [dictionary setValue:value forKey:[NSString stringWithFormat:@"%d",controlState]];
+ [self configureViewForControlState:[self currentControlState]];
+}
+
+- (id) getValueFromDictionary:(NSDictionary*)dictionary forControlState:(UIControlState)controlState {
+ if ([dictionary valueForKey:[NSString stringWithFormat:@"%d",controlState]]) {
+ return [dictionary valueForKey:[NSString stringWithFormat:@"%d",controlState]];
+ }
+
+
+ if ((controlState & UIControlStateSelected) && [dictionary valueForKey:[NSString stringWithFormat:@"%d",UIControlStateSelected]]) {
+ return [dictionary valueForKey:[NSString stringWithFormat:@"%d",UIControlStateSelected]];
+ } else if ((controlState & UIControlStateHighlighted) && [dictionary valueForKey:[NSString stringWithFormat:@"%d", UIControlStateHighlighted]]) {
+ return [dictionary valueForKey:[NSString stringWithFormat:@"%d", UIControlStateHighlighted]];
+ } else {
+ return [dictionary valueForKey:[NSString stringWithFormat:@"%d",UIControlStateNormal]];
+ }
+}
+
+
+
+
+#pragma mark - setters and getters
+
+- (void) setTextColor:(UIColor *)newTextColor forControlState:(UIControlState)controlState {
+ if (controlState == UIControlStateNormal) {
+ label.textColor = newTextColor;
+ }
+ if (controlState & UIControlStateSelected) {
+ selectedLabel.textColor = newTextColor;
+ }
+ [textColors setValue:newTextColor forKey:[NSString stringWithFormat:@"%d",controlState]];
+ [self setValue:newTextColor inDictionary:textColors forControlState:controlState];
+}
+
+- (UIColor*) textColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:textColors forControlState:controlState];
+}
+
+- (void) setBorderWidth:(CGFloat)borderWidth forControlState:(UIControlState)controlState {
+ [self setValue:[NSNumber numberWithFloat:borderWidth] inDictionary:borderWidths forControlState:controlState];
+}
+
+- (CGFloat) borderWidthForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:borderWidths forControlState:controlState] floatValue];
+}
+
+- (void) setCornerRadius:(CGFloat)cornerRadius forControlState:(UIControlState)controlState {
+ [self setValue:[NSNumber numberWithFloat:cornerRadius] inDictionary:cornerRadii forControlState:controlState];
+}
+
+- (CGFloat) cornerRadiusForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:cornerRadii forControlState:controlState] floatValue];
+}
+
+
+- (void) setTextShadowColor:(UIColor *)newTextShadowColor forControlState:(UIControlState)controlState {
+ if (controlState == UIControlStateNormal) {
+ label.shadowColor = newTextShadowColor;
+ }
+ if (controlState & UIControlStateSelected) {
+ selectedLabel.shadowColor = newTextShadowColor;
+ }
+ if (controlState & UIControlStateDisabled && [self currentControlState] & UIControlStateDisabled) {
+ label.shadowColor = newTextShadowColor; //this isn't ideal
+ }
+ [self setValue:newTextShadowColor inDictionary:textShadowColors forControlState:controlState];
+}
+
+- (UIColor*) textShadowColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:textShadowColors forControlState:controlState];
+}
+
+
+
+- (void) setTextShadowOffset:(CGSize)textShadowOffset forControlState:(UIControlState)controlState {
+ if (controlState == UIControlStateNormal) {
+ label.shadowOffset = textShadowOffset;
+ }
+ if (controlState & UIControlStateSelected) {
+ selectedLabel.shadowOffset = textShadowOffset;
+ }
+ [self setValue:[NSValue valueWithCGSize:textShadowOffset] inDictionary:textShadowOffsets forControlState:controlState];
+}
+
+- (CGSize) textShadowOffsetForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:textShadowOffsets forControlState:controlState] CGSizeValue];
+}
+
+
+- (void) setText:(NSString*)text forControlState:(UIControlState)controlState {
+ if (controlState == UIControlStateNormal) {
+ if (selectedLabel.text == nil || selectedLabel.text.length == 0 || [selectedLabel.text isEqualToString:label.text]) {
+ selectedLabel.text = text;
+ }
+ label.text = text;
+ }
+ if (controlState & UIControlStateSelected) {
+ selectedLabel.text = text;
+ }
+ [self setValue:text inDictionary:texts forControlState:controlState];
+}
+
+- (NSString*) textForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:texts forControlState:controlState];
+}
+
+- (void) setFrame:(CGRect)frame forControlState:(UIControlState)controlState {
+ if (frames.allKeys.count == 0) {
+ [self setFrameInternal:frame];
+ }
+ [self setValue:[NSValue valueWithCGRect:frame] inDictionary:frames forControlState:controlState];
+ [self configureViewForControlState:[self currentControlState]];
+}
+
+- (CGRect) frameForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:frames forControlState:controlState] CGRectValue];
+}
+
+
+#pragma mark drop shadow
+
+- (void) setShadowColor:(UIColor*)shadowColor forControlState:(UIControlState)controlState {
+ [self setValue:shadowColor inDictionary:shadowColors forControlState:controlState];
+}
+
+- (UIColor*) shadowColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:shadowColors forControlState:controlState];
+}
+
+- (void) setShadowOffset:(CGSize)shadowOffset forControlState:(UIControlState)controlState {
+ [self setValue:[NSValue valueWithCGSize:shadowOffset] inDictionary:shadowOffsets forControlState:controlState];
+}
+
+- (CGSize) shadowOffsetForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:shadowOffsets forControlState:controlState] CGSizeValue];
+}
+
+- (void) setShadowRadius:(CGFloat)shadowRadius forControlState:(UIControlState)controlState {
+ [self setValue:[NSNumber numberWithFloat:shadowRadius] inDictionary:shadowRadii forControlState:controlState];
+}
+
+- (CGFloat) shadowRadiusForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:shadowRadii forControlState:controlState] floatValue];
+}
+
+- (void) setShadowOpacity:(CGFloat)shadowOpacity forControlState:(UIControlState)controlState {
+ [self setValue:[NSNumber numberWithFloat:shadowOpacity] inDictionary:shadowOpacities forControlState:controlState];
+}
+
+- (CGFloat) shadowOpacityForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:shadowOpacities forControlState:controlState] floatValue];
+}
+
+
+#pragma mark inner shadow
+
+- (void) setInnerShadowColor:(UIColor*)shadowColor forControlState:(UIControlState)controlState {
+ [self setValue:shadowColor inDictionary:innerShadowColors forControlState:controlState];
+}
+
+- (UIColor*) innerShadowColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:innerShadowColors forControlState:controlState];
+}
+
+- (void) setInnerShadowOffset:(CGSize)shadowOffset forControlState:(UIControlState)controlState {
+ [self setValue:[NSValue valueWithCGSize:shadowOffset] inDictionary:innerShadowOffsets forControlState:controlState];
+}
+
+- (CGSize) innerShadowOffsetForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:innerShadowOffsets forControlState:controlState] CGSizeValue];
+}
+
+- (void) setInnerShadowRadius:(CGFloat)shadowRadius forControlState:(UIControlState)controlState {
+ [innerShadowRadii setValue:[NSNumber numberWithFloat:shadowRadius] forKey:[NSString stringWithFormat:@"%d",controlState]];
+ [self setValue:[NSNumber numberWithFloat:shadowRadius] inDictionary:innerShadowRadii forControlState:controlState];
+}
+
+- (CGFloat) innerShadowRadiusForControlState:(UIControlState)controlState {
+ return [[self getValueFromDictionary:innerShadowRadii forControlState:controlState] floatValue];
+}
+
+#pragma mark images
+
+- (void) setIcon:(UIImage*)icon forControlState:(UIControlState)controlState {
+ //this is just wrong - what if you set a highlightd image?
+ if (controlState == UIControlStateNormal) {
+ normalIcon.image = icon;
+ }
+ if (controlState & UIControlStateSelected) {
+ selectedIcon.image = icon;
+ }
+ [self setValue:icons inDictionary:icons forControlState:controlState];
+ [self setNeedsLayout];
+}
+
+- (UIImage*) iconForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:icons forControlState:controlState];
+}
+
+
+#pragma mark background colors
+
+- (void) setBackgroundColor:(UIColor*)color forControlState:(UIControlState)controlState {
+ [self setValue:color inDictionary:backgroundColors forControlState:controlState];
+}
+
+- (UIColor*) backgroundColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:backgroundColors forControlState:controlState];
+}
+
+- (void) setColors:(NSArray*)colors forControlState:(UIControlState)controlState {
+ [self setValue:colors inDictionary:gradients forControlState:controlState];
+}
+
+- (NSArray*) colorsForControlState:(UIControlState)controlState {
+ NSArray *colors = [self getValueFromDictionary:gradients forControlState:controlState];
+ if (!colors) {
+ return nil;
+ }
+
+ NSMutableArray *mutableColors = [NSMutableArray new];
+ NSInteger numberOfColors = colors.count;
+ for (NSInteger i = 0; i < numberOfColors; i++) {
+ id color = [colors objectAtIndex:i];
+ if ([color isKindOfClass:[UIColor class]]) {
+ UIColor *theColor = (UIColor*) color;
+ [mutableColors addObject:(id)theColor.CGColor];
+ }
+ }
+ return [mutableColors copy];
+}
+
+- (void) setBorderColors:(NSArray*)borderColor forControlState:(UIControlState)controlState {
+ [self setValue:borderColor inDictionary:borderGradients forControlState:controlState];
+}
+
+- (NSArray*) borderColorsForControlState:(UIControlState)controlState {
+ NSArray *colors = [self getValueFromDictionary:borderGradients forControlState:controlState];
+ if (!colors) {
+ return nil;
+ }
+ NSMutableArray *mutableColors = [NSMutableArray new];
+ NSInteger numberOfColors = colors.count;
+ for (NSInteger i = 0; i < numberOfColors; i++) {
+ id color = [colors objectAtIndex:i];
+ if ([color isKindOfClass:[UIColor class]]) {
+ UIColor *theColor = (UIColor*) color;
+ [mutableColors addObject:(id)theColor.CGColor];
+ }
+ }
+ return [mutableColors copy];
+}
+
+
+- (void) setBorderColor:(UIColor*)borderColor forControlState:(UIControlState)controlState {
+ [self setValue:borderColor inDictionary:borderColors forControlState:controlState];
+}
+
+- (UIColor*) borderColorForControlState:(UIControlState)controlState {
+ return [self getValueFromDictionary:borderColors forControlState:controlState];
+}
+
+#pragma mark - built in styles
+
+- (void) addDisabledStyleForState:(UIControlState)state {
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:170.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:97.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+ [self setInnerShadowColor:[UIColor colorWithWhite:205.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setTextColor:[UIColor colorWithWhite:181.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithWhite:97.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+}
+
+- (void) addDeleteStyleForState:(UIControlState)state {
+
+ [self setInnerShadowColor:[UIColor colorWithRed:255.0f/255 green:96.0f/255 blue:53.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setShadowColor:[UIColor colorWithRed:103.0f/255 green:12.0f/255 blue:5.0f/255 alpha:1.0f] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:255.0f/255 green:73.0f/255 blue:1.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:254.0f/255 green:2.0f/255 blue:1.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+ [self setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithRed:115.0f/255 green:4.0f/255 blue:0 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+
+ if (state == UIControlStateSelected || state == UIControlStateNormal) {
+ UIControlState highlightedState = state | UIControlStateHighlighted;
+ [self setInnerShadowColor:[UIColor colorWithRed:202.0f/255 green:67.0f/255 blue:30.0f/255 alpha:1.0f] forControlState:highlightedState];
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:194.0f/255 green:38.0f/255 blue:0.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:166.0f/255 green:16.0f/255 blue:0.0f/255 alpha:1.0f],
+ nil] forControlState:highlightedState];
+ }
+}
+
+- (void) addGrayStyleForState:(UIControlState)state {
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:170.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:98.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+ [self setInnerShadowColor:[UIColor colorWithWhite:230.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+
+ [self setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithWhite:78.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+
+ if (state == UIControlStateSelected || state == UIControlStateNormal) {
+ UIControlState highlightedState = state | UIControlStateHighlighted;
+ [self setInnerShadowColor:[UIColor colorWithWhite:150.0f/255 alpha:1.0f] forControlState:highlightedState];
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:121.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:90.0f/255 alpha:1.0f],
+ nil] forControlState:highlightedState];
+ }
+}
+
+- (void) addBlackStyleForState:(UIControlState)state {
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:95.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:48.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+ [self setInnerShadowColor:[UIColor colorWithWhite:140.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+
+ [self setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithWhite:40.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+
+ if (state == UIControlStateSelected || state == UIControlStateNormal) {
+ UIControlState highlightedState = state | UIControlStateHighlighted;
+ [self setInnerShadowColor:[UIColor colorWithWhite:150.0f/255 alpha:1.0f] forControlState:highlightedState];
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:121.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:90.0f/255 alpha:1.0f],
+ nil] forControlState:highlightedState];
+ }
+}
+
+- (void) addLightBlueStyleForState:(UIControlState)state {
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:0.0f/255 green:196.0f/255 blue:255.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:0.0f/255 green:103.0f/255 blue:255.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+ [self setTextShadowColor:[UIColor colorWithRed:0.0f/255 green:130.0f/255 blue:208.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setInnerShadowColor:[UIColor colorWithRed:124.0f/255 green:225.0f/255 blue:255.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setTextColor:[UIColor whiteColor] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithRed:0.0f/255 green:130.0f/255 blue:208.0f/255 alpha:1.0f] forControlState:state];
+}
+
+- (void) addYellowStyleForState:(UIControlState)state {
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:255.0f/255 green:203.0f/255 blue:0.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:251.0f/255 green:154.0f/255 blue:0.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+
+ [self setInnerShadowColor:[UIColor colorWithRed:255.0f/255 green:215.0f/255 blue:94.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithRed:173.0f/255 green:120.0f/255 blue:0.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+ if (state == UIControlStateSelected || state == UIControlStateNormal) {
+ UIControlState highlightedState = state | UIControlStateHighlighted;
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:233.0f/255 green:169.0f/255 blue:0.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:223.0f/255 green:121.0f/255 blue:0.0f/255 alpha:1.0f],
+ nil] forControlState:highlightedState];
+
+ [self setInnerShadowColor:[UIColor colorWithRed:255.0f/255 green:197.0f/255 blue:85.0f/255 alpha:1.0f] forControlState:highlightedState];
+
+ }
+}
+
+- (void) addBlueStyleForState:(UIControlState)state {
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:2.0f/255 green:184.0f/255 blue:255.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:0.0f/255 green:68.0f/255 blue:255.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+
+ [self setInnerShadowColor:[UIColor colorWithRed:108.0f/255 green:221.0f/255 blue:253.0f/255 alpha:1.0f] forControlState:state];
+ [self setInnerShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setShadowColor:[UIColor blackColor] forControlState:state];
+ [self setShadowOffset:CGSizeMake(0, 1) forControlState:state];
+
+ [self setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:state];
+ [self setTextShadowColor:[UIColor colorWithWhite:78.0f/255 alpha:1.0f] forControlState:state];
+ [self setTextShadowOffset:CGSizeMake(0, -1) forControlState:state];
+
+ if (state == UIControlStateSelected || state == UIControlStateNormal) {
+ UIControlState highlightedState = state | UIControlStateHighlighted;
+
+ [self setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:1.0f/255 green:150.0f/255 blue:207.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:0.0f/255 green:51.0f/255 blue:191.0f/255 alpha:1.0f],
+ nil] forControlState:highlightedState];
+ [self setInnerShadowColor:[UIColor colorWithRed:86.0f/255 green:174.0f/255 blue:199.0f/255 alpha:1.0f] forControlState:highlightedState];
+ }
+}
+
+
+@end
View
13 FTWButton/FTWViewController.h
@@ -0,0 +1,13 @@
+//
+// FTWViewController.h
+// FTWButton
+//
+// Created by Soroush Khanlou on 10/12/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface FTWViewController : UIViewController
+
+@end
View
149 FTWButton/FTWViewController.m
@@ -0,0 +1,149 @@
+//
+// FTWViewController.m
+// FTWButton
+//
+// Created by Soroush Khanlou on 10/12/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+#import "FTWViewController.h"
+#import "FTWButton.h"
+
+@interface FTWViewController ()
+
+@property (nonatomic, strong) FTWButton *button1;
+@property (nonatomic, strong) FTWButton *button6;
+
+@end
+
+@implementation FTWViewController
+
+@synthesize button1, button6;
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ // Do any additional setup after loading the view, typically from a nib.
+
+ self.view.backgroundColor = [UIColor whiteColor];
+ button1 = [[FTWButton alloc] init];
+
+ button1.frame = CGRectMake(20, 20, 280, 40);
+ [button1 addBlueStyleForState:UIControlStateNormal];
+ [button1 addYellowStyleForState:UIControlStateSelected];
+
+ [button1 setText:@"Tap me" forControlState:UIControlStateNormal];
+ [button1 setText:@"Tapped!" forControlState:UIControlStateSelected];
+
+ [button1 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button1];
+
+
+
+
+ FTWButton *button2 = [[FTWButton alloc] init];
+
+ button2.frame = CGRectMake(20, 80, 280, 40);
+ [button2 addDeleteStyleForState:UIControlStateNormal];
+
+ [button2 setText:@"Do weird things to the border!" forControlState:UIControlStateNormal];
+
+ [button2 setCornerRadius:4.0f forControlState:UIControlStateNormal];
+ [button2 setCornerRadius:14.0f forControlState:UIControlStateHighlighted];
+ [button2 setBorderColor:[UIColor blackColor] forControlState:UIControlStateNormal];
+ [button2 setBorderWidth:1.0f forControlState:UIControlStateNormal];
+ [button2 setBorderWidth:4.0f forControlState:UIControlStateHighlighted];
+
+ [button2 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button2];
+
+
+
+
+
+ FTWButton *button3 = [[FTWButton alloc] init];
+ button3.frame = CGRectMake(20, 140, 280, 40);
+ [button3 addDisabledStyleForState:UIControlStateDisabled];
+ button3.enabled = NO;
+ [button3 setText:@"Disabled button style" forControlState:UIControlStateNormal];
+ [button3 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button3];
+
+
+
+
+
+ FTWButton *button4 = [[FTWButton alloc] init];
+
+ button4.frame = CGRectMake(20, 200, 280, 40);
+ [button4 addGrayStyleForState:UIControlStateNormal];
+
+ [button4 setBorderColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:0.6f alpha:1.0f],
+ [UIColor colorWithWhite:0.1f alpha:1.0f],
+ nil] forControlState:UIControlStateNormal];
+ [button4 setBorderColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:0.2f alpha:1.0f],
+ [UIColor colorWithWhite:0.0f alpha:1.0f],
+ nil] forControlState:UIControlStateHighlighted];
+ [button4 setBorderWidth:2.0f forControlState:UIControlStateNormal];
+ [button4 setCornerRadius:4.0f forControlState:UIControlStateNormal];
+
+ [button4 setText:@"Gradient borders!" forControlState:UIControlStateNormal];
+
+
+ [button4 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button4];
+
+
+
+
+ FTWButton *button5 = [[FTWButton alloc] init];
+
+ button5.frame = CGRectMake(20, 260, 280, 40);
+ [button5 addBlueStyleForState:UIControlStateNormal];
+ [button5 setText:@"Blurred inner shadows" forControlState:UIControlStateNormal];
+
+
+ [button5 setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithWhite:98.0f/255 alpha:1.0f],
+ [UIColor colorWithWhite:108.0f/255 alpha:1.0f],
+ nil] forControlState:UIControlStateHighlighted];
+
+ [button5 setInnerShadowColor:[UIColor blackColor] forControlState:UIControlStateHighlighted];
+ [button5 setInnerShadowRadius:4.0f forControlState:UIControlStateHighlighted];
+ [button5 setInnerShadowOffset:CGSizeMake(0, 2) forControlState:UIControlStateHighlighted];
+
+ [button5 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button5];
+
+
+
+
+
+ button6 = [[FTWButton alloc] init];
+ button6.frame = CGRectMake(40, 320, 240, 40);
+ [button6 setFrame:CGRectMake(67, 320, 185, 40) forControlState:UIControlStateSelected];
+ [button6 addBlueStyleForState:UIControlStateNormal];
+ [button6 setInnerShadowColor:[UIColor colorWithRed:200.0f/255 green:250.0f/255 blue:253.0f/255 alpha:1.0f] forControlState:UIControlStateNormal];
+ [button6 setInnerShadowRadius:2.0f forControlState:UIControlStateNormal];
+ [button6 setText:@"Here is some normal text" forControlState:UIControlStateNormal];
+ [button6 setText:@"Selected state text" forControlState:UIControlStateSelected];
+ [button6 setIcon:[UIImage imageNamed:@"planet"] forControlState:UIControlStateNormal];
+ [button6 setIcon:[UIImage imageNamed:@"weather"] forControlState:UIControlStateSelected];
+
+ button6.textAlignment = NSTextAlignmentLeft;
+ [button6 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button6];
+
+}
+
+- (IBAction) buttonTapped:(id)sender {
+ if (sender == button1) {
+ button1.selected = !button1.selected;
+ }
+ if (sender == button6) {
+ button6.selected = !button6.selected;
+ }
+}
+
+@end
View
18 FTWButton/SKInnerShadowLayer.h
@@ -0,0 +1,18 @@
+//
+// CAInnerShadowLayer.h
+// FTW
+//
+// Created by Soroush Khanlou on 6/13/12.
+// Copyright (c) 2012 Soroush Khanlou. All rights reserved.
+//
+
+#import <QuartzCore/QuartzCore.h>
+
+@interface SKInnerShadowLayer : CAGradientLayer
+
+@property CGColorRef innerShadowColor;
+@property CGSize innerShadowOffset;
+@property CGFloat innerShadowRadius;
+@property CGFloat innerShadowOpacity;
+
+@end
View
148 FTWButton/SKInnerShadowLayer.m
@@ -0,0 +1,148 @@
+//
+// CAInnerShadowLayer.m
+// FTW
+//
+// Created by Soroush Khanlou on 6/13/12.
+// Copyright (c) 2012 Soroush Khanlou. All rights reserved.
+//
+
+#import "SKInnerShadowLayer.h"
+
+@interface SKInnerShadowLayer ()
+
+- (void) commonInit;
+
+@end
+
+@implementation SKInnerShadowLayer
+
+@dynamic innerShadowColor, innerShadowOffset, innerShadowRadius, innerShadowOpacity;
+
+- (id) init {
+ self = [super init];
+ if (self) {
+ [self commonInit];
+ }
+ return self;
+}
+
+- (id) initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:aDecoder];
+ if (self) {
+ [self commonInit];
+ }
+ return self;
+}
+
+- (id) initWithLayer:(id)layer {
+ self = [super initWithLayer:layer];
+ if (self) {
+ [self commonInit];
+ if([layer isKindOfClass:[SKInnerShadowLayer class]]) {
+ SKInnerShadowLayer *other = (SKInnerShadowLayer*)layer;
+ self.innerShadowColor = other.innerShadowColor;
+ self.innerShadowOffset = other.innerShadowOffset;
+ self.innerShadowOpacity = other.innerShadowOpacity;
+ self.innerShadowRadius = other.innerShadowRadius;
+ }
+ }
+ return self;
+}
+
+- (void) commonInit {
+ //if contentsScale isn't 2.0 for retina screens, it will draw at 1.0 scale and look chunky and weird
+ self.contentsScale = [UIScreen mainScreen].scale;
+
+ self.innerShadowColor = [UIColor blackColor].CGColor;
+ self.innerShadowOffset = CGSizeMake(0, 3);
+ self.innerShadowRadius = 5.0f;
+ self.innerShadowOpacity = 0.0f;
+}
+
++ (BOOL)needsDisplayForKey:(NSString *)key {
+ if ([key isEqualToString:@"innerShadowColor"] || [key isEqualToString:@"innerShadowRadius"] || [key isEqualToString:@"innerShadowOpacity"] || [key isEqualToString:@"innerShadowOffset"]) {
+ return YES;
+ }
+ return [super needsDisplayForKey:key];
+}
+
+- (id)actionForKey:(NSString *) key {
+ if ([key isEqualToString:@"innerShadowColor"] || [key isEqualToString:@"innerShadowRadius"] || [key isEqualToString:@"innerShadowOpacity"] || [key isEqualToString:@"innerShadowOffset"]) {
+ CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:key];
+ theAnimation.fromValue = [self.presentationLayer valueForKey:key];
+ return theAnimation;
+ }
+ return [super actionForKey:key];
+}
+
+- (void)drawInContext:(CGContextRef)context {
+ CGContextSetAllowsAntialiasing(context, YES);
+ CGContextSetShouldAntialias(context, YES);
+ CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
+
+ CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
+
+ CGFloat radius = self.cornerRadius;
+
+ CGRect rect = self.bounds;
+ if (self.borderWidth != 0) {
+ rect = CGRectInset(rect, self.borderWidth, self.borderWidth);
+ radius -= self.borderWidth;
+ radius = MAX(radius, 0);
+ }
+
+ UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius];
+ CGContextAddPath(context, bezierPath.CGPath);
+ CGContextClip(context);
+
+ CGMutablePathRef outer = CGPathCreateMutable();
+ CGPathAddRect(outer, NULL, CGRectInset(rect, -1*rect.size.width, -1*rect.size.height));
+
+ CGPathAddPath(outer, NULL, bezierPath.CGPath);
+ CGPathCloseSubpath(outer);
+
+
+ CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.innerShadowColor);
+ CGFloat newComponents[4];
+
+ NSInteger numberOfComponents = CGColorGetNumberOfComponents(self.innerShadowColor);
+
+ switch (numberOfComponents)
+ {
+ case 2:
+ {
+ //grayscale
+ newComponents[0] = oldComponents[0];
+ newComponents[1] = oldComponents[0];
+ newComponents[2] = oldComponents[0];
+ newComponents[3] = oldComponents[1]*self.innerShadowOpacity;
+ break;
+ }
+ case 4:
+ {
+ //RGBA
+ newComponents[0] = oldComponents[0];
+ newComponents[1] = oldComponents[1];
+ newComponents[2] = oldComponents[2];
+ newComponents[3] = oldComponents[3]*self.innerShadowOpacity;
+ break;
+ }
+ }
+
+
+ CGColorRef innerShadowColorWithMultipliedAlpha = CGColorCreate(colorspace, newComponents);
+ CGColorSpaceRelease(colorspace);
+
+
+ CGContextSetFillColorWithColor(context, innerShadowColorWithMultipliedAlpha);
+ CGContextSetShadowWithColor(context, self.innerShadowOffset, self.innerShadowRadius, innerShadowColorWithMultipliedAlpha);
+
+ CGContextAddPath(context, outer);
+ CGContextEOFillPath(context);
+
+
+ CGPathRelease(outer);
+
+}
+
+@end
View
138 FTWButton/en.lproj/FTWViewController.xib
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12A269</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2835</string>
+ <string key="IBDocument.AppKitVersion">1187</string>
+ <string key="IBDocument.HIToolboxVersion">624.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">1919</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="843779117">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="774585933">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrame">{{0, 20}, {320, 548}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC43NQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
+ <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
+ <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <array key="dict.sortedKeys">
+ <integer value="1"/>
+ <integer value="3"/>
+ </array>
+ <array key="dict.values">
+ <string>{320, 568}</string>
+ <string>{568, 320}</string>
+ </array>
+ </object>
+ <string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
+ <string key="IBUIDisplayName">Retina 4 Full Screen</string>
+ <int key="IBUIType">2</int>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="774585933"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="843779117"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="774585933"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">FTWViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">7</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">FTWViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/FTWViewController.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <bool key="IBDocument.UseAutolayout">YES</bool>
+ <string key="IBCocoaTouchPluginVersion">1919</string>
+ </data>
+</archive>
View
2  FTWButton/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
View
18 FTWButton/main.m
@@ -0,0 +1,18 @@
+//
+// main.m
+// FTWButton
+//
+// Created by Soroush Khanlou on 10/12/12.
+// Copyright (c) 2012 FTW. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "FTWAppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([FTWAppDelegate class]));
+ }
+}
View
BIN  FTWButton/planet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  FTWButton/planet@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  FTWButton/weather.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  FTWButton/weather@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 LICENSE.md
@@ -0,0 +1,19 @@
+Copyright (c) 2012 FTW (http://ftw.co/)
+
+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.
View
109 README.md
@@ -1,4 +1,107 @@
-FTWButton
-=========
+# FTWButton
-FTWButton is a UIControl subclass that lets you easily set color, gradient, text, and icon properties for various states and animates between them.
+
+`FTWButton` is a `UIControl` subclass that lets you easily set color, gradient, text, shadow, border, and icon properties for various states and animates between them.
+
+## Usage
+
+Using `FTWButton` is similar to UIButton, but it's built from the ground-up. Instead of relying on background images, `FTWButton` draws itself.
+
+### Properties
+
+FTWButton has several properties, that can be set for each state:
+
+* Frame
+* Background Color
+* Background Gradient Colors
+* Corner Radius
+* Icon
+* Text
+* Text Color
+* Text Shadow Color
+* Text Shadow Offset
+* Border Color
+* Border Gradient Colors
+* Border Width
+* Shadow Color
+* Shadow Offset
+* Shadow Opacity
+* Shadow Blur Radius
+* Inner Shadow Color
+* Inner Shadow Offset
+* Inner Shadow Blur Radius
+
+They are all animatable and transition between states.
+
+
+### Example Code
+
+button1 = [[FTWButton alloc] init];
+
+button1.frame = CGRectMake(20, 20, 280, 40);
+[button1 setColors:[NSArray arrayWithObjects:
+ [UIColor colorWithRed:2.0f/255 green:184.0f/255 blue:255.0f/255 alpha:1.0f],
+ [UIColor colorWithRed:0.0f/255 green:68.0f/255 blue:255.0f/255 alpha:1.0f],
+ nil] forControlState:state];
+
+
+[button1 setInnerShadowColor:[UIColor colorWithRed:108.0f/255 green:221.0f/255 blue:253.0f/255 alpha:1.0f] forControlState:UIControlStateNormal];
+[button1 setInnerShadowOffset:CGSizeMake(0, 1) forControlState:UIControlStateNormal];
+
+[button1 setShadowColor:[UIColor blackColor] forControlState:UIControlStateNormal];
+[button1 setShadowOffset:CGSizeMake(0, 1) forControlState:UIControlStateNormal];
+[button1 setShadowOpacity:1.0f forControlState:UIControlStateNormal];
+
+[button1 setTextColor:[UIColor colorWithWhite:1.0f alpha:1.0f] forControlState:UIControlStateNormal];
+[button1 setTextShadowColor:[UIColor colorWithWhite:78.0f/255 alpha:1.0f] forControlState:UIControlStateNormal];
+[button1 setTextShadowOffset:CGSizeMake(0, -1) forControlState:UIControlStateNormal];
+
+[button1 setText:@"Tap me" forControlState:UIControlStateNormal];
+[button1 setText:@"Tapped!" forControlState:UIControlStateSelected];
+
+[button1 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+[self.view addSubview:button1];
+
+You can combine this code and other styles in any way you like.
+
+## Built-in Styles
+
+This code is a bit verbose, so we've included several default styles, with colors chosen our designer.
+
+These styles are:
+
+* A disabled style (gray gradient background, gray text
+* A delete style (red)
+* A gray style
+* A light blue style
+* A richer blue style
+* A yellow style
+* A black style
+
+Feel free to use the format to add your own. Please note that many of the styles add a highlighted state as well.
+
+With those styles, the code becomes much simpler:
+
+ button1 = [[FTWButton alloc] init];
+
+ button1.frame = CGRectMake(20, 20, 280, 40);
+ [button1 addBlueStyleForState:UIControlStateNormal];
+ [button1 addYellowStyleForState:UIControlStateSelected];
+
+ [button1 setText:@"Tap me" forControlState:UIControlStateNormal];
+ [button1 setText:@"Tapped!" forControlState:UIControlStateSelected];
+
+ [button1 addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button1];
+
+Setting `button1.selected` to `YES` will change the color to yellow, and fade the text from "Tap me" to "Tapped".
+
+## Your designer will thank you
+
+There are several things that Photoshop makes easy, such as inner shadows and border gradients, that are fairly difficult to do without images (and in some cases, even with images) in iOS. If you're building a dynamic button with text and colors, consider making it with FTWButton, so you can rapidly see what it would look like in the app itself.
+
+Also, consider a color framework such as [EDColor](https://github.com/thisandagain/color), which can make adding colors to FTWButton much easier.
+
+## Demo App
+
+The demo app contains several demos of `FTWButton`, including changing color on selection, border animations, gradient borders, fancy inner shadow, icons, and changing the frame on selection.
Please sign in to comment.
Something went wrong with that request. Please try again.