求大神解答!!!Swift WebView 页面被放大,无法正确显示网页尺寸~~~

Old-Summer 2015-06-08 11:12:48
我就用swift 做了一个最简单的webview,加载的网页大小是640*960px的,模拟器也调成了iph 4s的模式,显示网页却被放大,刚开始接触不知道怎么改,过两天有急用,望大神帮帮忙!感激不尽!!!
ViewController:

//
// ViewController.swift
// Fuer
//
// Created by Summer. on 15/6/8.
// Copyright (c) 2015年 Summer. All rights reserved.
//

import UIKit

class ViewController: UIViewController {


@IBOutlet weak var wv: UIWebView!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
wv.loadRequest(NSURLRequest(URL: NSURL(string: "http://127.0.0.1:8080/fuwuwaibao/mobile.jsp")!))


}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}



}




<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
*{
margin: 0;
padding: 0;
}
body{
margin: 0;
padding: 0;
width:640px;
height:960px;
}
.main {
width:640px;
height:960px;
overflow: hidden;
background-image: url(bg.jpg);
}
ul.message-box {
width: 640px;
height: 600px;

margin-top: 200px;
}
li.message-item {
width: 640px;
height: auto;
padding-left: 55px;
padding-right: 55px;
margin-top: 20px;
text-align: left;
font-size: 16px;
color: #999;
}
</style>


<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$().ready(function(){
setInterval(function(){
$.getJSON("GetMsgServlet?flag=mo",function(data){
$(".message-box").prepend(
"<li class='message-item'><span class='time'>"+
data.message.msg_time+
"  </span>"+
data.message.msg_company+
"</li>");
});

},1000);
});
</script>


</head>
<body>
<div class="main">
<ul class="message-box">
<li class="message-item"><span class="time">12:45  </span>菊花实业集团回复了你的简历</li>
<li class="message-item"><span class="time">12:45  </span>菊花实业集团回复了你的简历</li>
<li class="message-item"><span class="time">12:45  </span>菊花实业集团回复了你的简历</li>

</ul>
</div>
</body>
</html>


xcode中的界面


模拟器中


浏览器中正常尺寸
...全文
177 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

29,031

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧