【问题标题】:ComponentKit Can't call super newWithView after subclassing CKCompositeComponent子类化CKCompositeComponent后ComponentKit无法调用super newWithView
【发布时间】:2015-07-22 18:48:14
【问题描述】:

.h 文件

#import "CKCompositeComponent.h"

@interface JWTextComponent : CKCompositeComponent

- (instancetype)newWithText:(NSString *)text;

@end

.mm 文件

#import "JWTextComponent.h"

@implementation JWTextComponent

- (instancetype)newWithText:(NSString *)text
{
    return [super newWithView:{
            [UILabel class],
            {
                {@selector(setText:), text},
              }
            } size:{}];
}
@end

但是我得到这个错误,我不知道为什么

在我的 Podfile 中,我有简单的,

target 'CKTest' do
pod 'ComponentKit', '~> 0.11'
end

target 'CKTestTests' do

end

我尝试尽可能密切地关注示例项目,这似乎是创建 CKComponent 的最简单案例,但可能存在一些基本错误,我似乎无法使其正常工作。

大白象藏在我的盲区哪里?

【问题讨论】:

  • 如果我用 CKComponent 替换 super,我得到错误不兼容的指针类型

标签: ios facebook objective-c++ componentkit


【解决方案1】:

已解决:

我没有将初始化程序作为类初始化程序。

+ (instancetype)newWithT:(NSString *)text

【讨论】:

    猜你喜欢
    • 2012-08-08
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    • 2020-03-03
    • 2019-05-24
    相关资源
    最近更新 更多