mayakraft / Panorama

Spherical panorama view, iOS
MIT License
649 stars 135 forks source link

Just detect touch Swift 3 #58

Closed sonizef closed 7 years ago

sonizef commented 7 years ago

Hello, thank you for you very great work !

I've a little question, I'm work with SWIFT 3, I know how import your project on mine and everything works ! But when I try detect when the user touch the screen, nothing work ... :/

If I use your function :

"panoramaView?.touchesBegan(Set, with: UIEvent?)" in my viewDidLoad(), I've an error ...

May be I don't how it's work ... Can you help me ?

Thank you

sonizef commented 7 years ago

I found a solution !

First: Delete in PanaormaView.m all overrides functions you needs in Swift For exemple, here I delete -(void) touchesBegin:(NSSet )touches withEvent:(UIEvent )event

Second: In your GLKViewController you can create your override function (here toucheBegan)

-------- Here you can write all you want in Swift

Now it's for use touchInRect function

Third: Delete if statement in PanoramaView.m in TouchInRect function ( if(_numberOfTouches) ) Because now we can't have this var in our swift code

Four: Use function touch(in: CGRect) in your touchBegan function in your swift code !

I know, I think isn't the better or the properly solution but for now it's the only simple solution I found for do this.

Sorry for the confuse explain, but I'm French ...

I think rewrite all this code in Swift 3, but it's just a project for now ...