Upravit

Sdílet prostřednictvím


HealthKitUI Namespace

The HealthKitUI namespace provides the ActivityRingView that displays HealthKit information.

Classes

HKActivityRingView

A UIView that shows the data in a T:HealthKit.HKSummary.

HKActivityRingView.HKActivityRingViewAppearance

Appearance class for objects of type HKActivityRingView.

Remarks

Developers can set the values within the HKActivityRingView using a HKActivitySummary object, as shown in the following example:

var view = new HKActivityRingView (new CGRect (10, 10, 200, 200));

var summary = new HKActivitySummary ();
//Outer ring (Red)
summary.ActiveEnergyBurnedGoal = HKQuantity.FromQuantity (HKUnit.Kilocalorie, 200.0);
summary.ActiveEnergyBurned = HKQuantity.FromQuantity (HKUnit.Kilocalorie, 150.0);

//Middle ring (Green)
summary.AppleExerciseTime = HKQuantity.FromQuantity (HKUnit.Hour, 0.5);
summary.AppleExerciseTimeGoal = HKQuantity.FromQuantity (HKUnit.Hour, 1.0);

//Inner ring (Blue)
summary.AppleStandHours = HKQuantity.FromQuantity (HKUnit.Count, 2);
summary.AppleStandHoursGoal = HKQuantity.FromQuantity (HKUnit.Count, 8);