1

I am working on apple watch application where i am using the network class for showing the data on apple watch.I want to show the activity indicator when the data is fetching after the successfully fetching the data then hide the activity indicator.Please help me out.

3 Answers3

1

WatchKit doesn't have any structure like UIActivityIndicatorView,but you can create your own animation with images.

If your WKInterfaceController awailable to add WKInterfaceImage add it and use WKInterfaceImage's method to animate. If not, then push a WKInterfaceController and make request here.

This tutorial is one of my best, follow it.

I used JBWatchActivityIndicator on github to create sequence images.

Gürhan KODALAK
  • 570
  • 7
  • 20
0

use this code to show activity indicator

UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc]     
        initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

    activityView.center=self.view.center;
    [activityView startAnimating];
    [self.view addSubview:activityView];

Checkout the JBWatchActivityIndicator project on GitHub that lets you generate your own image sequences: https://github.com/mikeswanson/JBWatchActivityIndicator

  • There is no method for displaying ActivityIndicator in WatchKit Framework. but you can try this https://github.com/timonus/WatchActivityIndicator –  May 23 '16 at 10:02
  • It only contains the GIF images. – Utkarsh Tiwari May 23 '16 at 10:14
  • there are not so many ways to show activity indicator in watchkit. so try to modify it according to your need you will succeed –  May 23 '16 at 10:25
0

There is no activityIndicator in WatchKit.so use WKInterfaceImage or WKInterfaceGroup show Indicator.

 image.setImageNamed(your_image_folder)
 image.startAnimatingWithImages(in: NSMakeRange(0, 39), duration: 1.0, repeatCount: 0)

Refer the like https://stackoverflow.com/a/60612980/9110213