私はUITableView
に5つのスタティックセルを持っています。UITableViewCellでURLを開く方法
セルの1つをタップすると、特定のURLが開きます。各セルには固有のURLがあります。
どうすればいいですか?
Swift 3、Xcodeを使用しています。
ありがとうございます!
コード:
import UIKit
import Kingfisher
class SettingsTableView: UITableViewController {
@IBAction func clearCache(_ sender: Any) {
ImageCache.default.clearMemoryCache()
ImageCache.default.clearDiskCache()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
self.navigationController!.navigationBar.barTintColor = UIColor.black
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.hidesBarsOnTap = false
}
override var prefersStatusBarHidden: Bool {
return true
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
}
Use- 'オーバーライドのfuncのtableView(_のtableView:のUITableView、didSelectRowAt indexPath:IndexPath){//あなたのコード ... }私は理解していない@iDeveloper' – iDeveloper
。コードを返信してください。ありがとうございました。 – Miles
URLを開くには、tableViewCellをクリックしますか? – iDeveloper