Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaJiang14 committed Mar 1, 2018
1 parent 6b8c170 commit 013ba0d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 18 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout
*.mov

#CocoaPods
Pods
6 changes: 3 additions & 3 deletions SJDatePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
TargetAttributes = {
71F93C761E9D477A00FF18AA = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = U496Y4TUDA;
DevelopmentTeam = 8MAB78TT6T;
LastSwiftMigration = 0820;
ProvisioningStyle = Automatic;
};
Expand Down Expand Up @@ -282,7 +282,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = U496Y4TUDA;
DEVELOPMENT_TEAM = 8MAB78TT6T;
INFOPLIST_FILE = SJDatePicker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = tw.sabrina.SJDatePicker;
Expand All @@ -298,7 +298,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = U496Y4TUDA;
DEVELOPMENT_TEAM = 8MAB78TT6T;
INFOPLIST_FILE = SJDatePicker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = tw.sabrina.SJDatePicker;
Expand Down
Binary file not shown.
15 changes: 15 additions & 0 deletions SJDatePicker/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -29,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
29 changes: 14 additions & 15 deletions SJDatePicker/SJDatePicker/PresentedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class PresentedViewController: UIViewController {
public var pickerMode:UIDatePickerMode = .dateAndTime
public var minimumDate:Date? = nil
public var maximumDate:Date? = nil
public var date_format:dateformat = .yyyy_To_ss
public var returnDateFormat:dateformat = .yyyy_To_ss
public var titleString:String? = nil

private var picker:UIDatePicker = UIDatePicker.init()
private var confirmButton:UIButton = UIButton.init()
private let cornerRadius:CGFloat = 7.5
private let highlightedView:UIView = UIView.init()
private let pickerHeight:CGFloat = 216
private let pickerWidth:CGFloat = UIScreen.main.bounds.size.width - 10
fileprivate var picker:UIDatePicker = UIDatePicker.init()
fileprivate var confirmButton:UIButton = UIButton.init()
fileprivate let cornerRadius:CGFloat = 7.5
fileprivate let highlightedView:UIView = UIView.init()
fileprivate let pickerHeight:CGFloat = 216
fileprivate let pickerWidth:CGFloat = UIScreen.main.bounds.size.width - 10

var block:returnDate?

Expand All @@ -61,16 +61,16 @@ class PresentedViewController: UIViewController {
picker.layer.cornerRadius = cornerRadius
picker.datePickerMode = self.pickerMode

if minimumDate != nil {
picker.minimumDate = self.minimumDate!
if let minDate = minimumDate {
picker.minimumDate = minDate
}

if maximumDate != nil{
picker.maximumDate = self.maximumDate!
if let maxDate = maximumDate {
picker.maximumDate = maxDate
}

if minimumDate != nil && maximumDate != nil {
assert(minimumDate! < maximumDate!, "minimum date cannot bigger then maximum date")
if let minDate = minimumDate, let maxDate = maximumDate {
assert(minDate < maxDate, "minimum date cannot bigger then maximum date")
}

picker.layer.masksToBounds = true
Expand Down Expand Up @@ -118,13 +118,12 @@ class PresentedViewController: UIViewController {
if block != nil {
self.dismiss(animated: true, completion: nil)
let df:DateFormatter = DateFormatter.init()
df.dateFormat = date_format.rawValue
df.dateFormat = returnDateFormat.rawValue
df.timeZone = TimeZone(secondsFromGMT: TimeZone.current.secondsFromGMT())
let returnDate:String = df.string(from: picker.date)
block!(returnDate)
}
}

}

extension PresentedViewController:UIViewControllerTransitioningDelegate{
Expand Down

0 comments on commit 013ba0d

Please sign in to comment.