Search code examples
iosios10vibration

How to use UIImpactFeedbackGenerator with objective c?


Does any one know how to use UIImpactFeedbackGenerator with objective c in iOS? I cannot find any examples anywhere. I am using a framework that requires objective c, so it cannot be swift.

Thanks, Scott


Solution

  • I figured it out

    UIImpactFeedbackGenerator *myGen = [[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)];
    [myGen impactOccurred];
    myGen = NULL;