Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-05-2011, 12:02 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 36
Craig2 is on a distinguished road
Default Large UIScrollView with background pattern fails

I have a UIScrollView with a very large content view, it's a bookshelf with around 1000 items on it, when the scroll views content becomes more than around 16000px high it shows a black background and all graphics overlap/blend together.

Here is the sample code

Code:
- (void)viewDidLoad {
    [super viewDidLoad];

    // Doesn't work
    int sizeForContent = 20000;

    // Does Work
    //sizeForContent = 10000;


    UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];  

    UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, sizeForContent)];
    subView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"wood.jpg"]];
    [scroll addSubview:subView];
    [subView release];

    scroll.contentSize = CGSizeMake(self.view.frame.size.width, sizeForContent);
    [self.view addSubview:scroll]; 

    [scroll release];

}
Does anyone know why this happens? I assume it is something to do with memory limits but it doesn't seem to be using much memory.

I know I could set the scrollview background color directly instead of adding a subview and setting the background of that but I need to leave the scrollview background as a color.

You can get the basic xcode project from ScrollViewTest.zip if you want to see the issue.

Any help or explanations greatly appreciated.
Craig2 is offline   Reply With Quote
Reply

Bookmarks

Tags
uiscrollview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 373
17 members and 356 guests
Absentia, akphyo, apatsufas, BinHex, dre, Error404, fredidf, Gaz, gmarro, jeroenkeij, Kirkout, MarkC, mottdog, Music Man, PavelMik, whitey99, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:20 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0