Tengo una aplicación que usa un UIWebView en una de sus pestañas. ¡Todo funciona como debería, pero la velocidad con la que se desplaza la vista es extremadamente lenta! No importa si lo construyo en el simulador o si lo construyo en mi iPhone, es el mismo desplazamiento lento. ¿Cómo puedo aumentar la velocidad de desplazamiento de la vista? Me di cuenta de que dejará de desplazarse tan pronto como el dedo salga de la pantalla, en lugar de seguir desplazándose y desacelerándose como en un safari, ¿tiene esto algo que ver?¿Cómo aumentar la velocidad de desplazamiento de UIWebView?
El es mi archivo .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
Y este es mi archivo .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
He archivado un informe de error sobre esto. El número de referencia es 11322967. – MrO
Hace dos años, publiqué una solución alternativa, pero hoy alguien mencionó que conduciría a un rechazo. Puede ver mi respuesta original en: http://stackoverflow.com/a/2979294/359041 – MrO