Wednesday, December 7, 2016

Part 1 - UIView's Content Mode

I decided to go down and learn every property for the UIView on the Attributes Inspector. Part of the whole "leave nothing misunderstood" quest.

Content Mode

I think most of us know how this applies to the UIImageView control but what about just the UIView?

This took a lot of digging to understand this property.

Here are some things I've found out but none of which actually came from Apple:
  • For an image view, this is talking about the position/scaling of image.
  • For a UIView that draws its content, this is talking about the drawn content.
  • It does not affect the layout of subviews inside a UIView.

How is this property beneficial?

  • I won't go into how it is beneficial for a UIImageView. Most of you probably already know and if you don't then check out this great article.
  • Use this property when drawing a path and then handling how that path is then positioned/scaled when the UIView's bounds or frame changes.
  • The idea is to save processing time on redrawing when UIView's bounds change.


More Info from Apple

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

SwiftUI Search & Filter with Combine - Part 3 (iOS, Xcode 13, SwiftUI, 2...

In part 3 of the Searchable video series, I show you how to use Combine in #SwiftUI for the search and filter logic connected to the searcha...