Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disable topic detail WebView bounces past edge of content.

Add Handle event with swip right to back to list.
Change Pull to refresh text color.
  • Loading branch information...
commit 83f4801cd3d20898eaf618fe8bbad5d1f75abe9b 1 parent 11fc16f
@huacnlee huacnlee authored
View
15 ruby-china-for-ios/Controllers/RCTopicViewController.m
@@ -39,7 +39,6 @@ - (void) loadRemoteInfo:(RCTopic *) aTopic {
[self setupBlankWebView];
[RCTopic remoteObjectWithID:aTopic.remoteID async:^(id object, NSError *error) {
topic = object;
- sleep(2);
[self setupWebView];
[hud hide:YES];
}];
@@ -60,8 +59,16 @@ - (void)viewDidLoad {
[navBar.backItem.backBarButtonItem setStyle:UIBarButtonItemStyleDone];
webView.backgroundColor = [UIColor clearColor];
+ webView.scrollView.bounces = NO;
+
+ // MARK: 手势
+ UISwipeGestureRecognizer *recognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeToRight)];
+ recognizerRight.direction = UISwipeGestureRecognizerDirectionRight;
+ [webView addGestureRecognizer:recognizerRight];
}
+
+#pragma mark - WebView
- (void) setupBlankWebView {
NSString *html = @"";
NSString *path = [[NSBundle mainBundle] bundlePath];
@@ -150,4 +157,10 @@ - (NSString *) replaceHtml:(NSString *)html forKey:(NSString *)key value:(id)val
html = [html stringByReplacingOccurrencesOfString:key withString:stringValue];
return html;
}
+
+#pragma mark - 手势
+- (void)handleSwipeToRight {
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
@end
View
5 ruby-china-for-ios/Controllers/RCTopicsViewController.m
@@ -10,6 +10,7 @@
#import "RCTopicViewController.h"
#import "RCTopicTableViewCell.h"
#import "RCAll.h"
+#import <SSPullToRefresh/SSPullToRefresh.h>
@interface RCTopicsViewController ()
@@ -31,6 +32,10 @@ - (void)viewDidLoad
[super viewDidLoad];
pullToRefreshView = [[SSPullToRefreshView alloc] initWithScrollView:tableView delegate:self];
+ SSPullToRefreshDefaultContentView *contentView = (SSPullToRefreshDefaultContentView *)pullToRefreshView.contentView;
+ contentView.statusLabel.textColor = [UIColor grayColor];
+ contentView.lastUpdatedAtLabel.textColor = [UIColor darkGrayColor];
+ contentView.activityIndicatorView.color = [UIColor lightGrayColor];
// MARK: UINavigationBar 设置
UINavigationBar *navbar = self.navigationController.navigationBar;
View
9 ruby-china-for-ios/en.lproj/MainStoryboard.storyboard
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2840" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="fFC-Jr-qJp">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2844" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="fFC-Jr-qJp">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1926"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1930"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
@@ -53,7 +53,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="10" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="580" y="286"/>
+ <point key="canvasLocation" x="436" y="338"/>
</scene>
<!--Topic View Controller - 查看话题-->
<scene sceneID="6iy-Mq-517">
@@ -65,6 +65,7 @@
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bB2-28-A08">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <dataDetectorType key="dataDetectorTypes"/>
<connections>
<outlet property="delegate" destination="Ict-Dp-uwZ" id="Cu0-if-8FJ"/>
</connections>
@@ -86,7 +87,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1ds-Er-6ft" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="916" y="893"/>
+ <point key="canvasLocation" x="-130" y="1024"/>
</scene>
</scenes>
<resources>
Please sign in to comment.
Something went wrong with that request. Please try again.