Alexander
Alexander

Reputation: 83

UIScrollview large contentsize

I'm trying to create a big UIview ( 3600 X 4600 ) and scroll it via UIScrollView.

CGRect contentViewFrame=CGRectMake(0, 0, 3600, 4600);
UIView *cView=[[ContentView alloc]initWithFrame:contentViewFrame];
self.contentView=cView;

[self.scrollView addSubview:cView];
self.scrollView.contentSize=CGSizeMake(3600, 4600);

But I have one problem. When I run my app on simulator everything is ok! But when I run the app on my iPhone and try to zoom out to see a whole view ( 3600 X 4600 ) my app crashes and iPhone resprings. It seems like my view ( 3600 X 4600 ) is to big and iPhone can't show me view in full size. How can I solve this problem?

Upvotes: 0

Views: 221

Answers (1)

Abizern
Abizern

Reputation: 150575

You should look at using a CATiledLayer as your view layer. This way you'll minimise the amount if memory your view uses when zoomed.

Upvotes: 1

Related Questions