gpt4 book ai didi

ios - 在 initWithCoder 中写入时未显示 CALayer 更改

转载 作者:行者123 更新时间:2023-12-01 19:01:59 25 4
gpt4 key购买 nike

我正在尝试在位于 uitableviewcell 内的 UIButton 上做一些 CALayer 的东西。
我已经导入,但 CALayer 操作不起作用。
当我将它移到 cellForRowAtIndexPath 方法时,它工作正常。
我确实想在单元格本身的类内而不是在表创建表内进行更改。
你有什么想法 ?

顺便说一句,我确实在 init 上看到了 NSLog 文本(所以我知道它进入了 block )。

谢谢 !

- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
NSLog(@"STARTED coder init in testResultCell");
[[self.bubbleMore layer] setMasksToBounds:YES];
[[self.bubbleMore layer] setBorderWidth:3.0f];
[[self.bubbleMore layer] setBorderColor:[UIColor blueColor].CGColor];
[[self.bubbleMore layer] setCornerRadius:20.0f];
}
return self;
}

最佳答案

将代码移至awakeWithNib . initWithCoder 中尚未连接您的网点.来自 Apple's documentation :

When an object receives an awakeFromNib message, it is guaranteed to have all its outlet instance variables set.

关于ios - 在 initWithCoder 中写入时未显示 CALayer 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22167161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com