开发者

adding UIImageView to UIScrollView

I have a UIScrollView set up in IB. I am adding in a UIImageView to it in viewDidLoad method but it's not working. Here's my code:

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
    [scrollView addSubview:imageV开发者_如何学Goiew];
    [scrollView setContentSize:[imageView frame].size];
    [imageView release];
}

I NSLog-ed imageView and it's not null. What am I doing wrong? Thanks.

EDIT: The screen is just blank. There's nothing there.


It sounds like your UIScrollView isn't hooked up. Is the outlet for scrollview valid? Log scrollView to verify.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜