我有一個應用程序,使用菜單滑塊,並在菜單底部有一行用戶登出this is how the menu looks like。我很難想出一種方法將用戶登錄到我的啓動畫面this is how my storyboard looks like。正確的方法來處理從表格行註銷
我想達成什麼
當用戶點擊菜單中的註銷行,我想執行日誌與[PFUser退出];(我用解析作爲後端)並返回我的啓動畫面,使用storyboard id實例化splash視圖或執行手動模式segue或以某種方式神奇地調用來自應用程序委託的視圖。
什麼我試圖
我嘗試了[PFUser註銷]和執行手動SEGUE到這樣的cellForRowAtIndexPath方法。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = [self.menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (indexPath.row == 5) {
[PFUser logOut];
[self performSegueWithIdentifier:@"logOutSegue" sender:self];
}
return cell;
}
我能夠註銷用戶,並顯示我的啓動畫面,但是這是我點擊菜單鍵進行儘快登錄用戶(因爲indexPath.row == 5所有的時間)。
2問題
如果我曾嘗試是正確的方式,我怎麼能當用戶點擊菜單中的註銷行認? 如果這不是正確的方法,那麼解決這個問題的有效方法是什麼?
如果有人能幫助我解決這個問題,我會非常感激。
Waow我只是做了完全相同的事情[這是我的想法](http://www.appcoda.com/how-to-handle-row-selection-在-的UITableView /)。除此之外,我還必須將註銷行中的segue添加到我的splash菜單中。謝謝。 – Matt