Skip to content

Commit 3bc15c6

Browse files
committed
Remove the customized fonts and colors from the token field
1 parent f785911 commit 3bc15c6

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

Example/Example/ExampleViewController.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,10 @@ class ExampleViewController: UIViewController, UITableViewDataSource {
8787
(cell as? ExampleCell)?.showcase = textField
8888

8989
case let type as ICTokenField.Type:
90+
let container = UIView(frame: cell.bounds)
9091
let tokenField = type.init()
9192
tokenField.placeholder = String(type)
92-
93-
let container = UIView(frame: cell.bounds)
94-
container.backgroundColor = UIColor(red:0.96, green:0.48, blue:0.4, alpha:1)
95-
96-
tokenField.frame = container.bounds.insetBy(dx: 15, dy: 3)
93+
tokenField.frame = container.bounds.insetBy(dx: 5, dy: 0)
9794
tokenField.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
9895
container.addSubview(tokenField)
9996
(cell as? ExampleCell)?.showcase = container

Source/ICToken.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ class ICToken: UIView {
4242
}
4343

4444
var normalTextAttributes: [String : NSObject] = [
45-
NSForegroundColorAttributeName: UIColor.whiteColor(),
46-
NSBackgroundColorAttributeName: UIColor.whiteColor().colorWithAlphaComponent(0.25)
45+
NSForegroundColorAttributeName: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1),
46+
NSBackgroundColorAttributeName: UIColor.clearColor()
4747
]
4848

4949
var highlightedTextAttributes: [String: NSObject] = [
50-
NSForegroundColorAttributeName: UIColor(red:0.8, green:0.32, blue:0.24, alpha:1),
51-
NSBackgroundColorAttributeName: UIColor.whiteColor()
50+
NSForegroundColorAttributeName: UIColor.whiteColor(),
51+
NSBackgroundColorAttributeName: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1)
5252
]
5353

5454
// MARK: - Private Properties
5555

5656
private(set) lazy var delimiterLabel: UILabel = {
5757
let _delimiter = UILabel()
5858
_delimiter.text = " , "
59-
_delimiter.textColor = UIColor.whiteColor()
59+
_delimiter.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor
6060
return _delimiter
6161
}()
6262

Source/ICTokenField.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
7676
if let text = newValue {
7777
attributedPlaceholder = NSAttributedString(
7878
string: text,
79-
attributes: [NSForegroundColorAttributeName: UIColor.whiteColor().colorWithAlphaComponent(0.5)]
79+
attributes: [NSForegroundColorAttributeName: UIColor(red: 0.78, green: 0.78, blue: 0.80, alpha: 0.9)]
8080
)
8181
} else {
8282
attributedPlaceholder = nil
@@ -110,8 +110,6 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
110110
private lazy var inputTextField: ICBackspaceTextField = {
111111
let _textField = ICBackspaceTextField()
112112
_textField.backgroundColor = UIColor.clearColor()
113-
_textField.textColor = UIColor.whiteColor()
114-
_textField.tintColor = UIColor.whiteColor()
115113
_textField.clearButtonMode = .WhileEditing
116114
_textField.autocorrectionType = .No
117115
_textField.returnKeyType = .Search
@@ -316,10 +314,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
316314
frame = CGRect(x: 0, y: 7, width: UIScreen.mainScreen().bounds.width, height: 30)
317315
}
318316

319-
layer.cornerRadius = 5
320-
layer.shouldRasterize = true
321-
layer.rasterizationScale = UIScreen.mainScreen().scale
322-
backgroundColor = UIColor(red:0.8, green:0.32, blue:0.24, alpha:1)
317+
backgroundColor = UIColor.whiteColor()
323318

324319
addSubview(scrollView)
325320
scrollView.addSubview(inputTextField)

0 commit comments

Comments
 (0)