Skip to content

Commit

Permalink
add setUpdate functionality without initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
nsnull0 committed Jul 14, 2017
1 parent 6b6142b commit eebe727
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 9 deletions.
11 changes: 11 additions & 0 deletions Example/ExampleYWProfile/ExampleYWProfile/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Example/ExampleYWProfile/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- YWNamePlaceholder (1.2)
- YWNamePlaceholder (1.3)

DEPENDENCIES:
- YWNamePlaceholder (from `~/Documents/Github/YWNamePlaceholder`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "~/Documents/Github/YWNamePlaceholder"

SPEC CHECKSUMS:
YWNamePlaceholder: d086df98e3e52d4af0219689d55b1ec2623881ad
YWNamePlaceholder: 33b20257792c3dbe920816c6d0f2e6f3b08f1ecc

PODFILE CHECKSUM: '099e70268e8db467508e0ad7e23d13f4330e1e5d'

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/ExampleYWProfile/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ to list font that used in the device
*/
func debugListFontDevice() -> Array<String>

/*
change text and color to corresponding placeholder which is already initialize
size param is optional
*/
func setUpdate(str<String>, color<UIColor>, contentColor<UIColor>)
func setUpdate(str<String>, color<UIColor>, contentColor<UIColor>, size<CGFloat?>)

/*
change your placeholder text with your preferred length of characters which is already initialize
*/
setUpdateTextLength(count<Int>)

```

see Example project for more detail in initialization
Expand Down
2 changes: 1 addition & 1 deletion YWNamePlaceholder.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 19 additions & 0 deletions YWNamePlaceholder/ClassResources/YWNamePlaceHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion YWNamePlaceholder/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.3</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit eebe727

Please sign in to comment.