Skip to content

Commit b49bcd9

Browse files
committed
Fixed bug posted by girishnair12345: "setCurrentDate doesnt work properly #4"
1 parent ea1a5a1 commit b49bcd9

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

ios_calendar/Base.lproj/Main_iPad.storyboard

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
33
<dependencies>
44
<deployment defaultVersion="1552" identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
@@ -36,6 +36,16 @@
3636
<action selector="popoverButtonAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wKI-KC-d7y"/>
3737
</connections>
3838
</button>
39+
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="h6M-ja-ijv">
40+
<rect key="frame" x="361" y="938" width="46" height="30"/>
41+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
42+
<state key="normal" title="Button">
43+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
44+
</state>
45+
<connections>
46+
<action selector="buttonTap:" destination="BYZ-38-t0r" eventType="touchUpInside" id="p2I-k6-lmY"/>
47+
</connections>
48+
</button>
3949
</subviews>
4050
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
4151
<constraints>

ios_calendar/Base.lproj/Main_iPhone.storyboard

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
33
<dependencies>
44
<deployment defaultVersion="1552" identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
@@ -74,6 +74,16 @@
7474
<action selector="popoverButtonAction:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="KCX-6d-5XV"/>
7575
</connections>
7676
</button>
77+
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dTn-aR-uFU">
78+
<rect key="frame" x="125" y="497" width="70" height="30"/>
79+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
80+
<state key="normal" title="Button">
81+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
82+
</state>
83+
<connections>
84+
<action selector="buttonTap:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Fcz-fr-XdX"/>
85+
</connections>
86+
</button>
7787
</subviews>
7888
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
7989
<constraints>

ios_calendar/Sources/CalendarView.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,9 @@ - (void)setCurrentDate:(NSDate *)date
234234
break;
235235
}
236236

237-
_currentDate = date;
237+
[self fade];
238238

239-
if (![_currentDate isEqualToDate:date]) {
240-
[self setNeedsDisplay];
241-
}
239+
_currentDate = date;
242240
}
243241
}
244242

ios_calendar/ViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,14 @@ - (IBAction)popoverButtonAction:(UIButton *)sender
6767
[popover presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
6868
}
6969

70+
- (IBAction)buttonTap:(id)sender
71+
{
72+
NSDateComponents *comps = [[NSDateComponents alloc] init];
73+
comps.year = 2015;
74+
comps.month= 1;
75+
comps.day = 1;
76+
NSDate *toDate = [[NSCalendar currentCalendar] dateFromComponents:comps];
77+
[self.calendarView setCurrentDate:toDate];
78+
}
79+
7080
@end

0 commit comments

Comments
 (0)