IOS Core Animation (Reading notes)--Homestay map

Source: Internet
Author: User

layer.contents = (__bridge id)image.CGImage;//如果你没有使用ARC(自动引用计数),你就不需要__bridge这部分。但是,你干嘛不用ARC?!

self.layerView.layer.contentsGravity = kCAGravityResizeAspect;//和cotentMode一样,contentsGravity的目的是为了决定内容在图层的边界中怎么对齐,我们将使用 kCAGravityResizeAspect,它的效果等同于UIViewContentModeScaleAspectFit, 同时它还能在图层中等比例拉伸以适应图层的边界。

UIView has a property called Clipstobounds that can be used to decide whether to show content beyond the bounds, calayer the corresponding property is called Maskstobounds, set it to Yes;

the Contentsrect property of Calayer allows us to display a subdomain of the homestay map in the layer border; The default contentsrect is {0, 0, 1, 1}, which means that the entire homestay map is visible by default, and if we specify a smaller rectangle, the picture will be cropped (2.6)

IOS Core Animation (Reading notes)--Homestay map

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.