0
我的表格视图菜单上有一个“登录”按钮。当用户触摸时,它会显示我需要的登录视图。当用户登录成功时,重新加载表视图以隐藏“登录”按钮并显示“帐户”按钮,反之亦然我需要重新加载一个表格视图菜单,当用户登录或登出SWIFT swreveal控制器?
我的表格视图菜单上有一个“登录”按钮。当用户触摸时,它会显示我需要的登录视图。当用户登录成功时,重新加载表视图以隐藏“登录”按钮并显示“帐户”按钮,反之亦然我需要重新加载一个表格视图菜单,当用户登录或登出SWIFT swreveal控制器?
我不明白你用按钮做什么。我和我的团队通常使用表单元格,就像菜单项一样。像这样的例子
我定义了一个菜单项数组
var menuItems = ["Sign in", "My abc", "My def"]
与代码功能标志,删除 “登录”,并添加“我的帐户”。在我简单的例子,我用didSelectRowAtIndex并勾选“登录”菜单
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// sign in item
if indexPath.row == 0 && menuItems[0] == "Sign in" {
let alert = UIAlertController(title: "Signing in", message: "Press OK to sign in", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (UIAlertAction) -> Void in
self.menuItems.removeAtIndex(0)
self.menuItems.insert("My Account", atIndex: 0)
tableView.reloadData()
}))
presentViewController(alert, animated: true, completion: nil)
}
}
希望这有助于。
谢谢你解决我的问题 –
什么是“secessfull relead”? –