この問題とその修正方法を理解しようとすると、私は頭がおかしくなりそうです。基本的に、私は時々 TTThumbsViewController を使用し、時には TTPhotoViewController を TTLauncherView で起動する iPad アプリを持っています。メモリの問題を解決する必要がありますが、これは別の話です。問題は、TThumbsViewController を使用するとすべて正常に動作することです。シミュレーターで TTPhotoViewController を使用すると、デバイスがひどくクラッシュします。TTCatalog の例のコードを使用すると、インターネットから取得した画像がローカル クラッシュの場合は正常に動作します。下部のナビゲーション矢印が機能する奇妙な動作も見られますが、最初または最後に到達すると、そのうちの1つが灰色になると予想されますが、まだ有効になっています。サンプルの TTCatalog から正確なファイルをコピーしましたが、うまくいきませんでした。ここにコード:インポート
@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 を使用しています。3 つの lib 1.0.11。これは、2Mb のような大きな jpg でのみ発生することに気付きました。まだ調査中ですが、どうもおかしいようです。
誰でも私を助けることができますか?良いアドバイスをいただければ幸いです。
本当にありがとうございました
ニベ
EDIT2:問題はファイルのサイズではなく、画像の解像度にあることがわかりました。実際には、5616×3744のようなもので、私の目的にはばかげています。私はまだいくつかの大きな写真でいくつかのクラッシュがあります.大きな写真を処理する方法はありますか?
ありがとうございました