这是我的代码。我正在尝试访问我的视图框架。首先我nslog self,以确保视图已分配,然后我尝试nslog 我的视图框架,它返回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)