problem getting the height of a UIScrollView

Posted by funkadelic on Stack Overflow See other posts from Stack Overflow or by funkadelic
Published on 2010-04-14T21:30:42Z Indexed on 2010/04/14 21:33 UTC
Read the original article Hit count: 261

Filed under:
|

hi,

i am setting the size of a UIScrollView in viewDidLoad: but when I try to get the height of it, i am getting 0 in the console

here is my code:

- (void)viewDidLoad {
    [scrollView setContentSize:CGSizeMake(320,500)];

    NSLog(@"scrollView: %@", scrollView);
    NSLog(@"scrollView.contentSize.height: %i", scrollView.contentSize.height);

    [super viewDidLoad];
}

and in the console log i get

scrollView: <UIScrollView: 0x4974110; frame = (0 0; 320 367); clipsToBounds = YES; autoresize = RM+TM; layer = <CALayer: 0x4974010>>
scrollView.contentSize.height: 0

Shouldn't scrollView.contentSize.height be returning 367? On a related note, i specified the height to be 500 via [scrollView setContentSize:], but that doesn't appear to be applied?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about uiscrollview