0

I'm going mad to try to figure out this problem and how to fix it. Basically I have an iPad app where I use sometime TTThumbsViewController and sometimes TTPhotoViewController, lunched by TTLauncherView. Everything works fine, I have to figure out some memory problem, but this is another story. The problem is when I use TTThumbsViewController everything works fine, when I use TTPhotoViewController on the simulator works great on the device crashes badly. If I use the code from the example TTCatalog, so images taken from internet it works fine, if they are local crashes. I see also a weird behavior the bottom navigation arrows work, but when I reach the beginning or the end I exptect one of them turn grey but they are still enable. I copy the exact file from the example TTCatalog but no lucky. Here the code: import

 @interface PhotoBrowseViewController : TTPhotoViewController { NSMutableArray* data; NSArray    *parameter; }

@property (nonatomic, retain) NSArray parameter; @property (nonatomic, retain) NSMutableArray data;

@end;
import "PhotoBrowseViewController.h"
import "MockPhotoSource.h"
import "Utils.h"

@implementation PhotoBrowseViewController

@synthesize data,parameter;

(id)initWithData:(NSString*)level { if (self = [super init]) {
parameter = [level componentsSeparatedByString:@"-"];
data=[[NSMutableArray alloc] initWithArray:[Utils getPhotosBrowse:[[parameter objectAtIndex:0] integerValue]  andArray:nil]];

} return self; }

(void)viewDidLoad { self.photoSource = [[[MockPhotoSource alloc] initWithType:MockPhotoSourceNormal //initWithType:MockPhotoSourceDelayed // initWithType:MockPhotoSourceLoadError //initWithType:MockPhotoSourceDelayed|MockPhotoSourceLoadError title:@"test" photos:[Utils getTestPhotos]

photos2:nil ] autorelease];

}

(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if(parameter!=nil ) [_scrollView setCenterPageIndex:[[parameter objectAtIndex:1] integerValue]];

}

(void)updateChrome { self.navigationItem.rightBarButtonItem = nil; }

(void) dealloc { [super dealloc]; }

@end

And here the function:

+(NSArray *)getTestPhotos {
return
[NSArray arrayWithObjects:
 [[[MockPhoto alloc]
   initWithURL:@"documents://f_0000000029.jpg"
   smallURL:@"documents://thumbs/f_0000000029.jpg"
   size:CGSizeMake(0, 0)] autorelease],

 [[[MockPhoto alloc]
  initWithURL:@"documents://f_2.jpg"
  smallURL:@"documents://thumbs/f_2.jpg"
  size:CGSizeMake(0, 0)] autorelease],

 [[[MockPhoto alloc]
  initWithURL:@"documents://f_0000000003.jpg"
 smallURL:@"documents://thumbs/f_0000000003.jpg"
 size:CGSizeMake(0, 0)] autorelease],

 [[[MockPhoto alloc]
  initWithURL:@"documents://f_0000000004.jpg"
  smallURL:@"documents://thumbs/f_0000000004.jpg"
  size:CGSizeMake(0, 0)] autorelease],

     nil];

}

I'm using iOS 5 and xcode 4.3. Three lib 1.0.11. I notice that this happen only with jpg large like 2Mb. I'm still investigating, but it seems weird to me.

Can anyone help me? It will be much appreciated any good advices.

thank you a lot

Nibe

EDIT2: I figure out the problem is not much about the dimension of the file but the resolution of the image, acutally they are something like 5616 × 3744, which is ridiculous high for my purpose. I still have some crash in some big photos, any ideas how I can handle big pict?

thank you

NiBE
  • 857
  • 2
  • 16
  • 39

1 Answers1

0

Read this

https://groups.google.com/forum/?fromgroups=#!topic/three20/AgD6iJmI-P0

Basically rule of thumb is use png format wherever possible.

Asad Khan
  • 11,469
  • 13
  • 44
  • 59