AKSwiftSlideMenu activity indicator

83 views Asked by At

I am using the AKSwiftSlideMenu project from the web and trying to put an activity indicator so it will display the indicator when the user pressed the menu bars on the top right. I tried everything. is there a way once the user pressed the 3menubar at the top to display a activity indicator until the menu appear from the side.

I do some database processing to build the menu item before the slide out.

1

There are 1 answers

0
Idan On

Since AKSwiftSlideMenu is using UINavigationController, you can just add UIActivityIndicator on the right side of the navigation controller.

Something like that:

func showActivityIndicator() {
    let activityIndicator = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
    let barButton = UIBarButtonItem(customView: activityIndicator)
    self.navigationItem.setRightBarButton(barButton, animated: true)
    activityIndicator.startAnimating()
}

Don't forget, you need to prevent the Segue from happening, and halt the program until you are done loading.