关于ios:为什么这个演员不需要ARC下的桥接?

why does this cast require no bridging under ARC?

为什么将CGImageRef强制转换为对象指针不需要内存管理信息(uu Bridge等)?例如,如果image是uiimage*类型,而layer是uiview的底层,那么下面的代码行不会引起编译器的任何投诉:

1
layer.content = (id)[image CGImage];

引用转换为ARC发行说明:

The Compiler Handles CF Objects Returned From Cocoa Methods

The compiler understands Objective-C methods that return Core Foundation
types follow the historical Cocoa naming conventions (see Advanced
Memory Management Programming Guide). For example, the compiler knows
that, in iOS, the CGColor returned by the CGColor method of UIColor is
not owned. You must still use an appropriate type cast, as illustrated
by this example...

(好吧,不太像可可味,但是嘿!).

因为cgimage返回corefundation对象,所以不需要__bridge强制转换。