【问题标题】:Method in protocol not implemented correctly协议中的方法未正确实现
【发布时间】:2015-01-04 18:56:52
【问题描述】:

我正在使用 Tapku 库在我的视图中添加日历。我遇到了语义问题

calendarMonthView:marksFromDate:toDate:'在协议 'TKCalendarMonthViewDataSource' 中未实现

上线

  @implementation ViewController

在我看来controller.m

我尝试在 TKCalendarMonthViewDataSource 下实现 calendarMonthView:marksFromDate:toDate: 但它成功编译然后关闭。

这是我尝试在 TKCalendarMonthView.h 中实现它的代码

@protocol TKCalendarMonthViewDataSource <NSObject>

- calendarMonthView:marksFromDate:toDate;


/** A data source that will correspond to marks for the calendar month grid for a particular     month.
 @param monthView The calendar month grid.
 @param startDate The first date shown by the calendar month grid.
 @param lastDate The last date shown by the calendar month grid.
 @return Returns an array of NSNumber objects corresponding the number of days specified in the     start and last day parameters. Each NSNumber variable will give a BOOL value that will be used to     display a dot under the day.
 */


- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate;


@end

知道如何修复它,或者我的 calendarMonthView:marksFromDate:toDate 实现错误吗?

谢谢!

【问题讨论】:

  • 您必须在视图控制器中实际实现数据源方法 - 充当数据源的类。

标签: ios objective-c tapku


【解决方案1】:

确保您的视图控制器符合数据源协议:

viewcontroller.h:

@interface ViewController : UIViewController<TKCalendarMonthViewDataSource>

..并在您的 viewcontroller.m 中实现 calendarMonthView:marksFromDate:toDate 方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多