LoginSignup
0
2

More than 3 years have passed since last update.

UIViewのtransform3Dは実はiOS12では使えない

Last updated at Posted at 2020-06-16

iOS12からtransform3Dが追加されました。z軸回転アニメーションも出来る凄いやつです。

image.png

さて、こんなtransform3DですがiOS12では使えません。

え??

image.png

いやいやいやいや

image.png

ビルド通るし…

スクリーンショット 2020-06-16 12.32.36.png

エッ…!?

Terminating app due to uncaught exception 'NSInvalidArgumentException'
 reason: '-[UIView setTransform3D:]: unrecognized selector sent to instance 0x7fb8a3404790'

意訳:setTransform3Dなんて知らないから例外で落としたよ

何が起きてるの?

わからないけど、多分setTransform3Dの実装が公開されてないけどavailableが付けられてしまった…?
前にもSceneKitかなにかでリリース前のiOSバージョンのavailableが付いていたりしたのでこのあたりは結構ガバガバなのかもしれない。

ちなみに内部的には -(void)_setTransform3D:(CATransform3D)arg1 ;というのが存在しているので、実装自体はありそう。
https://developer.limneos.net/index.php?ios=12.1&framework=UIKitCore.framework&header=UIView.h

iOS13では問題なく動作します。ランタイムでしか気がつけないバグでした。
もしかしたらiOS12.3とか途中から使えるようになっているかもしれないです。情報お持ちの方はコメントくださいmm

おまけ

view.perform(Selector("_setTransform3D:"), with: CATransform3DIdentity)
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2