Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

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

凡ミスメモ。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を代入してたんですよね・・・今までちゃんと動いてたのは、たまたまだったようです。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
1
Help us understand the problem. What are the problem?