我目前正在使用ECSlidingViewController
示例,并且在打开我目前所处的相同视图时遇到了一个小错误。
例如,如果我在GudjonDaneil
内并打开“抽屉”并再次点击GudjonDaniel
,则viewDidLoad方法会调用两次,如果我再次打开它,它会连续3次调用viewDidLoad 。看起来这些观点相互叠加。一旦我再次打开视图,我就需要杀死类(视图)。
点击-UItableView
NSLog(@"Channel 1 Loading");
tableViewCellLoading = true;
[self.slidingViewController anchorTopViewOffScreenTo:ECRight animations:nil onComplete:^{
CGRect frame = self.slidingViewController.topViewController.view.frame;
self.slidingViewController.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"firstChannel"];
self.slidingViewController.topViewController.view.frame = frame;
[self.slidingViewController resetTopView];
[tableView deselectRowAtIndexPath:indexPath animated:YES]; }];
抽屉应用程序如何显示
答案 0 :(得分:0)
我知道自问这个问题以来已经有一段时间了......但是对于正在寻找的其他人来说,这是一个答案。
以下内容来自我的" MenuController.m"文件。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.slidingViewController.topViewController.view.layer.transform = CATransform3DMakeScale(1, 1, 1);
UINavigationController *currentNav = (UINavigationController *)self.slidingViewController.topViewController;
UIViewController *theControllerYouWant = [currentNav.viewControllers objectAtIndex:([currentNav.viewControllers count]-1)];
NSString *CurrentSelectedCViewController = NSStringFromClass(theControllerYouWant.class);
if (indexPath.row == 1 && ![CurrentSelectedCViewController isEqualToString:@"PeopleTableViewController"]) {
[(UINavigationController *)self.slidingViewController.topViewController setViewControllers: [NSArray arrayWithObject: [self.storyboard instantiateViewControllerWithIdentifier:@"PeopleView"]]];
} else if (indexPath.row == 2 && ![CurrentSelectedCViewController isEqualToString:@"CompanyPickerController"]) {
[(UINavigationController *)self.slidingViewController.topViewController setViewControllers: [NSArray arrayWithObject: [self.storyboard instantiateViewControllerWithIdentifier:@"CompanyView"]]];
}
[self.slidingViewController resetTopViewAnimated:YES];
}
基本解释如下: