Posts

Post not yet marked as solved
1 Replies
1.9k Views
I can’t figure out how to eliminate the header without showing up first using Webkit View. In this example the full page first show up before the two classes is removed. This is important to me, because this is the final thing I have to figure out before final testing. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) { webView.evaluateJavaScript("document.querySelector(’.Header’).remove();", completionHandler: { (response, error) -> Void in webView.isHidden = false                        webView.evaluateJavaScript("document.querySelector('#auto_page_titles-2').remove();", completionHandler: { (response, error) -> Void in webView.isHidden = false                               })                                                }                   )                   }                   }
Posted
by fstork.
Last updated
.
Post marked as solved
3 Replies
1k Views
I want to hide two classes, the header and one more or maybe multiple classes in webkit View. If i use them alone both will work. But can i combine them? Maybe like this? The (,) will not work. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) { webView.evaluateJavaScript("document.querySelector('.Header', '#auto_page_titles-2').remove();", completionHandler: { (response, error) -> Void in webView.isHidden = false }) } }
Posted
by fstork.
Last updated
.
Post not yet marked as solved
0 Replies
1.2k Views
Is this the right way to hide/erase/remove the header of a webpage in Webkit View? My headername should be HeaderWrapper in this example. But nothing happens.func webView(webView: WKWebView,didFinishNavigation navigation: WKNavigation){ webView.evaluateJavaScript("document.querySelector('.HeaderWrapper').remove();", completionHandler: { (response, error) -> Void in }) }
Posted
by fstork.
Last updated
.
Post not yet marked as solved
6 Replies
4.0k Views
I want to make a colored line under the navigation bar in my Xcode project (swift 5). I was inspired by this code. But I can't get it right.Here is my code and a picture.import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.navigationController?.addCustomBottomLine(color: UIColor.black, height: 20) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } extension UINavigationController { func addCustomBottomLine(color:UIColor,height:Double) { //Hiding Default Line and Shadow navigationBar.setValue(true, forKey: "hidesShadow") //Creating New line let lineView = UIView(frame: CGRect(x: 0, y: 0, width:0, height: height)) lineView.backgroundColor = color navigationBar.addSubview(lineView) lineView.translatesAutoresizingMaskIntoConstraints = false lineView.widthAnchor.constraint(equalTo: navigationBar.widthAnchor).isActive = true lineView.heightAnchor.constraint(equalToConstant: CGFloat(height)).isActive = true lineView.centerXAnchor.constraint(equalTo: navigationBar.centerXAnchor).isActive = true lineView.topAnchor.constraint(equalTo: navigationBar.bottomAnchor).isActive = true } }
Posted
by fstork.
Last updated
.
Post marked as solved
5 Replies
1.3k Views
I have a realy big problem i cant solve. How can I link the menu name "Canada" in my expandable table menu to a new View Controller named "Canada", and then the menu name "Denmark" to a View Controller named "Denmark" and so on in my Xcode-project? Maybe by using segues?import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, ExpandableHeaderViewDelegate { @IBOutlet weak var tableView: UITableView! var sections = [ Section(genre: "North America", menytitel: ["USA", "Canada"], expanded: false), Section(genre: "Europe", menytitel: ["Sweden", "Finland", "Denmark", "Ireland"], expanded: false), Section(genre: "Africa", menytitel: ["Egypt", "Marocko"], expanded: false), ] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. tableView.delegate = self tableView.dataSource = self } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func numberOfSections(in tableView: UITableView) -> Int { return sections.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return sections[section].menytitel.count } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 44 } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { if (sections[indexPath.section].expanded) { return 44 } else { return 0 } } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return 2 } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let header = ExpandableHeaderView() header.customInit(title: sections[section].genre, section: section, delegate: self) return header } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell")! cell.textLabel?.text = sections[indexPath.section].menytitel[indexPath.row] return cell } func toggleSection(header: ExpandableHeaderView, section: Int) { sections[section].expanded = !sections[section].expanded tableView.beginUpdates() for i in 0 ..< sections[section].menytitel.count { tableView.reloadRows(at: [IndexPath(row: i, section: section)], with: .automatic) } tableView.endUpdates() } }This is my section.swift fileimport Foundation struct Section { var genre: String! var menytitel: [String]! var expanded: Bool! init(genre: String, menytitel: [String], expanded: Bool) { self.genre = genre self.menytitel = menytitel self.expanded = expanded } }
Posted
by fstork.
Last updated
.