Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
adjust numberOfColumn in different Device
Browse files Browse the repository at this point in the history
  • Loading branch information
StormXX committed Nov 25, 2016
1 parent f39396d commit ff362cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion PhotoPicker/AssetsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ extension AssetsViewController: UICollectionViewDelegateFlowLayout {
numberOfColumns = AssetsNumberOfColumns.LandscapePhone
}

let width: CGFloat = (view.frame.width - 2.0 * CGFloat(numberOfColumns - 1)) / CGFloat(numberOfColumns)
let width: CGFloat = floor((view.frame.width - 2.0 * CGFloat(numberOfColumns - 1)) / CGFloat(numberOfColumns))

return CGSize(width: width, height: width)
}
Expand Down
6 changes: 3 additions & 3 deletions PhotoPicker/constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ enum PhotoPickerOrientation {

struct AssetsNumberOfColumns {
static let PortraitPhone: Int = 4
static let PortraitPad: Int = 7
static let LandscapePhone: Int = 7
static let LandscapePad: Int = 12
static let PortraitPad: Int = 5
static let LandscapePhone: Int = 6
static let LandscapePad: Int = 7
}

var currentOrientation: PhotoPickerOrientation {
Expand Down
4 changes: 2 additions & 2 deletions PhotoPickerDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class ViewController: UIViewController {
]
let photoPickerController = PhotoPickerController(localizedStrings: localizedString)
photoPickerController.delegate = self
photoPickerController.allowMultipleSelection = false
photoPickerController.maximumNumberOfSelection = 3
photoPickerController.allowMultipleSelection = true
photoPickerController.maximumNumberOfSelection = 9
self.present(photoPickerController, animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
Expand Down

0 comments on commit ff362cc

Please sign in to comment.