Commit bd7f50c5 by Daniel Dahan

added CardView with support for any view in the detailView area

parent e1e1abc3
...@@ -90,6 +90,9 @@ ...@@ -90,6 +90,9 @@
<FileRef <FileRef
location = "group:Programmatic/CardView/CardView.xcodeproj"> location = "group:Programmatic/CardView/CardView.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Programmatic/TableCardView/TableCardView.xcodeproj">
</FileRef>
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
......
...@@ -39,10 +39,10 @@ class ViewController: UIViewController { ...@@ -39,10 +39,10 @@ class ViewController: UIViewController {
// Examples of using CardView. // Examples of using CardView.
// Uncomment different examples and read // Uncomment different examples and read
// the comments below. // the comments below.
// prepareGeneralCardViewExample() prepareGeneralCardViewExample()
// prepareCardViewWithoutPulseBackgroundImageExample() // prepareCardViewWithoutPulseBackgroundImageExample()
// prepareCardViewWithPulseBackgroundImageExample() // prepareCardViewWithPulseBackgroundImageExample()
prepareCardViewButtonBarExample() // prepareCardViewButtonBarExample()
} }
/** /**
...@@ -71,7 +71,7 @@ class ViewController: UIViewController { ...@@ -71,7 +71,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
cardView.detailLabel = detailLabel cardView.detailView = detailLabel
// Yes button. // Yes button.
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
...@@ -124,7 +124,7 @@ class ViewController: UIViewController { ...@@ -124,7 +124,7 @@ class ViewController: UIViewController {
detailLabel.text = "Beautiful Material Design" detailLabel.text = "Beautiful Material Design"
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
cardView.detailLabel = detailLabel cardView.detailView = detailLabel
// Favorite button. // Favorite button.
let img1: UIImage? = UIImage(named: "ic_favorite_white") let img1: UIImage? = UIImage(named: "ic_favorite_white")
...@@ -169,7 +169,7 @@ class ViewController: UIViewController { ...@@ -169,7 +169,7 @@ class ViewController: UIViewController {
detailLabel.text = "Data-Driven Framework" detailLabel.text = "Data-Driven Framework"
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
cardView.detailLabel = detailLabel cardView.detailView = detailLabel
// Favorite button. // Favorite button.
let img1: UIImage? = UIImage(named: "ic_favorite_white") let img1: UIImage? = UIImage(named: "ic_favorite_white")
......
...@@ -486,10 +486,10 @@ class ViewController: UIViewController { ...@@ -486,10 +486,10 @@ class ViewController: UIViewController {
alarmButton.grid.columns = 2 alarmButton.grid.columns = 2
alarmButton.grid.offset.columns = 10 alarmButton.grid.offset.columns = 10
contentView.grid.spacing = 8
contentView.grid.axis.inherited = false contentView.grid.axis.inherited = false
contentView.grid.axis.direction = .None contentView.grid.axis.direction = .None
contentView.grid.contentInsetPreset = .Square3 contentView.grid.contentInsetPreset = .Square3
contentView.grid.spacing = 8
contentView.grid.views = [ contentView.grid.views = [
titleLabel, titleLabel,
moreButton, moreButton,
......
...@@ -74,7 +74,7 @@ class ViewController: UIViewController { ...@@ -74,7 +74,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
imageCardView.detailLabel = detailLabel imageCardView.detailView = detailLabel
// Yes button. // Yes button.
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
......
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
96A71E6C1C6FA6D500C0C4AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71E6B1C6FA6D500C0C4AE /* AppDelegate.swift */; };
96A71E6E1C6FA6D500C0C4AE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71E6D1C6FA6D500C0C4AE /* ViewController.swift */; };
96A71E731C6FA6D500C0C4AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A71E721C6FA6D500C0C4AE /* Assets.xcassets */; };
96A71E761C6FA6D500C0C4AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96A71E741C6FA6D500C0C4AE /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
96A71E801C6FA80A00C0C4AE /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
96A71E681C6FA6D500C0C4AE /* TableCardView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableCardView.app; sourceTree = BUILT_PRODUCTS_DIR; };
96A71E6B1C6FA6D500C0C4AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96A71E6D1C6FA6D500C0C4AE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
96A71E721C6FA6D500C0C4AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96A71E751C6FA6D500C0C4AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96A71E771C6FA6D500C0C4AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
96A71E651C6FA6D500C0C4AE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
96A71E5F1C6FA6D500C0C4AE = {
isa = PBXGroup;
children = (
96A71E6A1C6FA6D500C0C4AE /* TableCardView */,
96A71E691C6FA6D500C0C4AE /* Products */,
);
sourceTree = "<group>";
};
96A71E691C6FA6D500C0C4AE /* Products */ = {
isa = PBXGroup;
children = (
96A71E681C6FA6D500C0C4AE /* TableCardView.app */,
);
name = Products;
sourceTree = "<group>";
};
96A71E6A1C6FA6D500C0C4AE /* TableCardView */ = {
isa = PBXGroup;
children = (
96A71E6B1C6FA6D500C0C4AE /* AppDelegate.swift */,
96A71E6D1C6FA6D500C0C4AE /* ViewController.swift */,
96A71E721C6FA6D500C0C4AE /* Assets.xcassets */,
96A71E741C6FA6D500C0C4AE /* LaunchScreen.storyboard */,
96A71E771C6FA6D500C0C4AE /* Info.plist */,
);
path = TableCardView;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
96A71E671C6FA6D500C0C4AE /* TableCardView */ = {
isa = PBXNativeTarget;
buildConfigurationList = 96A71E7A1C6FA6D500C0C4AE /* Build configuration list for PBXNativeTarget "TableCardView" */;
buildPhases = (
96A71E641C6FA6D500C0C4AE /* Sources */,
96A71E651C6FA6D500C0C4AE /* Frameworks */,
96A71E661C6FA6D500C0C4AE /* Resources */,
96A71E801C6FA80A00C0C4AE /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = TableCardView;
productName = TableCardView;
productReference = 96A71E681C6FA6D500C0C4AE /* TableCardView.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
96A71E601C6FA6D500C0C4AE /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "CosmicMind, Inc.";
TargetAttributes = {
96A71E671C6FA6D500C0C4AE = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = 96A71E631C6FA6D500C0C4AE /* Build configuration list for PBXProject "TableCardView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 96A71E5F1C6FA6D500C0C4AE;
productRefGroup = 96A71E691C6FA6D500C0C4AE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
96A71E671C6FA6D500C0C4AE /* TableCardView */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
96A71E661C6FA6D500C0C4AE /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96A71E761C6FA6D500C0C4AE /* LaunchScreen.storyboard in Resources */,
96A71E731C6FA6D500C0C4AE /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
96A71E641C6FA6D500C0C4AE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96A71E6E1C6FA6D500C0C4AE /* ViewController.swift in Sources */,
96A71E6C1C6FA6D500C0C4AE /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
96A71E741C6FA6D500C0C4AE /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
96A71E751C6FA6D500C0C4AE /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
96A71E781C6FA6D500C0C4AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
96A71E791C6FA6D500C0C4AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
96A71E7B1C6FA6D500C0C4AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TableCardView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TableCardView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
96A71E7C1C6FA6D500C0C4AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TableCardView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TableCardView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
96A71E631C6FA6D500C0C4AE /* Build configuration list for PBXProject "TableCardView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
96A71E781C6FA6D500C0C4AE /* Debug */,
96A71E791C6FA6D500C0C4AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
96A71E7A1C6FA6D500C0C4AE /* Build configuration list for PBXNativeTarget "TableCardView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
96A71E7B1C6FA6D500C0C4AE /* Debug */,
96A71E7C1C6FA6D500C0C4AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 96A71E601C6FA6D500C0C4AE /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TableCardView.xcodeproj">
</FileRef>
</Workspace>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = ViewController()
window!.makeKeyAndVisible()
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Material-Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Material-Icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Material-Icon-40@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Material-Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Material-Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Material-Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Material-Icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Material-Icon-29@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Material-Icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Material-Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Material-Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Material-Icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Material-Icon-83.5@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "GraphKit.png", "filename" : "Profile1.jpg",
"scale" : "1x" "scale" : "1x"
}, },
{ {
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile2.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile3.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile4.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile5.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile6.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile7.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile8.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile9.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_settings.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_settings_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_settings_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?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>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</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</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of GraphKit nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
The following is an example of setting a UITableView as the detailView for a
CardView.
*/
import UIKit
import Material
private struct Item {
var text: String
var detail: String
var image: UIImage?
}
class ViewController: UIViewController {
/// A tableView used to display Bond entries.
private let tableView: UITableView = UITableView()
/// A list of all the Author Bond types.
private var items: Array<Item> = Array<Item>()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareItems()
prepareTableView()
prepareCardView()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the items Array.
private func prepareItems() {
items.append(Item(text: "Summer BBQ", detail: "Wish I could come, but I am out of town this weekend.", image: UIImage(named: "Profile1")))
items.append(Item(text: "Birthday gift", detail: "Have any ideas about what we should get Heidi for her birthday?", image: UIImage(named: "Profile2")))
items.append(Item(text: "Brunch this weekend?", detail: "I'll be in your neighborhood doing errands this weekend.", image: UIImage(named: "Profile3")))
items.append(Item(text: "Giants game", detail: "Are we on this weekend for the game?", image: UIImage(named: "Profile4")))
items.append(Item(text: "Recipe to try", detail: "We should eat this: Squash, Corn and tomatillo Tacos.", image: UIImage(named: "Profile5")))
items.append(Item(text: "Interview", detail: "The candidate will be arriving at 11:30, are you free?", image: UIImage(named: "Profile6")))
items.append(Item(text: "Book recommendation", detail: "I found the book title, Surely You’re Joking, Mr. Feynman!", image: UIImage(named: "Profile7")))
items.append(Item(text: "Oui oui", detail: "Do you have Paris recommendations? Have you ever been?", image: UIImage(named: "Profile8")))
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.dataSource = self
tableView.delegate = self
}
/// Prepares the CardView.
func prepareCardView() {
let cardView: CardView = CardView()
cardView.pulseColor = nil
let titleLabel: UILabel = UILabel()
titleLabel.text = "Messages"
titleLabel.textAlignment = .Center
titleLabel.font = RobotoFont.mediumWithSize(24)
let v: UIView = UIView()
v.backgroundColor = MaterialColor.blue.accent1
let closeButton: FlatButton = FlatButton()
closeButton.setTitle("Close", forState: .Normal)
let image: UIImage? = UIImage(named: "ic_settings")?.imageWithRenderingMode(.AlwaysTemplate)
let settingButton: FlatButton = FlatButton()
settingButton.tintColor = MaterialColor.blue.accent3
settingButton.setImage(image, forState: .Normal)
settingButton.setImage(image, forState: .Highlighted)
// Use MaterialLayout to easily align the tableView.
cardView.titleLabel = titleLabel
cardView.detailView = tableView
cardView.detailViewInsetPreset = .None
cardView.dividerInset.top = 0
cardView.leftButtons = [closeButton]
cardView.rightButtons = [settingButton]
cardView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(cardView)
MaterialLayout.alignToParent(view, child: cardView, left: 10, right: 10, top: 100, bottom: 100)
}
}
/// TableViewDataSource methods.
extension ViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
}
/// Returns the number of sections.
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell = UITableViewCell(style: .Subtitle, reuseIdentifier: "Cell")
let item: Item = items[indexPath.row]
cell.selectionStyle = .None
cell.textLabel!.text = item.text
cell.textLabel!.font = RobotoFont.regular
cell.detailTextLabel!.text = item.detail
cell.detailTextLabel!.font = RobotoFont.regular
cell.detailTextLabel!.textColor = MaterialColor.grey.darken1
cell.imageView!.image = item.image?.resize(toWidth: 40)
cell.imageView!.layer.cornerRadius = 20
return cell
}
}
/// UITableViewDelegate methods.
extension ViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 80
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "Graph.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -68,7 +68,7 @@ class ViewController: UIViewController { ...@@ -68,7 +68,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?" detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
cardView.detailLabel = detailLabel cardView.detailView = detailLabel
// Yes button. // Yes button.
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
...@@ -95,16 +95,16 @@ class ViewController: UIViewController { ...@@ -95,16 +95,16 @@ class ViewController: UIViewController {
func prepareCardViewExampleTwo() { func prepareCardViewExampleTwo() {
secondCardView.dividerInset.left = 100 secondCardView.dividerInset.left = 100
secondCardView.titleLabelInset.left = 100 secondCardView.titleLabelInset.left = 100
secondCardView.detailLabelInset.left = 100 secondCardView.detailViewInset.left = 100
secondCardView.pulseColor = MaterialColor.teal.lighten4 secondCardView.pulseColor = MaterialColor.teal.lighten4
// Image. // Image.
secondCardView.image = UIImage(named: "GraphKit")?.resize(toHeight: 100) secondCardView.image = UIImage(named: "Graph")?.resize(toHeight: 100)
secondCardView.contentsGravity = .TopLeft secondCardView.contentsGravity = .TopLeft
// Title label. // Title label.
let titleLabel: UILabel = UILabel() let titleLabel: UILabel = UILabel()
titleLabel.text = "GraphKit" titleLabel.text = "Graph"
titleLabel.font = RobotoFont.mediumWithSize(24) titleLabel.font = RobotoFont.mediumWithSize(24)
secondCardView.titleLabel = titleLabel secondCardView.titleLabel = titleLabel
...@@ -112,14 +112,14 @@ class ViewController: UIViewController { ...@@ -112,14 +112,14 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build scalable data-driven apps." detailLabel.text = "Build scalable data-driven apps."
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
secondCardView.detailLabel = detailLabel secondCardView.detailView = detailLabel
// LEARN MORE button. // LEARN MORE button.
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
btn1.pulseColor = MaterialColor.teal.lighten1 btn1.pulseColor = MaterialColor.blue.lighten1
btn1.pulseScale = false btn1.pulseScale = false
btn1.setTitle("LEARN MORE", forState: .Normal) btn1.setTitle("LEARN MORE", forState: .Normal)
btn1.setTitleColor(MaterialColor.teal.darken1, forState: .Normal) btn1.setTitleColor(MaterialColor.blue.darken1, forState: .Normal)
// Add buttons to right side. // Add buttons to right side.
secondCardView.rightButtons = [btn1] secondCardView.rightButtons = [btn1]
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.31.6' s.version = '1.32.0'
s.license = 'BSD' s.license = 'BSD'
s.summary = 'Material is an animation and graphics framework in Swift.' s.summary = 'Material is an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
s.social_media_url = 'https://www.facebook.com/graphkit' s.social_media_url = 'https://www.facebook.com/graphkit'
s.authors = { 'CosmicMind, Inc.' => 'support@cosmicmind.io' } s.authors = { 'CosmicMind, Inc.' => 'support@cosmicmind.io' }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Welcome to Material # Welcome to Material
Material is an animation and graphics framework. It may be used for Google's Material Design and Apple's Flat UI. Material allows the creativity of others to easily be expressed. Material is an animation and graphics framework for Google's Material Design and Apple's Flat UI in Swift. Material allows the creativity of others to easily be expressed.
## Features ## Features
...@@ -227,16 +227,20 @@ Right out of the box to a fully customizable configuration, CardView always stan ...@@ -227,16 +227,20 @@ Right out of the box to a fully customizable configuration, CardView always stan
![MaterialCardView](http://www.cosmicmind.io/MK/MaterialCardView.gif) ![MaterialCardView](http://www.cosmicmind.io/MK/MaterialCardView.gif)
[Learn More About CardView](https://github.com/CosmicMind/Material/wiki/CardView)
Easily remove the pulse animation and add a background image for an entirely new feel. Easily remove the pulse animation and add a background image for an entirely new feel.
![MaterialCardViewFavorite](http://www.cosmicmind.io/MK/MaterialCardViewFavorite.gif) ![MaterialCardViewFavorite](http://www.cosmicmind.io/MK/MaterialCardViewFavorite.gif)
Add any view as the detail to a CardView. For example, a UITableView.
![MaterialTableCardView](http://www.cosmicmind.io/MK/MaterialTableCardView.gif)
CardViews are so flexible they create entirely new components by removing all but certain elements. For example, bellow is a button bar by only setting the button values of the CardView. CardViews are so flexible they create entirely new components by removing all but certain elements. For example, bellow is a button bar by only setting the button values of the CardView.
![MaterialCardViewButtonBar](http://www.cosmicmind.io/MK/MaterialCardViewButtonBar.gif) ![MaterialCardViewButtonBar](http://www.cosmicmind.io/MK/MaterialCardViewButtonBar.gif)
[Learn More About CardView](https://github.com/CosmicMind/Material/wiki/CardView)
<a name="imagecardview"></a> <a name="imagecardview"></a>
## ImageCardView ## ImageCardView
......
...@@ -119,29 +119,29 @@ public class CardView : MaterialPulseView { ...@@ -119,29 +119,29 @@ public class CardView : MaterialPulseView {
} }
/** /**
:name: detailLabelInsets :name: detailViewInsets
*/ */
public var detailLabelInsetPreset: MaterialEdgeInsetPreset = .None { public var detailViewInsetPreset: MaterialEdgeInsetPreset = .None {
didSet { didSet {
detailLabelInset = MaterialEdgeInsetPresetToValue(detailLabelInsetPreset) detailViewInset = MaterialEdgeInsetPresetToValue(detailViewInsetPreset)
} }
} }
/** /**
:name: detailLabelInset :name: detailViewInset
*/ */
public var detailLabelInset: UIEdgeInsets = MaterialEdgeInsetPresetToValue(.Square2) { public var detailViewInset: UIEdgeInsets = MaterialEdgeInsetPresetToValue(.Square2) {
didSet { didSet {
reloadView() reloadView()
} }
} }
/** /**
:name: detailLabel :name: detailView
*/ */
public var detailLabel: UILabel? { public var detailView: UIView? {
didSet { didSet {
detailLabel?.translatesAutoresizingMaskIntoConstraints = false detailView?.translatesAutoresizingMaskIntoConstraints = false
reloadView() reloadView()
} }
} }
...@@ -234,9 +234,9 @@ public class CardView : MaterialPulseView { ...@@ -234,9 +234,9 @@ public class CardView : MaterialPulseView {
/** /**
:name: init :name: init
*/ */
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailLabel: UILabel? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) { public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
prepareProperties(image, titleLabel: titleLabel, detailLabel: detailLabel, leftButtons: leftButtons, rightButtons: rightButtons) prepareProperties(image, titleLabel: titleLabel, detailView: detailView, leftButtons: leftButtons, rightButtons: rightButtons)
} }
/** /**
...@@ -279,13 +279,13 @@ public class CardView : MaterialPulseView { ...@@ -279,13 +279,13 @@ public class CardView : MaterialPulseView {
if nil != titleLabel { if nil != titleLabel {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + titleLabelInset.top metrics["insetTop"] = contentInset.top + titleLabelInset.top
} else if nil != detailLabel { } else if nil != detailView {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + detailLabelInset.top metrics["insetTop"] = contentInset.top + detailViewInset.top
} }
// title // title
if let v = titleLabel { if let v: UILabel = titleLabel {
addSubview(v) addSubview(v)
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
...@@ -295,24 +295,24 @@ public class CardView : MaterialPulseView { ...@@ -295,24 +295,24 @@ public class CardView : MaterialPulseView {
} }
// detail // detail
if let v = detailLabel { if let v: UIView = detailView {
addSubview(v) addSubview(v)
if nil == titleLabel { if nil == titleLabel {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailLabelInset.top metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailViewInset.top
} else { } else {
verticalFormat += "-(insetB)" verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInset.bottom + detailLabelInset.top metrics["insetB"] = titleLabelInset.bottom + detailViewInset.top
} }
verticalFormat += "-[detailLabel]" verticalFormat += "-[detailView]"
views["detailLabel"] = v views["detailView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailLabelInset.left, right: contentInset.right + detailLabelInset.right) MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailViewInset.left, right: contentInset.right + detailViewInset.right)
} }
// leftButtons // leftButtons
if let v = leftButtons { if let v: Array<UIButton> = leftButtons {
if 0 < v.count { if 0 < v.count {
var h: String = "H:|" var h: String = "H:|"
var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
...@@ -339,7 +339,7 @@ public class CardView : MaterialPulseView { ...@@ -339,7 +339,7 @@ public class CardView : MaterialPulseView {
} }
// rightButtons // rightButtons
if let v = rightButtons { if let v: Array<UIButton> = rightButtons {
if 0 < v.count { if 0 < v.count {
var h: String = "H:" var h: String = "H:"
var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
...@@ -378,11 +378,11 @@ public class CardView : MaterialPulseView { ...@@ -378,11 +378,11 @@ public class CardView : MaterialPulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
} }
if nil != detailLabel { if nil != detailView {
if nil == metrics["insetC"] { if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else { } else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} }
} else if nil != titleLabel { } else if nil != titleLabel {
if nil == metrics["insetC"] { if nil == metrics["insetC"] {
...@@ -394,7 +394,6 @@ public class CardView : MaterialPulseView { ...@@ -394,7 +394,6 @@ public class CardView : MaterialPulseView {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInset.top + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInset.top + (divider ? dividerInset.top + dividerInset.bottom : 0)
} }
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views))
...@@ -427,10 +426,10 @@ public class CardView : MaterialPulseView { ...@@ -427,10 +426,10 @@ public class CardView : MaterialPulseView {
/** /**
:name: prepareProperties :name: prepareProperties
*/ */
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) { internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
self.image = image self.image = image
self.titleLabel = titleLabel self.titleLabel = titleLabel
self.detailLabel = detailLabel self.detailView = detailView
self.leftButtons = leftButtons self.leftButtons = leftButtons
self.rightButtons = rightButtons self.rightButtons = rightButtons
} }
......
...@@ -209,29 +209,29 @@ public class ImageCardView : MaterialPulseView { ...@@ -209,29 +209,29 @@ public class ImageCardView : MaterialPulseView {
} }
/** /**
:name: detailLabelInsets :name: detailViewInsets
*/ */
public var detailLabelInsetPreset: MaterialEdgeInsetPreset = .None { public var detailViewInsetPreset: MaterialEdgeInsetPreset = .None {
didSet { didSet {
detailLabelInset = MaterialEdgeInsetPresetToValue(detailLabelInsetPreset) detailViewInset = MaterialEdgeInsetPresetToValue(detailViewInsetPreset)
} }
} }
/** /**
:name: detailLabelInset :name: detailViewInset
*/ */
public var detailLabelInset: UIEdgeInsets = MaterialEdgeInsetPresetToValue(.Square2) { public var detailViewInset: UIEdgeInsets = MaterialEdgeInsetPresetToValue(.Square2) {
didSet { didSet {
reloadView() reloadView()
} }
} }
/** /**
:name: detailLabel :name: detailView
*/ */
public var detailLabel: UILabel? { public var detailView: UIView? {
didSet { didSet {
detailLabel?.translatesAutoresizingMaskIntoConstraints = false detailView?.translatesAutoresizingMaskIntoConstraints = false
reloadView() reloadView()
} }
} }
...@@ -324,9 +324,9 @@ public class ImageCardView : MaterialPulseView { ...@@ -324,9 +324,9 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: init :name: init
*/ */
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailLabel: UILabel? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) { public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
prepareProperties(image, titleLabel: titleLabel, detailLabel: detailLabel, leftButtons: leftButtons, rightButtons: rightButtons) prepareProperties(image, titleLabel: titleLabel, detailView: detailView, leftButtons: leftButtons, rightButtons: rightButtons)
} }
/** /**
...@@ -376,13 +376,13 @@ public class ImageCardView : MaterialPulseView { ...@@ -376,13 +376,13 @@ public class ImageCardView : MaterialPulseView {
} else if nil != titleLabel { } else if nil != titleLabel {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + titleLabelInset.top metrics["insetTop"] = contentInset.top + titleLabelInset.top
} else if nil != detailLabel { } else if nil != detailView {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + detailLabelInset.top metrics["insetTop"] = contentInset.top + detailViewInset.top
} }
// title // title
if let v = titleLabel { if let v: UILabel = titleLabel {
addSubview(v) addSubview(v)
if nil == imageLayer?.contents { if nil == imageLayer?.contents {
...@@ -395,24 +395,24 @@ public class ImageCardView : MaterialPulseView { ...@@ -395,24 +395,24 @@ public class ImageCardView : MaterialPulseView {
} }
// detail // detail
if let v = detailLabel { if let v: UIView = detailView {
addSubview(v) addSubview(v)
if nil == imageLayer?.contents && nil != titleLabel { if nil == imageLayer?.contents && nil != titleLabel {
verticalFormat += "-(insetB)" verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInset.bottom + detailLabelInset.top metrics["insetB"] = titleLabelInset.bottom + detailViewInset.top
} else { } else {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailLabelInset.top metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailViewInset.top
} }
verticalFormat += "-[detailLabel]" verticalFormat += "-[detailView]"
views["detailLabel"] = v views["detailView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailLabelInset.left, right: contentInset.right + detailLabelInset.right) MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailViewInset.left, right: contentInset.right + detailViewInset.right)
} }
// leftButtons // leftButtons
if let v = leftButtons { if let v: Array<UIButton> = leftButtons {
if 0 < v.count { if 0 < v.count {
var h: String = "H:|" var h: String = "H:|"
var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
...@@ -439,7 +439,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -439,7 +439,7 @@ public class ImageCardView : MaterialPulseView {
} }
// rightButtons // rightButtons
if let v = rightButtons { if let v: Array<UIButton> = rightButtons {
if 0 < v.count { if 0 < v.count {
var h: String = "H:" var h: String = "H:"
var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var d: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
...@@ -479,11 +479,11 @@ public class ImageCardView : MaterialPulseView { ...@@ -479,11 +479,11 @@ public class ImageCardView : MaterialPulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
} }
if nil != detailLabel { if nil != detailView {
if nil == metrics["insetC"] { if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else { } else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} }
} else if nil != titleLabel { } else if nil != titleLabel {
if nil == metrics["insetC"] { if nil == metrics["insetC"] {
...@@ -494,7 +494,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -494,7 +494,7 @@ public class ImageCardView : MaterialPulseView {
} else if nil != metrics["insetC"] { } else if nil != metrics["insetC"] {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInset.top + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInset.top + (divider ? dividerInset.top + dividerInset.bottom : 0)
} }
} else if nil != detailLabel { } else if nil != detailView {
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
verticalFormat += "-(insetC)-[button]" verticalFormat += "-(insetC)-[button]"
views["button"] = leftButtons![0] views["button"] = leftButtons![0]
...@@ -508,9 +508,9 @@ public class ImageCardView : MaterialPulseView { ...@@ -508,9 +508,9 @@ public class ImageCardView : MaterialPulseView {
} }
if nil == metrics["insetC"] { if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else { } else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} }
} else { } else {
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
...@@ -576,10 +576,10 @@ public class ImageCardView : MaterialPulseView { ...@@ -576,10 +576,10 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: prepareProperties :name: prepareProperties
*/ */
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) { internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
self.image = image self.image = image
self.titleLabel = titleLabel self.titleLabel = titleLabel
self.detailLabel = detailLabel self.detailView = detailView
self.leftButtons = leftButtons self.leftButtons = leftButtons
self.rightButtons = rightButtons self.rightButtons = rightButtons
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.31.6</string> <string>1.32.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
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