File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
bk2ch08p451dynamicTableContent/ch21p718sections Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import UIKit
4
4
5
+ func delay( delay: Double , closure: ( ) -> ( ) ) {
6
+ dispatch_after (
7
+ dispatch_time (
8
+ DISPATCH_TIME_NOW,
9
+ Int64 ( delay * Double( NSEC_PER_SEC) )
10
+ ) ,
11
+ dispatch_get_main_queue ( ) , closure)
12
+ }
13
+
5
14
class MyHeaderView : UITableViewHeaderFooterView {
6
15
var section = 0
16
+ // just testing reuse
17
+ deinit {
18
+ println ( " farewell from a header, section \( section) " )
19
+ }
7
20
}
8
21
9
22
class RootViewController : UITableViewController {
@@ -38,6 +51,10 @@ class RootViewController : UITableViewController {
38
51
self . tableView. sectionIndexColor = UIColor . whiteColor ( )
39
52
self . tableView. sectionIndexBackgroundColor = UIColor . redColor ( )
40
53
self . tableView. sectionIndexTrackingBackgroundColor = UIColor . blueColor ( )
54
+ return // just testing reuse
55
+ delay ( 5 ) {
56
+ self . tableView. reloadData ( )
57
+ }
41
58
}
42
59
43
60
override func numberOfSectionsInTableView( tableView: UITableView ) -> Int {
You can’t perform that action at this time.
0 commit comments