今天编写ios程序的时候遇到一个很奇怪的问题:
我单独建立一个工程的时候,uiview下加入一个uiscrollerview——uiwebview,
import UIKit
class ViewController: UIViewController {
@IBOutlet var detailWebView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if let url = NSURL(string: "http://www.baidu.com") {
let request = NSURLRequest(URL: url)
detailWebView?.loadRequest(request)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
可以正常显示载入的网页
但我在另外一个工程中加入该段代码,却产生错误,detailWebView为空,有待分析原因