2016-09-20 2 views
2

Est-ce que quelqu'un sait comment utiliser UIImpactFeedbackGenerator avec l'objectif c dans iOS? Je ne trouve aucun exemple nulle part. J'utilise un cadre qui nécessite l'objectif c, donc il ne peut pas être rapide.Comment utiliser UIImpactFeedbackGenerator avec l'objectif c?

Merci, Scott

+0

Bonne discussion ici: https://www.hackingwithswift.com/example-code/uikit/how-to-generate-haptic- feedback-with-uifeedbackgenerator – matt

+1

J'ai vu que malheureusement le moteur/framework que j'utilise n'utilise pas swift :( –

+0

Donc traduisons-le en Objective-C Je ne comprends vraiment pas quel est le problème – matt

Répondre

4

I figured it out

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

Note: iPhone 7/7+ ou plus récent – akaDuality