SWReveal 的问题(幻灯片菜单)
Problems with SWReveal ( Slide menu)
我对以下代码有疑问:
class VCParticipanteMenu: UIViewController,UITableViewDelegate,UITableViewDataSource
{
var menuNameArr:Array = [String]()
var iconeImage:Array = [UIImage]()
override func viewDidLoad() {
super.viewDidLoad()
menuNameArr = ["Inicio","Actividades","Información","Mapa","Comunicación","Perfil","FeedBack!","Cerrar Sesión"]
iconeImage = [UIImage(named: "Inicio")!,UIImage(named: "eventos")!,UIImage(named: "informacion")!,UIImage(named: "mapa")!,UIImage(named: "comunicacion")!,UIImage(named: "perfil")!,UIImage(named: "feedback")!,UIImage(named: "cerrarSesion")!]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuNameArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TVCParticipanteMenu") as! TVCParticipanteMenu
cell.imgIcon.image = iconeImage[indexPath.row]
cell.lblView.text = menuNameArr[indexPath.row]
print(cell.lblView.text!)
return cell
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
let revealViewController:SWRevealViewController = self.revealViewController()
let cell:TVCParticipanteMenu = tableView.cellForRow(at: indexPath) as! TVCParticipanteMenu
print(cell.lblView.text!)
if cell.lblView.text! == "Inicio"
{
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "VCParticipante") as! VCParticipante
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController.pushFrontViewController(newFrontViewController, animated: true)
}
if cell.lblView.text! == "Actividades"
{
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "VCParticipanteAct") as! VCParticipanteAct
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController.pushFrontViewController(newFrontViewController, animated: true)
}
}
一切正常,但在选择 "Inicio" 或 "Actividades" 时什么也没有出现,在选择另一个选项后我出现上面的等等
这是其他viewControllers的代码
import UIKit
class VCParticipante: UIViewController {
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
和
import UIKit
class VCParticipanteAct: UIViewController {
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
登录后所有这些...
这一行就是问题所在
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath)
didDeselectRowAt 到 didselectRowAt
我对以下代码有疑问:
class VCParticipanteMenu: UIViewController,UITableViewDelegate,UITableViewDataSource
{
var menuNameArr:Array = [String]()
var iconeImage:Array = [UIImage]()
override func viewDidLoad() {
super.viewDidLoad()
menuNameArr = ["Inicio","Actividades","Información","Mapa","Comunicación","Perfil","FeedBack!","Cerrar Sesión"]
iconeImage = [UIImage(named: "Inicio")!,UIImage(named: "eventos")!,UIImage(named: "informacion")!,UIImage(named: "mapa")!,UIImage(named: "comunicacion")!,UIImage(named: "perfil")!,UIImage(named: "feedback")!,UIImage(named: "cerrarSesion")!]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuNameArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TVCParticipanteMenu") as! TVCParticipanteMenu
cell.imgIcon.image = iconeImage[indexPath.row]
cell.lblView.text = menuNameArr[indexPath.row]
print(cell.lblView.text!)
return cell
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
let revealViewController:SWRevealViewController = self.revealViewController()
let cell:TVCParticipanteMenu = tableView.cellForRow(at: indexPath) as! TVCParticipanteMenu
print(cell.lblView.text!)
if cell.lblView.text! == "Inicio"
{
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "VCParticipante") as! VCParticipante
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController.pushFrontViewController(newFrontViewController, animated: true)
}
if cell.lblView.text! == "Actividades"
{
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "VCParticipanteAct") as! VCParticipanteAct
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController.pushFrontViewController(newFrontViewController, animated: true)
}
}
一切正常,但在选择 "Inicio" 或 "Actividades" 时什么也没有出现,在选择另一个选项后我出现上面的等等
这是其他viewControllers的代码
import UIKit
class VCParticipante: UIViewController {
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
和
import UIKit
class VCParticipanteAct: UIViewController {
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
登录后所有这些...
这一行就是问题所在
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath)
didDeselectRowAt 到 didselectRowAt