0

そのように定義されたクラス(Schedule)があります(schedule.hファイルが表示されています)

#import <UIKit/UIKit.h>
#import "TdCalendarView.h"
#import "AppDelegate.h"

@interface Schedule : UIView  {
    IBOutlet UIView *schedule;
}

- (void) calendarTouched:(CFGregorianDate) selectedDate;

@end

Schedule.m は次のようになります。

- (void) calendarTouched: (CFGregorianDate) selectedDate  {

    NSLog(@"calendarTouched - currentSelectDate: %@/%@/%@", selectedDate.month, selectedDate.day, selectedDate.year);
    return;
}

別のクラスでは、次のメソッド呼び出しでcalendarTouchedを呼び出しています。

Schedule *sch = [[Schedule alloc] init];
[sch.calendarTouched:currentSelectDate];

「calendarTouched」がスケジュール タイプのオブジェクトに見つからないというビルド エラーが発生します。(呼び出しクラスに #import "Schedule.h" があります)

掃除をしましたが、無駄でした。なぜそれが見つからないのですか?

4

2 に答える 2

4
[sch.calendarTouched:currentSelectDate];

ここでは、ドット構文とブラケット構文を組み合わせています。これは次のようになります。

[sch calendarTouched:currentSelectDate];
于 2012-06-26T20:07:23.683 に答える
3

Objective-C では、そのようなメソッドを呼び出しません。代わりにこれを行います:

[sch calendarTouched:currentSelectDate];
于 2012-06-26T20:07:52.670 に答える