evnaz / ENSwiftSideMenu

A simple side menu for iOS written in Swift.
MIT License
1.82k stars 282 forks source link

Showing progressHUD when selecting items from SideMenu #67

Open wraithseeker opened 9 years ago

wraithseeker commented 9 years ago

I got an app that takes about 2-3 seconds to load the new screen when an item from the sidemenu is clicked and I am using a progressBar library to try and display the loading process.

Problem is I do not know which methods am I supposed to show and hide the progress bar. I tried doing it in the same method as presenting the viewcontroller but unfortunately, it only shows the progressbar at the end of the presentation of the viewcontroller instead of immediately.

elsesiy commented 9 years ago

@wraithseeker Since each vc has its own lifecycle you need to register the progressHUD there. This has basically nothing to do with the slide menu. Check the view controller lifecycle for reference where to show/hide the progressHUD. A good place is usually, depending on if it takes that long only once or each time you select the item (I'd consider caching data somehow, 2-3 seconds seems a lot to me), viewDidAppear/ viewWillDisappear. If you need further help just let me know!