teodorpatras / SideMenuController

A side menu controller written in Swift for iOS
MIT License
1.16k stars 289 forks source link

didSelectRowAtIndexPath Delegate / hide Slide Menu #15

Closed rary44 closed 8 years ago

rary44 commented 8 years ago

Hello

Is it possible to create the whole project programmatically (nib files without storyboard)?

i'm facing a problem with step 4 👍

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    sideMenuController?.embedCenterController(someUIViewControllerInstance)
}

When i select any cell [view controller] more than one time , it's shows the slide menu table quickly and it disappear , why is that ?

Regards

teodorpatras commented 8 years ago

Hi, can you upload an example project where you can reproduce this issue?

rary44 commented 8 years ago

SlideMenu.zip

Please Find it above

teodorpatras commented 8 years ago

this is an empty project.. i meant a project with some code that reproduces the issue...

rary44 commented 8 years ago

i upload it again please check it i think the problem with the animation

teodorpatras commented 8 years ago

First of all, thank you for a project that does not compile. The problem is not with the animation, the problem is with how you "architected" the code. You have an array of view controllers from which you exchange the view controllers among each other. The problem is as follows:

when you select the same index, you make a transition to the same view controller that is visible on screen (which btw, should not happen, you should put a guard indexPath != previousIndex else { return }) and because you pass in the same view controller that is already embedded to the function embed(centerViewController: the animation gets lost because there is one single view which should be animated both off and on screen.

Conclusion:

Don't embed the same controller that is already on screen.

P.S: update to version 0.1.3