我正在尋找添加一個拉到刷新功能到我在應用程序中的UIWebView。我已經使用Pull來刷新表格視圖的過去,但我努力尋找任何好的教程/庫來幫助我將其添加到UIWebViews專門和此項目。向UIWebView添加一個刷新功能iOS
我確實用chpwn(https://github.com/chpwn/PullToRefreshView)得到了一些使用PullToRefreshView的方法,但我無法檢測到拖動。 有誰知道更好的插件/庫?
我正在尋找添加一個拉到刷新功能到我在應用程序中的UIWebView。我已經使用Pull來刷新表格視圖的過去,但我努力尋找任何好的教程/庫來幫助我將其添加到UIWebViews專門和此項目。向UIWebView添加一個刷新功能iOS
我確實用chpwn(https://github.com/chpwn/PullToRefreshView)得到了一些使用PullToRefreshView的方法,但我無法檢測到拖動。 有誰知道更好的插件/庫?
對我這篇文章,代碼工作就像一個魅力
http://sonnyparlin.com/2011/12/pulltorefresh-ios-5-and-arc-tutorial/
我新的iOS開發,所以這可能不是最好的辦法......但它爲我工作。我使用包裝我的WebView的控制器,並將其更改爲UITableViewController(它只是一個UIViewController),這樣我就可以利用該控制器的refreshControl屬性(ios6和更高版本)。我沒有使用UITableViewController內部的TableView(儘管它似乎需要一個存在,我包含它,但我只是不填充它)。我給控制器添加了2種方法:
- (void)addPullToRefresh
{
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refreshControl addTarget:self.myWebView action:@selector(reload)
forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
}
- (void)stopRefresh
{
[self.refreshControl endRefreshing];
}
我給[self addPullToRefresh];在viewDidLoad中,我添加了一個對[self stopRefresh]的調用;在webViewDidFinishLoad:
我得到了如何使用UITableViewController here的refreshControl屬性的說明。
真的很好,很容易遵循。我喜歡那個帖子。 –
Downvoting,因爲您應該在此發佈答案,而不僅僅是外部參考的鏈接。鏈接死後會發生什麼?事實上,這個鏈接已經被破壞了! – Lev