-
Notifications
You must be signed in to change notification settings - Fork 0
/
FacebookFeedDatasource.swift
50 lines (41 loc) · 1.74 KB
/
FacebookFeedDatasource.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// FacebookFeedDatasource.swift
// comblie
//
// Created by Cal on 11/16/15.
// Copyright © 2015 Comblie. All rights reserved.
//
import UIKit
class FacebookFeedDatasource: NSObject, UITableViewDataSource {
var tableView : UITableView
var items : NSMutableArray
var isProfile : Bool
var parent : UITableViewController!
init(parent: UITableViewController, tableView : UITableView, isProfile: Bool) {
self.parent = parent
self.isProfile = isProfile
self.items = ["a","a", "a"]
self.tableView = tableView
self.tableView.registerNib(UINib(nibName: "FacebookHeaderCell", bundle: nil), forCellReuseIdentifier: "FacebookHeader")
self.tableView.registerNib(UINib(nibName: "FacebookStatusCell", bundle: nil), forCellReuseIdentifier: "FacebookStatus")
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.items.count
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var currentCell : UITableViewCell!
// Configure the cell...
if (isProfile && indexPath.row == 0) {
currentCell = tableView.dequeueReusableCellWithIdentifier("FacebookHeader", forIndexPath: indexPath)
} else {
let cell = tableView.dequeueReusableCellWithIdentifier("FacebookStatus", forIndexPath: indexPath) as! FacebookStatusCellController
cell.parent = self.parent
currentCell = cell
}
return currentCell
}
}