gpt4 book ai didi

ios - 绘制矩形导致错误,无法引用 myview

转载 作者:行者123 更新时间:2023-11-29 11:11:09 25 4
gpt4 key购买 nike

这是我的代码。我正在尝试访问我的 View 框架。首先我 nslog 自己,以确保分配了 View ,然后我尝试 nslog 我的 View 框架,它返回 null。代码:

- (void)drawRect:(CGRect)rect {
NSLog(@"%@",self);
CGRect frameads = self.frame;
NSLog(@"%@",frameads);
}

编译器输出:

2012-07-18 11:41:59.808 animation[74551:f803] <MyView: 0x68568e0; frame = (0 37; 320 321); autoresize = RM+BM; layer = <CALayer: 0x6856a50>>
2012-07-18 11:41:59.808 animation[74551:f803] (null)

最佳答案

frame 是一个结构 (CGRect) 所以不会使用 %@ 记录,使用

NSLog(@"%@", NSStringFromCGRect(self.frame));

关于ios - 绘制矩形导致错误,无法引用 myview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11545247/

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