Comments (1)
问题已解决,是因为VVLayout.m文件中未实现接收表达式传值的方法,既:
- (BOOL)setStringData:(NSString *)data forKey:(int)key;
- 解决方法1:在VVLayout.m中实现此方法:
- (BOOL)setStringData:(NSString *)data forKey:(int)key{
BOOL ret = NO;
if (key == STR_ID_background) {
self.backgroundColor = [UIColor vv_colorWithString:data] ?: [UIColor blackColor];
ret = YES;
}
return ret;
}
- 解决方法2:新建VVLayout分类,利用runtime进行方法交换,达到动态修复此bug:
#import "VVLayout+Tracking.h"
#import <VirtualView/VVLayout.h>
#import <objc/runtime.h>
@implementation VVLayout (Tracking)
+(void)load {
Method setStringKey = class_getInstanceMethod(self, @selector(setStringData:forKey:));
Method mkeSetStringKey =class_getInstanceMethod(self,@selector(mke_setStringData:forKey:));
method_exchangeImplementations(setStringKey, mkeSetStringKey);
}
- (BOOL)mke_setStringData:(NSString *)data forKey:(int)key{
BOOL ret = NO;
if (key == STR_ID_background) {
self.backgroundColor = [UIColor vv_colorWithString:data] ?: [UIColor blackColor];
ret = YES;
}
return ret;
}
@end
from tangram-ios.
Related Issues (20)
- ios和安卓共用一套json的话怎么设置屏幕Width,一个是750,一个是720的,ios的比例参数在哪设置
- 自动布局怎么计算高度
- xml解析部分存在许多问题,不建议使用
- index返回错乱导致崩溃
- SDWebimage版本依赖问题
- 请问页面下拉刷新功能如何添加? HOT 1
- VirtualView复用时内部布局错乱 HOT 3
- VirtualView组件无法自适应高度 HOT 3
- 之前的交流群失效了
- TangramLayoutTypeMap在pod中找不到
- 使用GridLayout布局问题
- TangramPageScrollLayout滚动回调怎么设置?
- IOS 12.0 那个悬浮控件的会跟着滚动上下跳动,能否处理一下 HOT 1
- Container可以嵌套Container吗?
- 代码bug HOT 1
- 怎样获得TAC服务端代码,网站的那个介绍没用了
- 文档提供
- 更新版本和点击事件 HOT 1
- 请问ios的能直接动态加载二进制模板数据吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tangram-ios.