0

我很想弄清楚这个问题以及如何解决它。基本上我有一个 iPad 应用程序,我有时使用 TTThumbsViewController,有时使用 TTPhotoViewController,由 TTLauncherView 提供午餐。一切正常,我必须找出一些内存问题,但这是另一个故事。问题是当我使用 TTThumbsViewController 时一切正常,当我在模拟器上使用 TTPhotoViewController 时,在设备崩溃时效果很好。如果我使用示例 TTCatalog 中的代码,那么如果它们是本地崩溃,则从 Internet 获取的图像可以正常工作。我还看到底部导航箭头起作用的奇怪行为,但是当我到达开头或结尾时,我希望其中一个变成灰色,但它们仍然处于启用状态。我从示例 TTCalog 复制了确切的文件,但没有幸运。这里的代码:导入

 @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

这里的功能:

+(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];

}

我正在使用 iOS 5 和 xcode 4.3。三个库 1.0.11。我注意到这种情况只发生在 jpg 像 2Mb 这样大的情况下。我仍在调查,但对我来说似乎很奇怪。

谁能帮我?任何好的建议将不胜感激。

十分感谢

尼贝

EDIT2:我发现问题不在于文件的尺寸,而在于图像的分辨率,实际上它们大约是 5616 × 3744,这对我的目的来说太高了。我在一些大照片中仍然有些崩溃,有什么想法可以处理大照片吗?

谢谢你

4

1 回答 1

0

读这个

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

基本上经验法则是尽可能使用 png 格式。

于 2012-11-09T07:51:48.027 回答