Skip to content

Commit

Permalink
Merge branch 'swift1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
akkyie committed Apr 9, 2015
2 parents 97ce531 + cecc26c commit 4ecff24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions AKPickerView/AKPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Protocols to specify the number and type of contents.
*/
@objc public protocol AKPickerViewDataSource {
func numberOfItemsInPickerView(pickerView: AKPickerView) -> Int
optional func pickerView(pickerView: AKPickerView, titleForItem item:Int) -> NSString
optional func pickerView(pickerView: AKPickerView, imageForItem item:Int) -> UIImage
optional func pickerView(pickerView: AKPickerView, titleForItem item: Int) -> String
optional func pickerView(pickerView: AKPickerView, imageForItem item: Int) -> UIImage
}

// MARK: AKPickerViewDelegate
Expand All @@ -36,9 +36,9 @@ Protocols to specify the attitude when user selected an item,
and customize the appearance of labels.
*/
@objc public protocol AKPickerViewDelegate: UIScrollViewDelegate {
optional func pickerView(pickerView: AKPickerView, didSelectItem item:Int)
optional func pickerView(pickerView: AKPickerView, marginForItem item:Int) -> CGSize
optional func pickerView(pickerView: AKPickerView, configureLabel label:UILabel, forItem item:Int)
optional func pickerView(pickerView: AKPickerView, didSelectItem item: Int)
optional func pickerView(pickerView: AKPickerView, marginForItem item: Int) -> CGSize
optional func pickerView(pickerView: AKPickerView, configureLabel label: UILabel, forItem item: Int)
}

// MARK: - Private Classes and Protocols
Expand Down Expand Up @@ -96,8 +96,8 @@ private class AKCollectionViewCell: UICollectionViewCell {
self.contentView.addSubview(self.imageView)
}

override init() {
super.init()
init() {
super.init(frame: CGRectZero)
self.initialize()
}

Expand All @@ -114,7 +114,7 @@ private class AKCollectionViewCell: UICollectionViewCell {

// MARK: AKCollectionViewLayout
/**
Private. A subclass of UICollectionViewFlowLayout used in AKPickerView's collection view.
Private. A subclass of UICollectionViewFlowLayout used in the collection view.
*/
private class AKCollectionViewLayout: UICollectionViewFlowLayout {
var delegate: AKCollectionViewLayoutDelegate!
Expand Down Expand Up @@ -505,7 +505,7 @@ public class AKPickerView: UIView, UICollectionViewDataSource, UICollectionViewD
}

public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(NSStringFromClass(AKCollectionViewCell.self), forIndexPath: indexPath) as AKCollectionViewCell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(NSStringFromClass(AKCollectionViewCell.self), forIndexPath: indexPath) as! AKCollectionViewCell
if let title = self.dataSource?.pickerView?(self, titleForItem: indexPath.item) {
cell.label.text = title
cell.label.textColor = self.textColor
Expand All @@ -524,7 +524,6 @@ public class AKPickerView: UIView, UICollectionViewDataSource, UICollectionViewD
cell.imageView.image = image
}
cell._selected = (indexPath.item == self.selectedItem)

return cell
}

Expand Down
2 changes: 1 addition & 1 deletion AKPickerViewSample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ViewController: UIViewController, AKPickerViewDataSource, AKPickerViewDele
uncomment '-pickerView:imageForItem:' to see how it works.

*/
func pickerView(pickerView: AKPickerView, titleForItem item: Int) -> NSString {
func pickerView(pickerView: AKPickerView, titleForItem item: Int) -> String {
return self.titles[item]
}

Expand Down

0 comments on commit 4ecff24

Please sign in to comment.