Iphone 如何将文件上载到UIWebview
您好,我有一个在UIWebview上运行的url,我有一个浏览选项,可以从中选择照片、pdf等文件 但当我运行UIWebview并单击browse按钮时,它会给出类似的豁免Iphone 如何将文件上载到UIWebview,iphone,ios,ipad,Iphone,Ios,Ipad,您好,我有一个在UIWebview上运行的url,我有一个浏览选项,可以从中选择照片、pdf等文件 但当我运行UIWebview并单击browse按钮时,它会给出类似的豁免 " WebViewTutorial[1173:c07] Unbalanced calls to begin/end appearance transitions for <UIFileUploadFallbackRootViewController: 0x75a7330>." 提前感谢您如何介绍WebViewC
" WebViewTutorial[1173:c07] Unbalanced calls to begin/end appearance transitions for <UIFileUploadFallbackRootViewController: 0x75a7330>."
提前感谢您如何介绍
WebViewController
本身?在导航控制器、选项卡等中?无法在iOS5和更早版本的web视图中上载文件(这可能在iOS6中得到支持,但我不可能对未发布的测试版功能发表评论;-)。WWDC宣布可以在iOS6中上载图片,但没有公开的信息说明其工作原理
#import "WebViewController.h"
@implementation WebViewController
@synthesize webView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Initialization code
}
return self;
}
- (void)viewDidLoad {
NSString *urlAddress = @"http://html5basicuploader.agnozine.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
webView.scrollView.scrollEnabled = NO;
webView.scrollView.bounces = NO;
[webView loadRequest:requestObj];
webView.delegate = self;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)webViewDidFinishLoad:(UIWebView *)webView1{
if([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPad )
{
[webView1 stringByEvaluatingJavaScriptFromString:@"document. body.style.zoom = 3.2;"];
NSString* javascript = [NSString stringWithFormat:@"window.scrollBy(30, 0);"];
[webView1 stringByEvaluatingJavaScriptFromString:javascript];
webView.scalesPageToFit=NO;}
else if ([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPhone){
[webView1 stringByEvaluatingJavaScriptFromString:@"document. body.style.zoom = 1.2;"];
NSString* javascript = [NSString stringWithFormat:@"window.scrollBy(0, 0);"];
[webView1 stringByEvaluatingJavaScriptFromString:javascript];
webView.scalesPageToFit=NO;}
}
- (void)dealloc {
[webView release];
[super dealloc];
}
@end