Fork me on GitHub

文章分类 -  UIWebView

摘要:由于iOS无法通过html表单来上传图片,因此想要上传图片,必须实现http请求,而不能像其他语言那样通过html表单的post就能上传。上传图片的http post请求的格式是这样的:?123456789101112Content-type: multipart/form-data, boundary=AaB03x--AaB03xcontent-disposition: form-data; name="field1"Hello Boris!--AaB03xcontent-disposition: form-data; name="pic"; file 阅读全文

posted @ 2012-05-18 10:51 pengyingh 阅读(628) 评论(0) 推荐(0)

摘要:rom:http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/Recently, I was working on a project which required detection of tap and events on the UIWebView. We wanted to find out the HTML element on which the user taps in the UIWebView and then depending on the element tapp 阅读全文

posted @ 2012-05-15 19:28 pengyingh 阅读(492) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/workhardupc100/article/details/7443580UIWebView*webView = [[[UIWebViewalloc]initWithFrame:CGRectMake(0,0,320,480)]autorelease];NSString*htmlPath = [[[NSBundlemainBundle]bundlePath]stringByAppendingPathComponent:@"Quartz2D.html"];htmlPath = [htmlPathstringByAddingPercen 阅读全文

posted @ 2012-04-14 09:38 pengyingh 阅读(308) 评论(0) 推荐(0)

摘要:UIWebView可以让你创建一个网页浏览器,类似safari,而不是在程序中启动safsri哦。是不是觉得很棒呢?废话少说,切入正题。一、创建UIWebViewCGRectbouds=[[UIScreenmanScreen]applicationFrame];UIWebView*webView=[[UIWebViewalloc]initWithFrame:bounds];二、设置属性webView.scalespageToFit=YES;//自动对页面进行缩放以适应屏幕webView.detectsPhoneNumbers=YES;//自动检测网页上的电话号码,单击可以拨打三、显示网页视图U 阅读全文

posted @ 2012-04-04 22:50 pengyingh 阅读(259) 评论(0) 推荐(0)

摘要:UIWebView加载网页时默认使用了网页中的背景,而不能那使用程序中的主题背景,这让人很不爽。下面给出我的解决办法。首先我在网页的css中加上了:body{background-color:transparent;}然后直接看代码:UIWebView*wv=[[UIWebViewalloc]initWithFrame:CGRectMake(0.0,0.0,320.0,460.0)];wv.backgroundColor=[UIColorclearColor];//清除背景色wb.opaque=NO;//背景不透明设置为NO[self.viewaddSubview:wv];self.view. 阅读全文

posted @ 2012-04-04 22:47 pengyingh 阅读(184) 评论(0) 推荐(0)

摘要:这个只是異步请求,NSMutableData* buf = [[NSMutableData alloc] initWithLength:0];NSURLConnection* connection = [[NSURLConnection alloc] initWithRequest:req delegate:self];// 收到响应时, 会触发- (void)connection:(NSURLConnection *)aConnection didReceiveResponse:(NSURLResponse *)aResponse;// 你可以在里面判断返回结果, 或者处理返回的http头中 阅读全文

posted @ 2012-03-26 18:35 pengyingh 阅读(163) 评论(0) 推荐(0)

摘要:The iphone app im writing displays an html page, i would like to add a search feature where the user can search for instances for the keyword and highlight them (like in firefox using ctrl+F)what's the best way to do this? in objective-c? would this be even possible with javascript?Please point 阅读全文

posted @ 2012-03-23 15:08 pengyingh 阅读(944) 评论(0) 推荐(0)

摘要:使用UIWebView显示多种文档除了HTML的内容,UIWebView还可以显示多种类型的文档包括以下的类型· Excel (.xls)· Keynote (.key.zip)· Numbers (.numbers.zip)· Pages (.pages.zip)· PDF (.pdf)· Powerpoint (.ppt)· Word (.doc)· Rich Text Format (.rtf)· Rich Text Format Directory (.rtfd.zip)· Keynot 阅读全文

posted @ 2012-03-20 23:41 pengyingh 阅读(250) 评论(0) 推荐(0)

摘要:UIWebView的唯一一个subview就是UIScrollView,不过苹果并没有提供直接的访问方式给scrollview,因此当你直接这么使用scrollview的时候uiwebview.scrollview,编译没有错误,但是运行的时候会提示[UIWebView scrollView]: unrecognized selector sent to instance因为webview的scrollview是一个苹果私有的api因此我们需要利用一些小trick来获得它的scrollview代码如下:First we will pull the UIScrollView out from t 阅读全文

posted @ 2012-03-19 10:06 pengyingh 阅读(617) 评论(0) 推荐(0)

摘要:Andy-清风原创,转载请注明,谢谢。1.UIImageView的讲解(1)初始化UIImageView *imageView =[[UIImageView alloc] initWithFrame:CGRectMake(0.0,45.0,300,300)]; imageView.image = [UIImage imageNamed:@"a.png"];//加载入图片 [self.view addSubView:image]; 也可以这样声明:UIImage *image =[[UIImage alloc] initWithData:[NSData dataWithCon 阅读全文

posted @ 2012-03-10 15:25 pengyingh 阅读(277) 评论(0) 推荐(0)

摘要:UIWebView加载Loading...两种方法 第一种方法:使用UIView and UIActivityIndicatorView //创建UIWebView WebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 44, 320, 400)]; [WebView setUserInteractionEnabled:NO]; [WebView setBackgroundColor:[UIColor clearColor]]; [WebView setDelegate:self]; [WebView setOpaque... 阅读全文

posted @ 2012-03-04 20:37 pengyingh 阅读(215) 评论(0) 推荐(0)

摘要://加载Bundle中的html文件。 NSString *Path = [[NSBundle mainBundle] pathForResource:@"chat.html" ofType:nil]; [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:Path]]]; // 执行其中的Javascript NSString *str = [NSString stringWithFormat:@"addmsg(\"%c%c%c\")", & 阅读全文

posted @ 2012-03-01 15:50 pengyingh 阅读(238) 评论(0) 推荐(0)

摘要:做的APP需要在一个UIWebView中随点击位置动态出现button,用touchesBegan等怎么调试都不行,普通的UIView就可以,找了半天终于知道UIWebView不能这样用,那么怎么做呢,只有用UITapGestureRecognizer替代了,其他的手势还可以用UIPinchGestureRecognizer(放大缩小)和UIPanGestureRecognizer(拖动),SO,我们现在以UITagGestureRecongnizer来做,获取webView中的位置。UITapGestureRecognizer* myTap = [[UITapGestureRecognize 阅读全文

posted @ 2012-02-14 12:00 pengyingh 阅读(3126) 评论(0) 推荐(0)

导航