Skip to content

Commit 0fa38cb

Browse files
committed
Add ContextTitleView doc
1 parent f24a1e5 commit 0fa38cb

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

Documentation/ContextTitleView.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## ContextTitleView
2+
3+
This article will guide you how to subclass the `ALKContextTitleView` class and customize it according to your requirements.
4+
5+
![simulator screen shot context title view ](https://user-images.githubusercontent.com/5956714/35631016-cefd93e6-06c8-11e8-9b7e-803850f6c4a7.png)
6+
7+
### Subclass and Modify the UI
8+
9+
```swift
10+
11+
class TitleContextView: ALKContextTitleView {
12+
13+
14+
override init(frame: CGRect) {
15+
super.init(frame: frame)
16+
}
17+
18+
required init?(coder aDecoder: NSCoder) {
19+
fatalError("init(coder:) has not been implemented")
20+
}
21+
22+
override func setupUI() {
23+
super.setupUI()
24+
titleLabel.isHidden = true
25+
titleLabel.backgroundColor = UIColor.black
26+
}
27+
}
28+
```
29+
30+
31+
### Inject the Subclassed view
32+
33+
```swift
34+
35+
class ConversationVC: ALKConversationViewController {
36+
override func viewDidLoad() {
37+
super.viewDidLoad()
38+
let view = TitleContextView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
39+
self.contextTitleView = view
40+
}
41+
}
42+
43+
class ConversationListVC: ALKConversationListViewController {
44+
override func viewDidLoad() {
45+
super.viewDidLoad()
46+
conversationViewController = ConversationVC()
47+
48+
}
49+
}
50+
51+
```

0 commit comments

Comments
 (0)