ポイントモード

CGPoint

didReceivePoint

実装例

Swift

import UIKit

class ViewController: UIViewController, CRApplicationDelegate {

  var ringApp: CRApplication!

  override func viewDidLoad() {
    super.viewDidLoad()

    ringApp = CRApplication(delegate:self, background: false)
    ringApp.start()
  }

  func didReceiveEvent(event: CRRingEvent) {
    if event == .LongPress {
      print("LongPress")
      ringApp.setRingMode(.Point)
    }
  }

  func didReceivePoint(point: CGPoint) {
    print(point)
  }

  func didReceiveQuaternion(quaternion: CRQuaternion) {
  }

  func didReceiveGesture(identifier: String!) {
  }

  func deviceDidInitialize() {
    ringApp.setRingMode(.Point)
  }

  func deviceDidDisconnect() {
  }
}

Objective-C

#import "ViewController.h"
#import <CoreRing/CoreRing.h>

@interface ViewController () <CRApplicationDelegate>
@property (nonatomic, strong) CRApplication *ringApp;
@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  self.ringApp = [[CRApplication alloc] initWithDelegate:self background:NO];
  [self.ringApp start];
}

- (void)didReceiveEvent:(CRRingEvent)event {
  if (event == CRRingEventLongPress) {
    NSLog(@"LongPress");
    [self.ringApp setRingMode:CRRingModePoint];
  }
}

- (void)didReceivePoint:(CGPoint)point {
  NSLog(@"%@", NSStringFromCGPoint(point));
}

- (void)didReceiveQuaternion:(CRQuaternion)quaternion {
}

- (void)didReceiveGesture:(NSString *)identifier {
}

- (void)deviceDidInitialize {
  [self.ringApp setRingMode:CRRingModePoint];
}

- (void)deviceDidDisconnect {
}

@end

<イベントモード     |     TOP     |     クォータニオンモード>