我有一个应用程序,使用菜单滑块,并在菜单底部有一行用户登出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