uiwebview加载网页后根据内容设置大小
2014-02-15 15:57
393 查看
-(void)setWebView{
web=[[UIWebView
alloc]initWithFrame:CGRectMake(5, imageView.frame.origin.y+imageView.frame.size.height,
310, 0)];
web.userInteractionEnabled =NO;
NSString* url=self.gamemodel.appIntroduce;
NSURLRequest* re=[[NSURLRequest
alloc]initWithURL:[NSURL
URLWithString:url]];
[web loadRequest:re];
web.autoresizingMask=UIViewAutoresizingFlexibleHeight;
[(UIScrollView* )[[web
subviews]objectAtIndex:0]setBounces:NO];
web.scalesPageToFit =NO;
web.delegate =self;
[ms
addSubview:web];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
CGRect frame = webView.frame;
frame.size.height =
1;
webView.frame = frame;
CGSize fittingSize = [webView
sizeThatFits:CGSizeZero];
frame.size = fittingSize;
webView.frame = frame;
// frame 根据实际需求来写
[ms setContentSize:CGSizeMake(320,webView.frame.size.height+self.gamemodel.appTesks.count*51+30+22)];
}
web=[[UIWebView
alloc]initWithFrame:CGRectMake(5, imageView.frame.origin.y+imageView.frame.size.height,
310, 0)];
web.userInteractionEnabled =NO;
NSString* url=self.gamemodel.appIntroduce;
NSURLRequest* re=[[NSURLRequest
alloc]initWithURL:[NSURL
URLWithString:url]];
[web loadRequest:re];
web.autoresizingMask=UIViewAutoresizingFlexibleHeight;
[(UIScrollView* )[[web
subviews]objectAtIndex:0]setBounces:NO];
web.scalesPageToFit =NO;
web.delegate =self;
[ms
addSubview:web];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
CGRect frame = webView.frame;
frame.size.height =
1;
webView.frame = frame;
CGSize fittingSize = [webView
sizeThatFits:CGSizeZero];
frame.size = fittingSize;
webView.frame = frame;
// frame 根据实际需求来写
[ms setContentSize:CGSizeMake(320,webView.frame.size.height+self.gamemodel.appTesks.count*51+30+22)];
}
相关文章推荐
- Web中模态对话框加载后根据加载内容动态改变其大小并使其居中
- UIWebView 更改加载内容里面的字体大小
- UIWebView 更改加载内容里面的字体大小
- CSS根据用户需求设置网页字体大小
- Web中模态对话框加载后根据加载内容动态改变其大小并使其居中
- [WPF]根据内容自动设置大小的RichTextBox
- Android之WebView——解决加载Https以及根据网页动态设置WebView高度等难题
- 3.1 Javascript:探索客户端-设置网页元素根据窗口比例调整位置与大小
- UIWebView 加载js内容 设置宽度自动换行
- FF中span设置大小无效,只根据内容变化大小解决办法
- 计算UIWebView加载的网页内容高度
- 手机端网页所有内容根据屏幕大小自适应(大小,位置)
- CSS 怎么设置div的宽度根据里面的内容大小的变化
- UIWebView 更改加载内容里面的字体大小
- 根据用户使用的是iphone还是ipad来设置显示内容的大小
- ios开发点滴-UILable 根据文字内容进行大小设置 sizeThatFits和sizeToFit
- 根据字符串内容动态设置UILabel大小
- UIWebView中加载HTML的Table,td设置百分比宽度并且宽度不被里面的内容撑开
- Web中模态对话框加载后根据加载内容动态改变其大小并使其居中
- iOS-UIWebView加载html,文字大小颜色设置,图片自适应设置