![]() ![]() You might be working with multiple CALayer subclasses (see Chapter 6, “Specialized Layers”) and have no desire to create new UIView subclasses to host them all.You might be writing cross-platform code that will also need to work on a Mac.You might still want to use a hosted CALayer instead of a layer-backed UIView in a real-world application for a few reasons, however: The benefit of using a layer-backed view instead of a hosted CALayer is that while you still get access to all the low-level CALayer features, you don’t lose out on the high-level APIs (such as autoresizing, autolayout, and event handling) provided by the UIView class. (In Mac OS 10.8, the performance of NSView is greatly improved, as well.) But the lightweight UIView class in iOS barely has any negative impact on performance when working with layers. On Mac OS, prior to version 10.8, a significant performance penalty was involved in using hierarchies of layer-backed views instead of standalone CALayer trees hosted inside a single view. Although it is possible to add layers in this way, more often than not you will simply work with views and their backing layers and won’t need to manually create additional hosted layers. As Listing 1.1 shows, you can explicitly create standalone layers and add them directly as sublayers of the backing layer of a view. ![]() layer view has only one backing layer (created automatically) but can host an unlimited number of additional layers. create sublayer CALayer *blueLayer = īlueLayer. Adding a Blue Sublayer to the View #import "ViewController.h" #import ViewController ( nonatomic, weak) IBOutlet UIView ViewController You can create a CGColor directly using Core Graphics methods if you prefer, but using UIColor saves you from having to manually release the color when you no longer need it. The CALayer backgroundColor property is of type CGColorRef, not UIColor like the UIView class’s backgroundColor, so we need to use the CGColor property of our UIColor object when setting the color. A small blue CALayer nested inside a white UIView Performs an Android runtime-checked type conversion.Figure 1.5. IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniIdentityHashCode(Int32) Some other thread interrupts the current thread, or a certain #notifyAll() method for this object, or a #notifyAll() method for this object.Ĭauses the current thread to wait until either another thread invokes the Returns a string representation of the object.Ĭauses the current thread to wait until another thread invokes the Wakes up all threads that are waiting on this object's monitor. Wakes up a single thread that is waiting on this object's Returns a hash code value for the object.Ĭalled by the garbage collector on an object when garbage collectionĭetermines that there are no more references to the object. Indicates whether some other object is "equal to" this one. The absolute or relative dimension for this Description.Ĭreates and returns a copy of this object. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. The handle to the underlying Android instance. Returns the runtime class of this Object. Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.Īnimation.Description(IntPtr, JniHandleOwnership)Ī constructor used when creating managed representations of JNI objects called by the runtime. ![]()
0 Comments
Leave a Reply. |