iphone - 无法将 Tapku 库添加到 XCode 4.2 项目中

标签 iphone objective-c ios xcode tapku

我尝试关注 this来自作者的 github 存储库的教程,但未成功。当我尝试构建项目时,出现 6 个错误。

其中5个是

Use of undeclared identifier '_accessibleElements'

其中1个是

Receiver type 'TKCalendarMonthTiles' for instance message does not declare a method with selector 'rectForCellAtIndex'

所有错误都在 TKCalendarMonthView.m 文件中报告

最佳答案

TKCalendarMonthTiles 类似乎声明了一个属性:

@property (nonatomic, strong) NSMutableArray *accessibleElements;

这不是在类实现中合成的。由于没有声明 _accessibleElements ivar,因此您会得到您提到的未声明的标识符错误。

对于这个错误,您可以在 Xcode 4.4 上构建以自动合成声明的属性,或者添加:

@synthesize accessibleElements = _accessibleElements

TKCalendarMonthTiles 实现中

现在,你的第二个错误。这也是由于基于 Xcode 4.2 而不是 4.4 构建。从 4.4(或者可能是 4.3,我不记得了)开始,您不需要在类扩展中声明私有(private)方法。但是由于您是使用 Xcode 4.2 构建的,因此您需要将方法声明添加到 TKCalendarMonthTiles

上的类扩展中
@interface TKCalendarMonthTiles ()
- (CGRect)rectForCellAtIndex:(int)index;
@end

关于iphone - 无法将 Tapku 库添加到 XCode 4.2 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12451484/

相关文章:

iphone - UIFont 中符号的使用

objective-c - 如何使 NSWindowController 在 OSX Lion 中以全屏模式运行?

ios - 获取收到远程通知的日期

ios - UIView animateKeyframes 不适用于 NSLayoutConstraints

ios - Swift - 如何在按下不同 UITableView 单元格中的另一个播放按钮时自动停止当前播放的音频?

iphone - 错误 : expected specifier-qualifier-list before. ..在 Objective C 中?

ios - 如何在用户键入时创建增加框架大小而不是增加滚动大小的 TextView

ios - 如何从垃圾图标按钮和 'Done' 按钮动态切换 UIBarButtonItem?

Objective-C 泛型 - 有没有办法使泛型与类匹配(在继承的情况下)

ios - 如何在 UICollectionview 中显示前 9 个图像?