Release 0.2.0
Seto Elkahfi committed
Apr 8, 2017 at 19:25 UTC
5e2df031b3b171b97bcd80e254543aed3359fa90
7 files changed
+75
-18
JomloTableView.podspec
+1
-1
@@ -8,7 +8,7 @@
8
9
Pod::Spec.new do |s|
10
s.name = 'JomloTableView'
11
- s.version = '0.1.0'
11
+ s.version = '0.2.0'
12
s.summary = 'A UITableView with detachable section and row.'
13
14
# This description is used to generate tags and improve search results.
README.md
+74
-17
@@ -1,6 +1,5 @@
1
# JomloTableView
2
3
-[](https://travis-ci.org/setoelkahfi/JomloTableView)
3
[](http://cocoapods.org/pods/JomloTableView)
4
[](http://cocoapods.org/pods/JomloTableView)
5
[](http://cocoapods.org/pods/JomloTableView)
@@ -24,11 +23,12 @@ pod "JomloTableView"
23
24
## Usage
25
26
+Use single section with multiple rows. All the rows below are from single class.
27
```swift
28
import UIKit
29
import JomloTableView
30
31
-class ViewController: UIViewController {
31
+// Another code
32
33
@IBOutlet var jomloTableView: JomloTableView!
34
@@ -36,32 +36,89 @@ class ViewController: UIViewController {
36
37
override func viewDidLoad() {
38
super.viewDidLoad()
39
- // Do any additional setup after loading the view, typically from a nib.
39
41
- let row = SimpleRow()
40
+ let row0 = SimpleRow("Simple table view", subTitle: "A simple table view like we usually use. But this time, we use JomloTableView.")
41
+ exampleSection.addRow(row: row0)
42
43
- exampleSection.addRow(row: row)
44
- exampleSection.addRow(row: row)
45
- exampleSection.addRow(row: row)
46
- exampleSection.addRow(row: row)
47
- exampleSection.addRow(row: row)
48
- exampleSection.addRow(row: row)
49
- exampleSection.addRow(row: row)
50
- exampleSection.addRow(row: row)
51
- exampleSection.addRow(row: row)
43
+ let row1 = SimpleRow("Load more", subTitle: "A JomloTableView with load more row at the bottom. Will load infinite row if we scroll the table view to the bottom.")
44
+ row1.setOnRowClicked { (row) in
45
+ self.performSegue(withIdentifier: "showLoadMoreExample", sender: self)
46
+ }
47
+ exampleSection.addRow(row: row1)
48
+
49
+ let row2 = SimpleRow("Dynamic height", subTitle: "Example how to use dynamic height for single row. In fact, this example rows is also use dynamic height.")
50
+ exampleSection.addRow(row: row2)
51
+
52
+ let row3 = SimpleRow("WebView", subTitle: "A JomloTableView with WebView inside of its row.")
53
+ exampleSection.addRow(row: row3)
54
+
55
+ let row4 = SimpleRow("Image list", subTitle: "A JomloTableView with image views inside of its row.")
56
+ exampleSection.addRow(row: row4)
57
+
58
+ let row5 = SimpleRow("Long scrollable layout", subTitle: "A JomloTableView which doesn't look like a table view. ")
59
+ exampleSection.addRow(row: row5)
60
+
61
+ let row6 = SimpleRow("StackView row", subTitle: "A JomloTableView with UIStackView inside of its rows. Here we use UITableViewAutomaticDimension for row's height property.")
62
+ exampleSection.addRow(row: row6)
63
64
jomloTableView.addSection(section: exampleSection)
65
jomloTableView.reloadData()
66
67
}
68
58
- override func didReceiveMemoryWarning() {
59
- super.didReceiveMemoryWarning()
60
- // Dispose of any resources that can be recreated.
69
+// Another code
70
+```
71
+
72
+
73
+
74
+This table view will load more row if loadMoreRow is populated. This example will load infinite rows if user scroll to bottom of table view. Eight rows per each load.
75
+```swift
76
+import UIKit
77
+import JomloTableView
78
+
79
+// Another code
80
+
81
+ @IBOutlet var jomloTableView: JomloTableView!
82
+
83
+ let tableSection = JomloTableViewSection()
84
+
85
+ override func viewDidLoad() {
86
+ super.viewDidLoad()
87
+
88
+ jomloTableView.addSection(section: tableSection)
89
+ addRows()
90
+ }
91
+
92
+ func addRows() {
93
+ for _ in 0..<8 {
94
+ let rowNumber = tableSection.count + 1
95
+ let row = SimpleRow("Row \(rowNumber)", subTitle: "Example row.")
96
+ tableSection.addRow(row: row)
97
+ }
98
+
99
+ addLoadMoreRow()
100
}
101
63
-}
102
+ func addLoadMoreRow() {
103
+
104
+ let loadMoreRow = LoadMoreRow {
105
+ // To get the effect or loading, delay the execution after 3 seconds
106
+ DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 3, execute: {
107
+ self.tableSection.removeLastRow()
108
+ self.addRows()
109
+ })
110
+ }
111
+
112
+ tableSection.addRow(row: loadMoreRow)
113
+ jomloTableView.reloadData()
114
+ }
115
+
116
+// Another code
117
+
118
```
119
+
120
+
121
+
122
123
## Author
124
images/example-load-more-0.png
Binary files /dev/null and b/images/example-load-more-0.png differ
images/example-load-more-1.png
Binary files /dev/null and b/images/example-load-more-1.png differ
images/example-load-more-2.png
Binary files /dev/null and b/images/example-load-more-2.png differ
images/example-rows-0.png
Binary files /dev/null and b/images/example-rows-0.png differ
images/example-rows-1.png
Binary files /dev/null and b/images/example-rows-1.png differ