Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 410
Grant M Avatar asked Mar 28 '10 02:03

Grant M


1 Answers

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
like image 103
Sixten Otto Avatar answered Oct 23 '22 02:10

Sixten Otto