开发者

Objective-C I can access self.view but not self.view.frame

开发者 https://www.devze.com 2022-12-24 04:11 出处:网络
I can access and show self.view and see the frame in the log but when I try to access self.view.frameI get null. Below is the log output of

I can access and show self.view and see the frame in the log but when I try to access self.view.frame I get null. Below is the log output of

NSLog(@"Show self.view:%@",self.view);
NSLog(@"Show self.view.frame:开发者_开发知识库%@",self.view.frame);

-

2010-03-28 11:08:43.373 vivmed_CD_Tab[20356:207] Show self.view:<UITableView: 0x4001600; frame = (0 0; 320 583); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x3b21270>>
2010-03-28 11:08:43.373 vivmed_CD_Tab[20356:207] Show self.view.frame:(null)

Can anyone explain why self.view.frame is null but self.view shows a frame? My goal is to change the frame size.

Cheers, Grant


One problem in the code you've posted is that you're printing the frame (a CGRect) as an object, which won't work. Try:

NSLog(@"Show self.view.frame: %u", self.view.frame);  // as a pointer

NSLog(@"Show self.view.frame: %@", NSStringFromCGRect(self.view.frame));  // as a string
0

精彩评论

暂无评论...
验证码 换一张
取 消