I have got an error in my project, I’m getting Xcode Error Instance Method -addAttachment withImageNamed not found, Below is some of my code:
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
I’m getting my alert warning at the Implementation line and here:
[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"];
The project still runs but has this 6 warnings.
Any assistance is much appreciated.
Thanks
Make sure your class
AttachmentItemdeclaresaddAttachment:withImageNamed:in its header file