user1898829
user1898829

Reputation: 3527

Why is this image not being added to my scrollview?

Why is this image not being added to my UIScrollView? A white screen is being displayed:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.scrollView.frame.size.width * 1, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height)];
    imageView.backgroundColor = [UIColor redColor];
    [imageView setImage:[UIImage imageNamed:@"placeholder.png"]];
    [self.scrollView addSubview:imageView];
    self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * self.urlArray.count, self.scrollView.frame.size.height);

Upvotes: 3

Views: 177

Answers (1)

iPatel
iPatel

Reputation: 47119

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height)];

Ans also give proper contentSize of UIScrollView and add UIScrollView to your UIView

Upvotes: 3

Related Questions