I have a problem with hosting a host initWithFrame: This version of the expected The 'core core animation layer' is selected in the interface builder:
- (id) initWithFrame: (NSRact) frame {works} (works full of black color) Self = [super initwithframe: frame]; If (self) {[Self setwikts: Yes]; [[Self Level] Setbackgram Color: CGColorGetConstantColor (KCGolorblock)]; [[Self Level] Set Content: [NSImage imageNamed: NSImageNameBonjour]]; } Healthy return; } I want to be able to configure the visual program so I want to remove dependency on the interface builder. Below is another version, which means to get it. This view does not work This view keeps the same color as the parents' view:
- (id) initWithFrame: (NSRact) frame {self = [super initWithFrame: frame]; If (self) {CALayer * rootLayer = [Cayayer layer]; // Added this line, [auto setlayer: root layer]; // and this line is only [self-satisfied: yes]; [[Self Level] Setbackgram Color: CGColorGetConstantColor (KCGolorblock)]; [[Self Level] Set Content: [NSImage imageNamed: NSImageNameBonjour]]; } Healthy return; } I copied the code from the documentation and searched the web and did whatever I found the same, but it is not working!
What am I doing wrong?
The problem is not with the layers, but when thoughts of life cycle are initiated.
If the view code is being created and added in a window that is already drawn to the screen, then using the initWithFrame: method to create layers This can not be done though, if the scene is being visualized by the NIB. When it is inserted in NIB, the initWithFrame: method will be called before the parent window, which is fully animated, which does not display the layers. When a window is being stored in an NIB awakeFromNib , the layers can be properly initialized instead of initWithFrame: .
Of course, two points of code where the layers can be made are ugly. In the case of the above usage, call is made to a useful point in viewDidMoveToSuperview .
(Mental note - If something does not make sense and you feel that you need to ask on the stack, check to add the check to viewDidMoveToSuperview The overflow is a good sign that you need some sleep.)
Comments
Post a Comment