Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue 38: test keyboard moving the header view
- Loading branch information
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Example/GSKStretchyHeaderView/GSKTextFieldHeaderView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// GSKTextFieldHeaderView.swift | ||
// Example | ||
// | ||
// Created by Jose Alcalá-Correa on 8/1/17. | ||
// Copyright © 2017 Jose Alcalá Correa. All rights reserved. | ||
// | ||
|
||
import GSKStretchyHeaderView | ||
import Masonry | ||
|
||
class GSKTextFieldHeaderView: GSKStretchyHeaderView { | ||
private lazy var textField: UITextField = { | ||
let textField = UITextField() | ||
textField.borderStyle = .roundedRect | ||
textField.size = CGSize(width: 280, height: 32) | ||
return textField | ||
}() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.commonInit() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
self.commonInit() | ||
} | ||
|
||
private func commonInit() { | ||
self.maximumContentHeight = self.width | ||
self.minimumContentHeight = 64 | ||
self.backgroundColor = UIColor.red | ||
|
||
self.contentView.addSubview(self.textField) | ||
self.textField.mas_makeConstraints { make in | ||
let _ = make?.size.equalTo()(CGSize(width: 280, height: 32)) | ||
let _ = make?.center.equalTo()(self.contentView)?.centerOffset()(CGPoint(x: 8, y: 8)) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters