プロジェクトでエラーが発生しました。Xcode エラー インスタンス メソッド -addAttachment withImageNamed が見つかりませんでした。以下は私のコードの一部です。
HegakaDragAndDropRecycleBinViewController.h
@interface HegakaDragAndDropRecycleBinViewController : UIViewController {
IBOutlet GalleryScrollView *gallery;
}
-(NSString*)withImageNamed;
@property (nonatomic, retain) IBOutlet GalleryScrollView *gallery;
@end
HegakaDragAndDropRecycleBinViewController.m
#import "HegakaDragAndDropRecycleBinViewController.h"
#import "AttachmentItem.h"
@implementation HegakaDragAndDropRecycleBinViewController
@synthesize gallery;
- (void)dealloc
{
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.gallery.mainView = self.view;
AttachmentItem *item = [[AttachmentItem alloc] initWithData:1 data:nil];
[self.gallery addAttachment:item withImageNamed:@"recyclebin"];
[self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
[self.gallery addAttachment:item withImageNamed:@"light-cherry"];
[self.gallery addAttachment:item withImageNamed:@"mozambique-wenge"];
[self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
[item release];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
実装ラインとここでアラート警告が表示されます。
[self.gallery addAttachment:item withImageNamed:@"recyclebin"];
[self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
[self.gallery addAttachment:item withImageNamed:@"light-cherry"];
[self.gallery addAttachment:item withImageNamed:@"mozambique-wenge"];
[self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
プロジェクトは引き続き実行されますが、この 6 つの警告があります。
どんな援助も大歓迎です。
ありがとう