1

I want to put a loader so that user can know that chat is being loaded when he first time enter the chat box.

Abrar
  • 341
  • 5
  • 13
  • you have to add the indicator programatically and add that indicator view to collection view. when chat loaded disappear that indicator. – Muhammad Umair Apr 27 '17 at 07:58

1 Answers1

0

Define a global activity indicator in the view controller namely "userDefinedActivityIndicator"

Inside viewDidLoad() :

   self.userDefinedActivityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
    self.userDefinedActivityIndicator?.startAnimating()
    self.userDefinedActivityIndicator?.isHidden = false
    self.userDefinedActivityIndicator?.center = self.view.center

After receiving proper response,stop animating the activity Indicator and hide it then show the results.

Community
  • 1
  • 1
Nancy
  • 158
  • 2
  • 11