Commit b94abc619f381d0ddf275082627bb83ea1fc8320
1 parent
7408f0a99e
Exists in
master
and in
1 other branch
Animation for switch graph view and history list view
Showing 3 changed files with 29 additions and 1 deletions Side-by-side Diff
LifeLog/LifeLog/HistoryViewController.h
LifeLog/LifeLog/HistoryViewController.m
| ... | ... | @@ -112,6 +112,16 @@ |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | +#pragma mark IBAction | |
| 116 | +-(void) swipeAction:(UISwipeGestureRecognizer *)sender { | |
| 117 | + bool alphaValue = self.scrollView.alpha == 1.0 ? 1.0 : 0.0; | |
| 118 | + [UIView animateWithDuration:0.5 animations:^{ | |
| 119 | + self.tableListHistory.alpha = alphaValue; | |
| 120 | + self.scrollView.alpha = 1.0 - alphaValue; | |
| 121 | + } completion:^(bool completed) { | |
| 122 | + }]; | |
| 123 | +} | |
| 124 | + | |
| 115 | 125 | #pragma mark UITableView Delegate |
| 116 | 126 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| 117 | 127 | return 4; |
LifeLog/LifeLog/HistoryViewController.xib
| ... | ... | @@ -117,7 +117,7 @@ |
| 117 | 117 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FLa-rV-Aas" userLabel="ViewContent"> |
| 118 | 118 | <rect key="frame" x="0.0" y="151" width="375" height="411"/> |
| 119 | 119 | <subviews> |
| 120 | - <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="FXQ-4O-sRc"> | |
| 120 | + <tableView clipsSubviews="YES" alpha="0.0" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="FXQ-4O-sRc"> | |
| 121 | 121 | <rect key="frame" x="5" y="0.0" width="365" height="411"/> |
| 122 | 122 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
| 123 | 123 | <connections> |
| 124 | 124 | |
| ... | ... | @@ -422,9 +422,14 @@ |
| 422 | 422 | <constraint firstItem="rey-N3-l8b" firstAttribute="leading" secondItem="FLa-rV-Aas" secondAttribute="leading" id="YvS-I2-8Dg"/> |
| 423 | 423 | <constraint firstAttribute="bottom" secondItem="rey-N3-l8b" secondAttribute="bottom" id="enX-7g-Eib"/> |
| 424 | 424 | </constraints> |
| 425 | + <connections> | |
| 426 | + <outletCollection property="gestureRecognizers" destination="Qjg-St-rCc" appends="YES" id="egt-sX-aBC"/> | |
| 427 | + <outletCollection property="gestureRecognizers" destination="VSZ-i0-Jhb" appends="YES" id="UKr-c3-9pp"/> | |
| 428 | + </connections> | |
| 425 | 429 | </view> |
| 426 | 430 | </subviews> |
| 427 | 431 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
| 432 | + <gestureRecognizers/> | |
| 428 | 433 | <constraints> |
| 429 | 434 | <constraint firstAttribute="trailing" secondItem="Cf1-lP-zbB" secondAttribute="trailing" constant="10" id="20C-UL-MCu"/> |
| 430 | 435 | <constraint firstItem="clL-JG-rbd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="3tf-ab-v41"/> |
| ... | ... | @@ -445,6 +450,16 @@ |
| 445 | 450 | </constraints> |
| 446 | 451 | <point key="canvasLocation" x="26.5" y="52.5"/> |
| 447 | 452 | </view> |
| 453 | + <swipeGestureRecognizer direction="left" id="Qjg-St-rCc"> | |
| 454 | + <connections> | |
| 455 | + <action selector="swipeAction:" destination="-1" id="2Vl-bM-Ta7"/> | |
| 456 | + </connections> | |
| 457 | + </swipeGestureRecognizer> | |
| 458 | + <swipeGestureRecognizer direction="right" id="VSZ-i0-Jhb"> | |
| 459 | + <connections> | |
| 460 | + <action selector="swipeAction:" destination="-1" id="hoY-6M-DoS"/> | |
| 461 | + </connections> | |
| 462 | + </swipeGestureRecognizer> | |
| 448 | 463 | </objects> |
| 449 | 464 | <resources> |
| 450 | 465 | <image name="arrow_back" width="22" height="22"/> |