Last active
June 9, 2016 22:55
-
-
Save bgayman/692652ce924e28dc57f926e9dba7a816 to your computer and use it in GitHub Desktop.
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
public class ActividadesTableViewController: UIViewController { | |
@IBOutlet weak var tableView: UITableView! | |
@IBOutlet weak var descripcionFiltrosLabel: UILabel! | |
@IBOutlet weak var filtrosLabelBottomConstraint: NSLayoutConstraint! | |
@IBOutlet weak var filtrosLabelTopConstraint: NSLayoutConstraint! | |
@IBOutlet weak var tableViewTopConstraint: NSLayoutConstraint! | |
private var liquidActionButtonInstance: FloatingActionButton = FloatingActionButton() | |
//public var viewModel : ActividadesTableViewModeling? | |
public override func viewDidLoad() { | |
super.viewDidLoad() | |
// Agregar action button | |
self.view.insertSubview(liquidActionButtonInstance.addActionButton(),aboveSubview: tableView) | |
//liquidActionButtonInstance.delegate = self | |
// set row's height | |
tableView.estimatedRowHeight = 70 | |
tableView.rowHeight = UITableViewAutomaticDimension | |
// delegate | |
tableView.delegate = self | |
tableView.dataSource = self | |
// load tableview data | |
// if let viewModel = viewModel { | |
// viewModel.loadActividades(withFilters: nil) | |
// } | |
} | |
} | |
class FloatingActionButton{ | |
func addActionButton() -> LiquidFloatingActionButton { | |
let createButton: (CGRect, LiquidFloatingActionButtonAnimateStyle) -> LiquidFloatingActionButton = { (frame, style) in | |
let floatingActionButton = LiquidFloatingActionButton(frame: frame) | |
floatingActionButton.animateStyle = style | |
//floatingActionButton.dataSource = self | |
//floatingActionButton.delegate = self | |
//floatingActionButton.color = ColoresKairos.principal2 | |
return floatingActionButton | |
} | |
let cellFactory: (String) -> LiquidFloatingCell = { (iconName) in | |
return LiquidFloatingCell(icon: UIImage(named: iconName)!) | |
} | |
//cells.append(cellFactory("iphone-action-button-group")) | |
//cells.append(cellFactory("iphone-action-button-notepad")) | |
//cells.append(cellFactory("iphone-action-button-check-box")) | |
let floatingFrame = CGRect(x: UIScreen.mainScreen().bounds.width - 56 - 16, y: UIScreen.mainScreen().bounds.height - 56 - 16, width: 56, height: 56) | |
let bottomRightButton = createButton(floatingFrame, .Up) | |
//view.addSubview(bottomRightButton) | |
//return view | |
return bottomRightButton | |
} | |
} | |
// MARK: FloatingButton | |
/*extension ActividadesTableViewController: FloatingActionButtonDelegate { | |
public func performSegueFromFloatingActionButton(segueName name: String) { | |
performSegueWithIdentifier(name, sender: self) | |
} | |
}*/ | |
// MARK: TableView | |
extension ActividadesTableViewController: UITableViewDataSource, UITableViewDelegate { | |
public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 20 | |
// Omitting this code, just mentioning the methods | |
} | |
public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) | |
/*if let viewModel = viewModel { | |
cell.viewModel = viewModel.cellModels.value[indexPath.row] | |
} else { | |
cell.viewModel = nil | |
}*/ | |
return cell | |
} | |
public func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | |
} | |
} | |
Result: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment