Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed internal cache key from NSIndexPath -> NSString - this is to fix a very small intermittent bug where the cached VC is not found (when it is in the cache) #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions SASlideMenu/SASlideMenu/SASlideMenuRootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#define kMenuTableSize 280
#define kSwipeMinDetectionSpeed 0.1f

NSString * const cachingKeyFormat = @"%li,%li";


typedef enum {
SASlideMenuStateInitial,
Expand Down Expand Up @@ -407,7 +409,12 @@ -(void) panItem:(UIPanGestureRecognizer*)gesture{
}

-(UINavigationController*) controllerForIndexPath:(NSIndexPath*) indexPath{
return [controllers objectForKey:indexPath];
return [controllers objectForKey:[self getNSIndexPathKey:indexPath]];
}

-(NSString*)getNSIndexPathKey:(NSIndexPath*)indexPath
{
return [NSString stringWithFormat:cachingKeyFormat, indexPath.section, indexPath.row];
}

-(void) switchToContentViewController:(UINavigationController*) content completion:(void (^)(void))completion{
Expand Down Expand Up @@ -495,7 +502,7 @@ -(void) addContentViewController:(UIViewController*) content withIndexPath:(NSIn
disableContentViewControllerCaching = [self.leftMenu.slideMenuDataSource disableContentViewControllerCachingForIndexPath:indexPath];
}
if (!disableContentViewControllerCaching) {
[controllers setObject:content forKey:indexPath];
[controllers setObject:content forKey:[self getNSIndexPathKey:indexPath]];
}
}
}
Expand Down