gpt4 book ai didi

ios - SWReveal 的问题(滑动菜单)

转载 作者:行者123 更新时间:2023-11-30 12:26:47 25 4
gpt4 key购买 nike

我的以下代码有问题:

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”时什么也没有出现,在选择另一个选项后,我出现了上面的内容,依此类推

这是其他viewController的代码

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

关于ios - SWReveal 的问题(滑动菜单),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44094338/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com