I'm ultimating a chat into my app but i still have this issue. As you can see i have a ChatListTableViewController with the list of all the active chats(picture 1, top-left view). When i click on a cell i successfully open che ChatViewController with the NavBar displaying the name of the person whom i chat with ,the back arrow and a trash button to delete the chat. However, in the ChatListTableViewController i have a "+" button (picture 1, top-left) which opens a PopUpViewController: this one allows you to start a new chat with a user,chosen from a TableView. The issue as you can see from picture 1 ,is that when i click on a cell in the PopUpChatListViewController, i try to initialize a ChatViewController and it opens but the NavigationBar is hidden.This is done by using the function "didSelectRowAt" of the TableView. I post you the code of the PopUpChatListViewController. In the viewDidLoad of the ChatViewController i tryied to put set "navigationBar.isHidden = false " but nothing. Can you explain me what's happening here ?
import UIKit
class PopUpChatListViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var tableView: UITableView!
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return userName.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCell(withIdentifier: "cellPopUp", for: indexPath)
cell.textLabel?.text = userName[indexPath.row]
return cell
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
UserDefaults.standard.set(userID[indexPath.row], forKey: "chatID")
let vc = self.storyboard?.instantiateViewController(withIdentifier: "ChatActivity") as! ChatViewController
self.present(vc, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.black.withAlphaComponent(0.6)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
VIEW OF THE SCREENSHOTS RUNNING APP:
MAIN STORYBOARD SCHEME: