0

I'm using Fabric and TwitterKit to show a timeline at my Table View. At my code I'm using a dispatch_async function. I want to start the MBProgressHUD and after the timeline was loaded I want to disable the HUD. Unfortunately my HUD is appearing only for less than one second and the timeline is appearing about two seconds later. No matter how good or bad my internet connection is. I want to show the HUD as long as the timeline is loading.

This is my code:

override func viewDidLoad() {

    super.viewDidLoad()

    let ProgressHUD = MBProgressHUD.showHUDAddedTo(self.view, animated: true)

    self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

    let client = TWTRAPIClient()

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)) {

        self.dataSource = TWTRUserTimelineDataSource(screenName: "fabric", APIClient: client)

        self.showTweetActions   =   true

        //Dark Timeline Theme
        TWTRTweetView.appearance().theme  =   .Dark
        TWTRTweetView.appearance().linkTextColor = UIColor.redColor()

        dispatch_async(dispatch_get_main_queue()) {

            ProgressHUD.hide(true)

        }
    }

}
Melissa Avery-Weir
  • 1,357
  • 2
  • 16
  • 47
paawl
  • 3
  • 2

2 Answers2

0

I've done the same as:

MBProgressHUD.showHUDAddedTo(self.view, animated: true)  //for showing
MBProgressHUD.hideHUDForView(self.view, animated: true)  //for hiding

No need of that ProgressHud variable.

Fayza Nawaz
  • 2,256
  • 3
  • 26
  • 61
  • You are right, but that has nothing to do with my problem. It changes nothing if I do it that way. – paawl Nov 25 '15 at 07:07
0

Well, i changed the framework to JGProgressHUD. It's working perfectly. No more problem here! Thank you for your help –

paawl
  • 3
  • 2