AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

fmx + TTrackbar + Ios + Taptic Feedback

Ein Thema von areyoudoneyet · begonnen am 8. Jun 2023 · letzter Beitrag vom 11. Jun 2023
Antwort Antwort
areyoudoneyet

Registriert seit: 25. Apr 2023
18 Beiträge
 
Delphi 11 Alexandria
 
#1

AW: fmx + TTrackbar + Ios + Taptic Feedback

  Alt 10. Jun 2023, 02:29
Code:
import SwiftUI

struct ContentView: View {
   
    @State private var testValue: Double = 0
    var body: some View {
        VStack {
            Slider(value: $testValue,in:-100...100, step:1)
        }
        .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
hm Also das ist schon Standart verhalten von Slidern in iOS.
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
4.239 Beiträge
 
Delphi 12 Athens
 
#2

AW: fmx + TTrackbar + Ios + Taptic Feedback

  Alt 11. Jun 2023, 08:39
Vielleicht funktioniert das so in der Art bei Dir:

Delphi-Quellcode:
uses
     Macapi.ObjectiveC
  // Macapi.CoreFoundation
  , Macapi.ObjCRuntime
  // iOS
  , iOSapi.CocoaTypes
  , iOSapi.Foundation
  ;

type
    TVibrate_Haptic_Feedback = (Weak, Medium, Strong);
    TVibrate_Haptic = class

        // Haptic Vibrate feedback generation
        // UIImpactFeedbackStyleLight, UIImpactFeedbackStyleMedium, UIImpactFeedbackStyleHeavy
        class procedure Execute(const AFeedback : TVibrate_Haptic_Feedback);

    end;





implementation

Uses
    Macapi.CoreFoundation
  ;

const
  UIImpactFeedbackStyleLight = 0;
  {$EXTERNALSYM UIImpactFeedbackStyleLight}
  UIImpactFeedbackStyleMedium = 1;
  {$EXTERNALSYM UIImpactFeedbackStyleMedium}
  UIImpactFeedbackStyleHeavy = 2;
  {$EXTERNALSYM UIImpactFeedbackStyleHeavy}

type
  UIImpactFeedbackStyle = NSInteger;

  UIFeedbackGeneratorClass = interface(NSObjectClass)
  ['{6B7EC779-C032-4F7A-B51B-BAF0E4249CE6}']
  end;

  UIFeedbackGenerator = interface(NSObject)
    ['{5EFF0FE8-F7F1-4443-90B0-94B69C6F9F01}']
    procedure prepare; cdecl;
  end;
  TUIFeedbackGenerator = class(TOCGenericImport<UIFeedbackGeneratorClass, UIFeedbackGenerator>) end;

  UIImpactFeedbackGeneratorClass = interface(NSObjectClass)
  ['{4AD834AB-9CC2-43F2-891B-F0BDD4F03732}']
  end;

  UIImpactFeedbackGenerator = interface(UIFeedbackGenerator)
  ['{8BFE603E-FFBC-4109-9AAE-62F77ED4CD57}']
  function initWithStyle(style: UIImpactFeedbackStyle): Pointer; cdecl;
  procedure impactOccurred; cdecl;
  end;
  TUIImpactFeedbackGenerator = class(TOCGenericImport<UIImpactFeedbackGeneratorClass, UIImpactFeedbackGenerator>) end;



// Haptic Vibrate generation
// UIImpactFeedbackStyleLight, UIImpactFeedbackStyleMedium, UIImpactFeedbackStyleHeavy
class procedure TVibrate_Haptic.Execute(const AFeedback : TVibrate_Haptic_Feedback);
var
  vibrationFeedback: UIImpactFeedbackGenerator;
begin
  vibrationFeedback := TUIImpactFeedbackGenerator.Wrap(TUIImpactFeedbackGenerator.OCClass.alloc);
  case AFeedback of
    Weak : vibrationFeedback.initWithStyle( UIImpactFeedbackStyleLight);
    Medium: vibrationFeedback.initWithStyle( UIImpactFeedbackStyleMedium);
    Strong: vibrationFeedback.initWithStyle( UIImpactFeedbackStyleHeavy);
    else
            vibrationFeedback.initWithStyle( UIImpactFeedbackStyleMedium);;
  end;

  vibrationFeedback.impactOccurred;
end;

Geändert von Rollo62 (12. Jun 2023 um 05:53 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz