I tryed to google that term, "g 2 separate evaluation". Whats that?
Post not yet marked as solved
Yes i did. But nothing happens. Its still a navigation bar with a 1 pixel grey line instead of a colored line.
Post not yet marked as solved
Nothing happens. I dont know if i have to link the navigation bar in the Storyborad to the ViewController.
Its around 0 degrees celsius here in Sweden now. Where are you based?Omg you solved my problem. I used your code below. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let id = sections[indexPath.section].menytitel[indexPath.row]
self.performSegue(withIdentifier: id, sender: self)
} But I had to add a ! after that segue string, like this:import Foundation
struct Section {
var genre: String!
var menytitel: [String]!
var menuSegues: [String]!
var expanded: Bool!
init(genre: String, menytitel: [String], expanded: Bool) {
self.genre = genre
self.menytitel = menytitel
self.expanded = expanded
}
}/ Fredrik
Okey thank you.I will test your first solution first, but I dont understand what you meen with this?call performSegue withy the relevant identifier read from section, corresponding to menuTitle menytitel[x]But i tried somtehing likte this after I google it.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 tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.performSegue(withIdentifier: "USA", sender: self)
}
Sorry for my name menytitel. Meny is menu in swedish.Here is my ExpandableHeaderViewimport UIKit
protocol ExpandableHeaderViewDelegate {
func toggleSection(header: ExpandableHeaderView, section: Int)
}
class ExpandableHeaderView: UITableViewHeaderFooterView {
var delegate: ExpandableHeaderViewDelegate?
var section: Int!
override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(selectHeaderAction)))
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func selectHeaderAction(gestureRecognizer: UITapGestureRecognizer) {
let cell = gestureRecognizer.view as! ExpandableHeaderView
delegate?.toggleSection(header: self, section: cell.section)
}
func customInit(title: String, section: Int, delegate: ExpandableHeaderViewDelegate) {
self.textLabel?.text = title
self.section = section
self.delegate = delegate
}
override func layoutSubviews() {
super.layoutSubviews()
self.textLabel?.textColor = UIColor.white
self.contentView.backgroundColor = UIColor.darkGray
}