LoginSignup
1
1

More than 5 years have passed since last update.

iOS 12の実機でのみ半透明白色がdrawRectでうまく描画できない

Last updated at Posted at 2018-10-18

凡ミスメモ。UIView#drawRectでUIGraphicsGetCurrentContext()からCGContextを取得し、半透明の白色で矩形を塗りつぶすなどしていた箇所が、不透明の白になる問題に遭遇。

理由がわからずiOS 12のバグ?とよくやる「人のせいと考える罠」にはまりかけたんですが、やっぱり私のバグでした。

let color = UIColor(red: 255.0, green: 255.0, blue: 255.0, alpha: 0.5)

とまあ、red, green, blueパラメータに1.0じゃなく255.0を代入してたんですよね・・・今までちゃんと動いてたのは、たまたまだったようです。

1
1
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
1
1