xcode – 如何提高UIWebView的滚动速度?

xcode – 如何提高UIWebView的滚动速度?,第1张

概述我有一个应用程序在其中一个选项卡上使用UIWebView. 一切都像它应该的那样工作,但视图滚动速度非常慢!如果我在模拟器中构建它或者如果我在我的iPhone中构建它并不重要,它就是相同的慢速滚动. 如何提高视图的滚动速度?我注意到,一旦手指离开屏幕,它就会停止滚动,而不是像野生动物园那样保持滚动和减速,这与它有什么关系吗? 这是我的.h文件: // FirstViewController_S 我有一个应用程序在其中一个选项卡上使用UIWebVIEw.
一切都像它应该的那样工作,但视图滚动的速度非常慢!如果我在模拟器中构建它或者如果我在我的iPhone中构建它并不重要,它就是相同的慢速滚动.
如何提高视图的滚动速度?我注意到,一旦手指离开屏幕,它就会停止滚动,而不是像野生动物园那样保持滚动和减速,这与它有什么关系吗?

这是我的.h文件:

//  FirstVIEwController_SE.h//  WebApp////  Created by Camilla Fröberg on 2012-03-29.//  copyright (c) 2012 Safeline Sweden AB. All rights reserved.//#import <UIKit/UIKit.h>@interface FirstVIEwController_SE : UIVIEwController<uiwebviewdelegate> {IBOutlet UIWebVIEw *webdisplay_SE;    UIbarbuttonItem* mBack;    UINavigationItem* back;}@property(nonatomic,retain) UIWebVIEw *webdisplay_SE;@property (nonatomic,retain) IBOutlet UIbarbuttonItem* back;- (voID)updatebuttons;@end

这是我的.m文件:

////  FirstVIEwController_SE.m//  WebApp////  Created by Camilla Fröberg on 2012-03-29.//  copyright (c) 2012 Safeline Sweden AB. All rights reserved.//#import "FirstVIEwController_SE.h"@interface FirstVIEwController_SE ()@end@implementation FirstVIEwController_SE;@synthesize webdisplay_SE;@synthesize back = mBack;#pragma mark - VIEw lifecycle// Implement vIEwDIDLoad to do additional setup after loading the vIEw,typically from a nib.- (voID)vIEwDIDLoad {    [super vIEwDIDLoad];    self.webdisplay_SE.delegate = self;    Nsstring *urlAddress = @"http://www.safeline.eu/mobile/se/product";    //Create a URL object.    NSURL *url = [NSURL URLWithString:urlAddress];    //URL Requst Object    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];    //Load the request in the UIWebVIEw.    [webdisplay_SE loadRequest:requestObj];    [self updatebuttons];   }- (voID)vIEwDIDUnload {    self.back = nil;    [super vIEwDIDUnload];    // Release any retained subvIEws of the main vIEw.    // e.g. self.myOutlet = nil;}- (BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation{    return YES;}- (voID)updatebuttons{    self.back.enabled = self.webdisplay_SE.canGoBack;}- (voID)dIDReceiveMemoryWarning {    // Releases the vIEw if it doesn't have a supervIEw.    [super dIDReceiveMemoryWarning];    // Release any cached data,images,etc that aren't in use.}- (BOol)webdisplay_SE:(UIWebVIEw *)webdisplay_SE shouldStartLoaDWithRequest:(NSURLRequest *)request navigationType:(UIWebVIEwNavigationType)navigationType{    return YES;}- (voID)webVIEwDIDStartLoad:(UIWebVIEw *)webdisplay_SE{    [self updatebuttons];}- (voID)webVIEwDIDFinishLoad:(UIWebVIEw *)webdisplay_SE{    [self updatebuttons];}@end
解决方法 试试这个:

webVIEw.scrollVIEw.decelerationRate = UIScrollVIEwDecelerationRatenormal;

注意:iOS 9中存在一个错误,您可能需要解决https://stackoverflow.com/a/32843700/308315问题

总结

以上是内存溢出为你收集整理的xcode – 如何提高UIWebView的滚动速度?全部内容,希望文章能够帮你解决xcode – 如何提高UIWebView的滚动速度?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1025154.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存