Skip to content

Commit

Permalink
Redraw calendar only when the new interface orientation is different …
Browse files Browse the repository at this point in the history
…from the old one.
  • Loading branch information
robbdimitrov committed Feb 27, 2014
1 parent 20b7163 commit 0d16dba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions RDVCalendarView.podspec
@@ -1,14 +1,14 @@
Pod::Spec.new do |s|
s.name = "RDVCalendarView"
s.version = "1.0.6"
s.version = "1.0.7"
s.summary = "Highly customizable calendarView and calendarViewController for iOS"
s.description = "RDVCalendarView is iPad and iPhone compatible. Everything can be customized.
Supports landscape and portrait orientations and is fully localized using NSLocale."
s.homepage = "https://github.com/robbdimitrov/RDVCalendarView"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Robert Dimitrov" => "robert_dimitrov@me.com" }
s.platform = :ios, '5.0'
s.source = { :git => "https://github.com/robbdimitrov/RDVCalendarView.git", :tag => "v1.0.6" }
s.source = { :git => "https://github.com/robbdimitrov/RDVCalendarView.git", :tag => "v1.0.7" }
s.source_files = 'RDVCalendarView', 'RDVCalendarView/**/*.{h,m}'
s.framework = 'UIKit', 'CoreGraphics', 'Foundation'
s.requires_arc = true
Expand Down
12 changes: 11 additions & 1 deletion RDVCalendarView/RDVCalendarView.m
Expand Up @@ -39,6 +39,8 @@ @interface RDVCalendarView () {
NSArray *_weekDays;

Class _dayCellClass;

UIInterfaceOrientation _orientation;
}

@property (atomic, strong) NSDateComponents *selectedDay;
Expand Down Expand Up @@ -127,6 +129,8 @@ - (id)initWithFrame:(CGRect)frame {
selector:@selector(deviceDidChangeOrientation:)
name:UIDeviceOrientationDidChangeNotification
object:nil];

_orientation = [[UIApplication sharedApplication] statusBarOrientation];
}
return self;
}
Expand Down Expand Up @@ -656,7 +660,13 @@ - (void)currentLocaleDidChange:(NSNotification *)notification {
#pragma mark - Orientation cnahge handling

- (void)deviceDidChangeOrientation:(NSNotification *)notification {
[self reloadData];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

// orientation has changed to a new one
if (UIInterfaceOrientationIsLandscape(orientation) != UIInterfaceOrientationIsLandscape(_orientation)) {
_orientation = orientation;
[self reloadData];
}
}

#pragma mark - Touch handling
Expand Down

0 comments on commit 0d16dba

Please sign in to comment.