これは私のものですiCarouselViewController.m
- (void)dealloc
{
//it's a good idea to set these to nil here to avoid
//sending messages to a deallocated viewcontroller
carousel1.delegate = nil;
carousel1.dataSource = nil;
carousel2.delegate = nil;
carousel2.dataSource = nil;
[carousel1 release];
[carousel2 release];
[items1 release];
[items2 release];
[super dealloc];
}
というエラーが表示されます
'release' は使用できません: 自動参照カウント モードでは使用できません
ARC は 'release' の明示的なメッセージ送信を禁止します
'release' は使用できません: 自動参照カウント モードで は使用できません自動参照カウント モードでは使用できませんARC は 'release' の 明示的なメッセージ送信を禁止 します 'release' は使用できません: 自動参照カウント モードでは使用できません
このコードのエラーも
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
UILabel *label = nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)] autorelease];
((UIImageView *)view).image = [UIImage imageNamed:@"page.png"];
view.contentMode = UIViewContentModeCenter;
label = [[[UILabel alloc] initWithFrame:view.bounds] autorelease];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
label.font = [label.font fontWithSize:50];
[view addSubview:label];
}
else
{
label = [[view subviews] lastObject];
}
言って
「autorelease」は使用できません: 自動参照カウント モードでは使用できません
ARC は「autorelease」の明示的なメッセージ送信を禁止します
「autorelease」は使用できません: 自動参照カウント モードでは使用できません
ARC は「autorelease」の明示的なメッセージ送信を禁止します
このエラーをクリアするにはどうすればよいですか。
更新
回答ありがとうございます宣言されていない識別子imageArray1の使用を示す4つのエラーがあります。そして私はこれが起こっていることを知っています。「アプリのバンドルを使用しているだけだと思います。各画像を参照する NSString の 2 つの配列があります。imageArray1 と imageArray2 です。」以下は、私の保存コードの1つであり、私のディレクトリの1つのディレクトリを作成しています。注: ヘッダー ファイルで宣言した allImagesArray という名前の NSMutableArray は 1 つだけです。
NSArray *directoryNames = [NSArray arrayWithObjects:@"Apple",nil];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
for (int i = 0; i < [directoryNames count] ; i++) {
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:[directoryNames objectAtIndex:i]];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil]; //Create folder
NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Tops"]; NSData *imageData = UIImagePNGRepresentation(captureImage.image);
time_t unixtime = (time_t)[[NSDate date]timeIntervalSince1970];
NSString *timestamp = [NSString stringWithFormat:@"%ldTopsImage.PNG",unixtime];
NSString *filePath = [folderPath stringByAppendingPathComponent:timestamp];
[imageData writeToFile:filePath atomically:YES];
}
}
Update 4
This?
- (void)viewDidLoad
{
[super viewDidLoad];
//configure carousel
imageArray1 = [[NSMutableArray alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *location=@"apple";
NSString *fPath = [documentsDirectory stringByAppendingPathComponent:location];
NSArray * directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath: fPath];
imageArray1 = directoryContent;
imageArray2 = [[NSMutableArray alloc] init];
NSString *location=@"green";
NSString *fPath = [documentsDirectory stringByAppendingPathComponent:location];
NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath: fPath];
imageArray2 = directoryContent;