Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can set sliding animation duration. #41

Merged
merged 1 commit into from
Sep 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions THCalendarDatePicker/THDatePickerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@property (strong, nonatomic) NSTimeZone *dateTimeZone;
@property (nonatomic, getter=isRounded) BOOL rounded;
@property (weak, nonatomic) IBOutlet UIView *toolbarBackgroundView;
@property (nonatomic) float slideAnimationDuration;

- (void)setDateHasItemsCallback:(BOOL (^)(NSDate * date))callback;

Expand Down
5 changes: 4 additions & 1 deletion THCalendarDatePicker/THDatePickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ @interface THDatePickerViewController () {
NSUInteger _daysInFuture;
BOOL _disableYearSwitch;
BOOL (^_dateHasItemsCallback)(NSDate *);
float _slideAnimationDuration;
}
@property (nonatomic, strong) NSDate * firstOfCurrentMonth;
@property (nonatomic, strong) THDateDay * currentDay;
Expand Down Expand Up @@ -63,6 +64,7 @@ @implementation THDatePickerViewController
@synthesize autoCloseCancelDelay = _autoCloseCancelDelay;
@synthesize dateTimeZone = _dateTimeZone;
@synthesize rounded = _rounded;
@synthesize slideAnimationDuration = _slideAnimationDuration;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
Expand All @@ -76,6 +78,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
_daysInHistory = NO;
_autoCloseCancelDelay = 1.0;
_dateTimeZone = [NSTimeZone defaultTimeZone];
_slideAnimationDuration = .5;
}
return self;
}
Expand Down Expand Up @@ -464,7 +467,7 @@ - (void)slideTransitionViewInDirection:(UISwipeGestureRecognizerDirection)dir {
newView.alpha = 0;
[self redraw];
[oldView.superview layoutSubviews];
[UIView animateWithDuration:.5 animations:^{
[UIView animateWithDuration:self.slideAnimationDuration animations:^{
newView.frame = origFrame;
newView.alpha = 1;
oldView.frame = outDestFrame;
Expand Down