Skip to content

Commit

Permalink
going back to the "jumpy"
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedrabbit committed Aug 22, 2016
1 parent 5266ad4 commit 734d45f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions CatPColoralettes/ExpandingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class ExpandingView: UIView {
self.setupViewHierarchy()
self.configureConstraints()
self.addGestures()

self.optionsView.backgroundColor = UIColor.cyanColor()
}

override init(frame: CGRect) {
Expand Down Expand Up @@ -91,15 +93,16 @@ class ExpandingView: UIView {
private func setupViewHierarchy() {
self.addSubview(containerView)

self.containerView.addSubview(stackView)
self.containerView.addSubview(optionsView)
self.containerView.addSubview(stackView)
self.containerView.addSubview(overlayView)

self.colorViews.forEach { (view) in
self.stackView.addArrangedSubview(view)
}
}

// TODO: remove gesture if def staying with tableview delegate handling it
private func addGestures() {
self.tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(ExpandingView.didTapView))
self.addGestureRecognizer(self.tapRecognizer)
Expand All @@ -112,17 +115,14 @@ class ExpandingView: UIView {

let newOffset = self.isExpanded ? -ExpandingView.OptionsViewHeight : ExpandingView.OptionsViewHeight
self.optionsViewTopConstrain?.updateOffset(newOffset)

UIView.animateWithDuration(0.15, animations: {
self.layoutIfNeeded()
}, completion: nil)
self.layoutIfNeeded()

self.isExpanded = !self.isExpanded
}


// MARK: - Gestures
internal func didTapView(sender: AnyObject?) {
self.toggleCellExpansion()
// not being utilized at the moment, cell directly is calling toggle cell expansion on tap
}
}
7 changes: 5 additions & 2 deletions CatPColoralettes/PaletteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ internal class PaletteViewController: UIViewController, UITableViewDelegate, UIT

private func adjustSubclass() {
self.view.backgroundColor = AppColors.DefaultBackground
self.title = AppStrings.PaletteVCTile
// self.title = AppStrings.PaletteVCTile

self.tableView.dataSource = self
self.tableView.delegate = self
Expand Down Expand Up @@ -162,7 +162,10 @@ internal class PaletteViewController: UIViewController, UITableViewDelegate, UIT
// MARK: - UITableViewDelegate
internal func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
//TODO: - needs reimplementation for smooth animations, i think..
tableView.reloadData()

let selectedCell: SimpleExpandingCell = tableView.cellForRowAtIndexPath(indexPath) as! SimpleExpandingCell
selectedCell.simulateTap()
self.tableView.reloadData()
}


Expand Down

0 comments on commit 734d45f

Please sign in to comment.