From eebe7271e12e28c29ca3d658cd02aa437e24d313 Mon Sep 17 00:00:00 2001 From: yoseph_wijaya Date: Sat, 15 Jul 2017 01:27:53 +0900 Subject: [PATCH] add setUpdate functionality without initialize --- .../ExampleYWProfile/ViewController.swift | 11 +++++++++++ Example/ExampleYWProfile/Podfile.lock | 4 ++-- .../YWNamePlaceholder.podspec.json | 4 ++-- Example/ExampleYWProfile/Pods/Manifest.lock | 4 ++-- .../YWNamePlaceholder/Info.plist | 2 +- README.md | 12 ++++++++++++ YWNamePlaceholder.podspec | 2 +- .../ClassResources/YWNamePlaceHolder.swift | 19 +++++++++++++++++++ YWNamePlaceholder/Info.plist | 2 +- 9 files changed, 51 insertions(+), 9 deletions(-) diff --git a/Example/ExampleYWProfile/ExampleYWProfile/ViewController.swift b/Example/ExampleYWProfile/ExampleYWProfile/ViewController.swift index 6d32371..b6ec67a 100644 --- a/Example/ExampleYWProfile/ExampleYWProfile/ViewController.swift +++ b/Example/ExampleYWProfile/ExampleYWProfile/ViewController.swift @@ -57,6 +57,17 @@ extension ViewController: UITableViewDelegate, UITableViewDataSource{ + }else if indexPath.row == 3{ + namePlaceHolder = YWNamePlaceHolder(originLocation: CGPoint(x: 0, y: 0), _withSize: 50, _yourPlaceholder: nameList[indexPath.row], _fontPlaceHolder: UIFont.boldSystemFont(ofSize: 14.0)) + cell!.accessoryView = namePlaceHolder + + namePlaceHolder!.setUpdateTextLength(_count: 1) + + }else if indexPath.row == 2 { + namePlaceHolder = YWNamePlaceHolder(originLocation: CGPoint(x: 0, y: 0), _withSize: 50, _yourPlaceholder: nameList[indexPath.row], _fontPlaceHolder: UIFont.boldSystemFont(ofSize: 14.0)) + cell!.accessoryView = namePlaceHolder + + namePlaceHolder!.setUpdate(_text: "Haha You", _textColor: UIColor.lightText, _contentColor: UIColor.blue, _staticFontSize: nil) }else{ namePlaceHolder = YWNamePlaceHolder(originLocation: CGPoint(x: 0, y: 0), _withSize: 50, _yourPlaceholder: nameList[indexPath.row], _fontPlaceHolder: UIFont.boldSystemFont(ofSize: 14.0)) cell!.accessoryView = namePlaceHolder diff --git a/Example/ExampleYWProfile/Podfile.lock b/Example/ExampleYWProfile/Podfile.lock index 9f1840f..9dd1079 100644 --- a/Example/ExampleYWProfile/Podfile.lock +++ b/Example/ExampleYWProfile/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - YWNamePlaceholder (1.2) + - YWNamePlaceholder (1.3) DEPENDENCIES: - YWNamePlaceholder (from `~/Documents/Github/YWNamePlaceholder`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "~/Documents/Github/YWNamePlaceholder" SPEC CHECKSUMS: - YWNamePlaceholder: d086df98e3e52d4af0219689d55b1ec2623881ad + YWNamePlaceholder: 33b20257792c3dbe920816c6d0f2e6f3b08f1ecc PODFILE CHECKSUM: '099e70268e8db467508e0ad7e23d13f4330e1e5d' diff --git a/Example/ExampleYWProfile/Pods/Local Podspecs/YWNamePlaceholder.podspec.json b/Example/ExampleYWProfile/Pods/Local Podspecs/YWNamePlaceholder.podspec.json index f69a439..6bfc479 100644 --- a/Example/ExampleYWProfile/Pods/Local Podspecs/YWNamePlaceholder.podspec.json +++ b/Example/ExampleYWProfile/Pods/Local Podspecs/YWNamePlaceholder.podspec.json @@ -1,6 +1,6 @@ { "name": "YWNamePlaceholder", - "version": "1.2", + "version": "1.3", "summary": "YWNamePlaceholder Generic Place holder profile", "description": "Place holder of every empty profile picture. Lightweight circular profile initial for placeholder before adding images", "requires_arc": true, @@ -17,7 +17,7 @@ }, "source": { "git": "https://github.com/nsnull0/YWNamePlaceholder.git", - "tag": "1.2" + "tag": "1.3" }, "source_files": "YWNamePlaceholder/**/*.{swift}", "frameworks": "UIKit" diff --git a/Example/ExampleYWProfile/Pods/Manifest.lock b/Example/ExampleYWProfile/Pods/Manifest.lock index 9f1840f..9dd1079 100644 --- a/Example/ExampleYWProfile/Pods/Manifest.lock +++ b/Example/ExampleYWProfile/Pods/Manifest.lock @@ -1,5 +1,5 @@ PODS: - - YWNamePlaceholder (1.2) + - YWNamePlaceholder (1.3) DEPENDENCIES: - YWNamePlaceholder (from `~/Documents/Github/YWNamePlaceholder`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "~/Documents/Github/YWNamePlaceholder" SPEC CHECKSUMS: - YWNamePlaceholder: d086df98e3e52d4af0219689d55b1ec2623881ad + YWNamePlaceholder: 33b20257792c3dbe920816c6d0f2e6f3b08f1ecc PODFILE CHECKSUM: '099e70268e8db467508e0ad7e23d13f4330e1e5d' diff --git a/Example/ExampleYWProfile/Pods/Target Support Files/YWNamePlaceholder/Info.plist b/Example/ExampleYWProfile/Pods/Target Support Files/YWNamePlaceholder/Info.plist index 2a9158a..b6b2813 100644 --- a/Example/ExampleYWProfile/Pods/Target Support Files/YWNamePlaceholder/Info.plist +++ b/Example/ExampleYWProfile/Pods/Target Support Files/YWNamePlaceholder/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.2.0 + 1.3.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index bee0e76..0bf37a8 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,18 @@ to list font that used in the device */ func debugListFontDevice() -> Array +/* +change text and color to corresponding placeholder which is already initialize +size param is optional +*/ +func setUpdate(str, color, contentColor) +func setUpdate(str, color, contentColor, size) + +/* +change your placeholder text with your preferred length of characters which is already initialize +*/ +setUpdateTextLength(count) + ``` see Example project for more detail in initialization diff --git a/YWNamePlaceholder.podspec b/YWNamePlaceholder.podspec index f43e076..1aea88b 100644 --- a/YWNamePlaceholder.podspec +++ b/YWNamePlaceholder.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "YWNamePlaceholder" - s.version = "1.2" + s.version = "1.3" s.summary = "YWNamePlaceholder Generic Place holder profile" s.description = "Place holder of every empty profile picture. Lightweight circular profile initial for placeholder before adding images" s.requires_arc = true diff --git a/YWNamePlaceholder/ClassResources/YWNamePlaceHolder.swift b/YWNamePlaceholder/ClassResources/YWNamePlaceHolder.swift index de16a53..4986704 100644 --- a/YWNamePlaceholder/ClassResources/YWNamePlaceHolder.swift +++ b/YWNamePlaceholder/ClassResources/YWNamePlaceHolder.swift @@ -77,6 +77,25 @@ public class YWNamePlaceHolder: UIView { return resultFamily } + public func setUpdate(_text str:String, _textColor color:UIColor, _contentColor color2:UIColor){ + textTitle.asTextTitle = str + setColor(_textColor: color, _contentColor: color2) + } + + public func setUpdate(_text str:String, _textColor color:UIColor, _contentColor color2:UIColor, _staticFontSize size:CGFloat?){ + textTitle.asTextTitle = str + setColor(_textColor: color, _contentColor: color2) + + guard size != nil else { + return + } + setFontSize(_staticFontSize: size!) + } + + public func setUpdateTextLength(_count length:Int){ + textTitle.setTextCountConstraint(count: length) + } + public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) diff --git a/YWNamePlaceholder/Info.plist b/YWNamePlaceholder/Info.plist index 37c17ea..e3dd2b3 100644 --- a/YWNamePlaceholder/Info.plist +++ b/YWNamePlaceholder/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.2 + 1.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass