Skip to content

Commit

Permalink
add currentMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
farhad faramarzi committed Nov 22, 2017
1 parent 12d6e7a commit 871ab84
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 33 deletions.
Binary file modified .DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
<rect key="frame" x="16" y="20" width="343" height="216"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bF1-YA-mfc">
<rect key="frame" x="168" y="297" width="39" height="30"/>
<state key="normal" title="Reset"/>
<connections>
<action selector="didTapReset:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Tfb-vj-wxd"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="q0n-fH-WHJ" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="H2M-xA-UZi"/>
<constraint firstItem="bF1-YA-mfc" firstAttribute="centerX" secondItem="q0n-fH-WHJ" secondAttribute="centerX" id="aYT-0M-B9O"/>
<constraint firstItem="bF1-YA-mfc" firstAttribute="top" secondItem="q0n-fH-WHJ" secondAttribute="bottom" constant="61" id="gvS-fO-IHs"/>
<constraint firstItem="q0n-fH-WHJ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="uoa-iV-Xzs"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="q0n-fH-WHJ" secondAttribute="trailing" constant="16" id="zdx-NY-C8f"/>
</constraints>
Expand Down
3 changes: 3 additions & 0 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ class ViewController: UIViewController {
print("\(year)/\(month)/\(day)")
}
}
@IBAction func didTapReset(_ sender: Any) {
persianDatePickerView.currectDatePicker()
}
}

8 changes: 4 additions & 4 deletions PersianDatePicker.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|
s.name = 'PersianDatePicker'
s.version = '0.1.9'
s.version = '0.2.0'
s.summary = 'PersianDatePicker is a PickerView. by : farhad faramarzi'


s.homepage = 'https://github.com/farhad1985/PersianDatePicker'
s.author = { 'Farhad Faramarzi' => '[email protected]' }
s.license = { :type => 'GPL2', :file => 'LICENSE' }
s.source = { :git => 'https://github.com/farhad1985/PersianDatePicker.git', :tag => s.version.to_s }

s.ios.deployment_target = '9.0'
s.source_files = 'PersianDatePicker/*'

end
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PersianDatePicker/PersianDatePickerView.swift"
timestampString = "523107752.095408"
timestampString = "533019035.894294"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "139"
endingLineNumber = "139"
startingLineNumber = "142"
endingLineNumber = "142"
landmarkName = "pickerView(_:viewForRow:forComponent:reusing:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -26,11 +26,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PersianDatePicker/PersianDatePickerView.swift"
timestampString = "523107752.09545"
timestampString = "533019035.894376"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "116"
endingLineNumber = "116"
startingLineNumber = "119"
endingLineNumber = "119"
landmarkName = "pickerView(_:viewForRow:forComponent:reusing:)"
landmarkType = "7">
</BreakpointContent>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,4 @@
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "PersianDatePicker/PersianDatePickerView.swift"
timestampString = "523107752.095327"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "56"
endingLineNumber = "56"
landmarkName = "setup()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
2 changes: 1 addition & 1 deletion PersianDatePicker/Cal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct Cal {

func getYears() -> [Int] {
var y: [Int] = []
for i in 1300...1400 {
for i in 1300...1500 {
y += [i]
}

Expand Down
11 changes: 7 additions & 4 deletions PersianDatePicker/PersianDatePickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PersianDatePickerView: UIView {
fileprivate var monthName: MonthName = .farvardin
fileprivate var numberMonth = 1
fileprivate var pickerView = UIPickerView()
fileprivate var persianDatePresenter: PersianDatePresenter!
fileprivate var persianDatePresenter = PersianDatePresenter()

override public init(frame: CGRect) {
super.init(frame: frame)
Expand All @@ -50,7 +50,10 @@ public class PersianDatePickerView: UIView {

func setup() {
addSubview(pickerView)
persianDatePresenter = PersianDatePresenter()
currectDatePicker()
}

public func currectDatePicker() {
pickerView.dataSource = self
pickerView.delegate = self

Expand All @@ -60,7 +63,7 @@ public class PersianDatePickerView: UIView {
}
if currentYear.count > 0 {
let indexYear = currentYear[0] - 1300

pickerView.selectRow(indexYear, inComponent: 0, animated: true)
pickerView.selectRow(currentDate.month - 1, inComponent: 1, animated: true)
if pickerStyle == .long {
Expand All @@ -72,7 +75,7 @@ public class PersianDatePickerView: UIView {
numberMonth = month
}
}

override public func layoutSubviews() {
super.layoutSubviews()
pickerView.translatesAutoresizingMaskIntoConstraints = false
Expand Down

0 comments on commit 871ab84

Please sign in to comment.