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」? –