0
以下是由具有的tableview在它導航到一個UIWebView從UITableView的行選擇
我想告訴UIWebView的下一個頁面上我的第一個視圖控制器上的代碼。
import UIKit
class menuTableViewController: UITableViewController {
var menuNameArr:Array = [String]()
var iconeImage:Array = [UIImage]()
var urlstring:Array = [URL]()
override func viewDidLoad() {
super.viewDidLoad()
menuNameArr = ["Anasayfa","Sınıf Listeleri","Ders Programı","Portal","Mesaj","Hesabım","İletişim","Paylaş","Hesaptan Çıkış"]
iconeImage = [UIImage(named: "anasayfa")!,
UIImage(named: "sinif")!,
UIImage(named: "ders")!,
UIImage(named: "portal")!,
UIImage(named: "mesaj")!,
UIImage(named: "hesabim")!,
UIImage(named: "iletisim")!,
UIImage(named: "paylas")!,
UIImage(named: "hesap")!]
urlstring = [URL(string:"http://sinifdefterim.com/portal.aspx")!,
URL(string:"http://sinifdefterim.com/siniflistesi.aspx")!]
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuNameArr.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "menuTableViewCell") as! menuTableViewCell
cell.imgIcon.image = iconeImage[indexPath.row]
cell.lblMenuName.text! = menuNameArr[indexPath.row]
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier:"ssss", sender: urlstring[indexPath.row])
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destinationNavigationController = segue.destination as! UINavigationController
let mainVC:ViewController = destinationNavigationController.topViewController as! ViewController
mainVC.mainURL = sender as! URL
}
}
如何在下一個viewcontroller上的webview上打開選定的網址? 任何幫助讚賞
到底哪裏出問題了,你應該解釋在身體您的問題,不只是發佈了一堆代碼 – Simon