This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| let rawValue = indexPath.section*100 + indexPath.row | |
| switch TableIndex(rawValue: rawValue) { | |
| case .a: | |
| // do something | |
| case .b: | |
| // do something | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| switch indexPath { | |
| case TableIndex.a: | |
| // do something | |
| case TableIndex.b: | |
| // do something | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if !DEBUG | |
| public func print(_ items: Any..., separator: String = " ", terminator: String = "\n") { } | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ini_set("max_execution_time", "300"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") ?? UITableViewCell(style: .value2, reuseIdentifier: "cell") | |
| cell.textLabel?.text = "left" | |
| cell.detailTextLabel?.text = "right" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") ?? UITableViewCell(style: .value1, reuseIdentifier: "cell") | |
| cell.textLabel?.text = "left" | |
| cell.detailTextLabel?.text = "right" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") ?? UITableViewCell(style: .subtitle, reuseIdentifier: "cell") | |
| cell.imageView?.image = UIImage(named: "2") | |
| cell.textLabel?.text = "title" | |
| cell.detailTextLabel?.text = "subTitle" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private func setWebView(_ data: String){ | |
| let jscript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);" | |
| let userScript = WKUserScript(source: jscript, injectionTime: .atDocumentEnd, forMainFrameOnly: true) | |
| let wkUController = WKUserContentController() | |
| wkUController.addUserScript(userScript) | |
| let wkWebConfig = WKWebViewConfiguration() | |
| wkWebConfig.userContentController = wkUController | |
| let infoWebview = WKWebView(frame: self.contentView.bounds, configuration: wkWebConfig) | |
| contentView.addSubview(infoWebview) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let index = IndexPath(row: 4, section: 0) | |
| if tableView.cellForRow(at: index) != nil { | |
| tableView.reloadRows(at: index, with: .automatic) | |
| } |
NewerOlder