【问题标题】:TTPhotoViewController Crash on iPad local imagesiPad本地图像上的TTPhotoViewController崩溃
【发布时间】:2012-04-08 15:51:27
【问题描述】:

我很想弄清楚这个问题以及如何解决它。基本上我有一个 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 这样大的情况下。我仍在调查,但对我来说似乎很奇怪。

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

非常感谢

尼贝

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

谢谢

【问题讨论】:

  • 控制台输出是什么?崩溃的地方是哪一行?

标签: iphone cocoa ipad three20


【解决方案1】:

阅读本文

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-23
    • 2012-11-26
    • 2011-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多