• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CALayer kCAGravityResizeAspectFill and kCAGravityTop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CALayer kCAGravityResizeAspectFill and kCAGravityTop


  • Subject: CALayer kCAGravityResizeAspectFill and kCAGravityTop
  • From: Torsten Curdt <email@hidden>
  • Date: Wed, 21 Sep 2016 20:18:21 +0200

On iOS I want to fill a layer with an image.
The width should be filled and the image should retain its aspect ratio.
This

        layer.contents = image.cgImage
        layer.contentsGravity = kCAGravityResizeAspectFill

almost does the right thing - but it positions the image at the centers.
I would like to have it positioned at the top.

While looking at the docs for CALayer I found "autoresizingMask" but that
seems to be macOS only.

Any pointers?

cheers,
Torsten
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: CALayer kCAGravityResizeAspectFill and kCAGravityTop
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: How to update UI from a background thread
  • Next by Date: Re: CALayer kCAGravityResizeAspectFill and kCAGravityTop
  • Previous by thread: Re: How to update UI from a background thread
  • Next by thread: Re: CALayer kCAGravityResizeAspectFill and kCAGravityTop
  • Index(es):
    • Date
    • Thread