RN笔记-ios原生嵌入rn框架的小坑
2017-03-02 本文已影响132人
金丝楠
RN插件嵌入到现有iOS原生应用时,按照http://www.jianshu.com/p/e6310f9ea31b 配置完了之后运行时,会提示
_refreshControl
变量不存在,如下图所示
问题
- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
if (_refreshControl) {
[_refreshControl removeFromSuperview];
}
_refreshControl = refreshControl;
[self addSubview:_refreshControl];
}
![](https://img.haomeiwen.com/i2818477/b1737caaef7c994f.png)
解决方案
在
RCTScrollView.m
中声明_refreshControl
全局变量
@implementation RCTCustomScrollView
{
__weak UIView *_dockedHeaderView;
RCTRefreshControl *_refreshControl;
}
![](https://img.haomeiwen.com/i2818477/6143ae7a7bcc6e95.png)