Reputation: 4984
I have a class (Schedule) defined as such (schedule.h file shown)
#import <UIKit/UIKit.h>
#import "TdCalendarView.h"
#import "AppDelegate.h"
@interface Schedule : UIView {
IBOutlet UIView *schedule;
}
- (void) calendarTouched:(CFGregorianDate) selectedDate;
@end
Schedule.m looks like this:
- (void) calendarTouched: (CFGregorianDate) selectedDate {
NSLog(@"calendarTouched - currentSelectDate: %@/%@/%@", selectedDate.month, selectedDate.day, selectedDate.year);
return;
}
In another class, I am calling calendarTouched with this method call:
Schedule *sch = [[Schedule alloc] init];
[sch.calendarTouched:currentSelectDate];
I'm getting a build error, saying 'calendarTouched' not found on object of type Schedule. (I have an #import "Schedule.h" in the calling class)
I've done a clean, but to no avail. Why can't it find it?
Upvotes: 0
Views: 719
Reputation: 40221
You don't call methods like that in Objective-C. Do this instead:
[sch calendarTouched:currentSelectDate];
Upvotes: 3
Reputation: 64022
[sch.calendarTouched:currentSelectDate];
You're combining dot syntax and bracket syntax here. This should be:
[sch calendarTouched:currentSelectDate];
Upvotes: 4