Skip to content

Commit

Permalink
Merge pull request hyperoslo#120 from hyperoslo/fix/image_selection
Browse files Browse the repository at this point in the history
Fix/image selection
  • Loading branch information
RamonGilabert committed Mar 29, 2016
2 parents 6b9f573 + 7e9b747 commit 319802b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode7.2
osx_image: xcode7.3
language: objective-c

before_install:
Expand Down
6 changes: 5 additions & 1 deletion Source/BottomView/BottomContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ protocol BottomContainerViewDelegate: class {
}

public class BottomContainerView: UIView {


struct Dimensions {
static let height: CGFloat = 101
}

lazy var pickerButton: ButtonPicker = { [unowned self] in
let pickerButton = ButtonPicker()
pickerButton.setTitleColor(.whiteColor(), forState: .Normal)
Expand Down
4 changes: 2 additions & 2 deletions Source/Extensions/ConstraintsSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ extension ImagePickerController {

view.addConstraint(NSLayoutConstraint(item: bottomContainer, attribute: .Height,
relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute,
multiplier: 1, constant: Dimensions.bottomContainerHeight))
multiplier: 1, constant: BottomContainerView.Dimensions.height))

view.addConstraint(NSLayoutConstraint(item: topView, attribute: .Height,
relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute,
multiplier: 1, constant: TopView.Dimensions.height))

view.addConstraint(NSLayoutConstraint(item: cameraController.view, attribute: .Height,
relatedBy: .Equal, toItem: view, attribute: .Height,
multiplier: 1, constant: -Dimensions.bottomContainerHeight))
multiplier: 1, constant: -BottomContainerView.Dimensions.height))
}
}

Expand Down
24 changes: 1 addition & 23 deletions Source/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ public protocol ImagePickerDelegate: class {

public class ImagePickerController: UIViewController {

struct Dimensions {
static let bottomContainerHeight: CGFloat = 101
}


struct GestureConstants {
static let maximumHeight: CGFloat = 200
Expand Down Expand Up @@ -194,18 +192,6 @@ public class ImagePickerController: UIViewController {

// MARK: - Helpers

public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()

let galleryHeight: CGFloat = UIScreen.mainScreen().nativeBounds.height == 960
? ImageGalleryView.Dimensions.galleryBarHeight
: GestureConstants.minimumHeight

let y = totalSize.height - bottomContainer.frame.height - galleryHeight
galleryView.frame = CGRect(x: 0, y: y,
width: totalSize.width, height: galleryHeight)
}

public override func prefersStatusBarHidden() -> Bool {
return true
}
Expand Down Expand Up @@ -249,14 +235,6 @@ public class ImagePickerController: UIViewController {
galleryView.frame.size.height = constant
}

func updateCollectionViewFrames(maximum: Bool) {
let constant = maximum ? GestureConstants.maximumHeight : GestureConstants.minimumHeight
galleryView.collectionView.frame.size.height = constant - galleryView.topSeparator.frame.height
galleryView.collectionSize = CGSize(width: galleryView.collectionView.frame.height, height: galleryView.collectionView.frame.height)

galleryView.updateNoImagesLabel()
}

func enableGestures(enabled: Bool) {
galleryView.alpha = enabled ? 1 : 0
bottomContainer.pickerButton.enabled = enabled
Expand Down

0 comments on commit 319802b

Please sign in to comment.