ios - Use NS[UI]ScrollView to manipulate projection -


i have simple metal setup draw image in middle of mtkview. wish add pinch zoom , other functionality have in scroll views, can zoom image , move around thresholds.

i don't want implement myself since app live in both mac os , ios , twice more code support , write.

is there way use default scroll view controlls manipulate projection? mean set scroll view somehow on top of view , data in delegate manner or whatever.

any appreciated!

you may want try metal2dscrollable sample code. idea that:

  1. place mtkview behind (not subview) uiscrollview,
  2. place dummy content view subview of uiscrollview
  3. make dummy content view target of zooming
  4. set uiscrollview such contentsize, contentinset etc.
  5. make both uiscrollview , dummy content view transparent
  6. calculate transform dummy content view's bounds -> mtkview's coordinate -> device coordinate
  7. apply transform when rendering metal

so, mtkview not in uiscrollview, tricks fools user's eyes.

https://github.com/codelynx/metal2dscrollable

the same technique may work macos tweaks, haven't tried.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -