我尝试了很多东西,但没有一个能解决我的问题。 我正在收到警告:
无法设置(tintColor)用户定义的检查属性 (UINavigationController):[ setValue:forUndefinedKey:]:此类不是键值 符合编码的关键tintColor。
我通过StoryBoard做的所有色调变化。我的代码是用Swift编写的。 StoryBoard片段(当发生这种情况时)看起来像:
ViewController - > TabBarController - > NavigationController - >的ViewController
唯一的"用户定义的运行时属性"是const Line = React.createClass({
propTypes: {
path: React.PropTypes.string.isRequired,
stroke: React.PropTypes.string,
fill: React.PropTypes.string,
strokeWidth: React.PropTypes.number
},
getDefaultProps() {
return {
stroke: 'blue',
fill: 'none',
strokeWidth: 3
};
},
render() {
let { path, stroke, fill, strokeWidth } = this.props;
return (
<path
d={path}
fill={fill}
stroke={stroke}
strokeWidth={strokeWidth}
/>
);
}
});
const DataSeries = React.createClass({
propTypes: {
colors: React.PropTypes.func,
data: React.PropTypes.array,
interpolationType: React.PropTypes.string,
xScale: React.PropTypes.func,
yScale: React.PropTypes.func
},
getDefaultProps() {
return {
data: [],
interpolationType: 'basis',
colors: d3.scale.category10()
};
},
render() {
let { data, colors, xScale, yScale, interpolationType } = this.props;
let line = d3.svg.line()
.interpolate(interpolationType)
.x((d) => { return xScale(d.to_timestamp); })
.y((d) => { return yScale(d.count); });
let dataGroup = d3.nest()
.key(function(d) {
return d.type;
})
.entries(data);
let lines = dataGroup.map((series, id) => {
return (
<Line
path={line(series.values)}
stroke={colors(id)}
key={id}
/>
);
});
return (
<g>
<g>{lines}</g>
</g>
);
}
});
const LineChart = React.createClass({
propTypes: {
width: React.PropTypes.number,
height: React.PropTypes.number,
data: React.PropTypes.array.isRequired
},
getDefaultProps(){
return {
width: 600,
height: 300
}
},
render() {
let { width, height, data } = this.props;
let xScale = d3.time.scale()
.domain([new Date('2015-09-24T00:00:00.000Z'), new Date('2016-03-24T00:00:00.000Z')])
.range([0, width]);
let yScale = d3.scale.linear()
.domain([d3.min(data, function(d) {
return d.count;
}), d3.max(data, function(d) {
return d.count;
})])
.range([height, 10]);
console.log(data);
return (
<svg width={width} height={height}>
<DataSeries
xScale={xScale}
yScale={yScale}
data={data}
width={width}
height={height}
/>
</svg>
);
}
});
(在NavigationController中),但删除这个没有帮助。
有什么想法吗?
答案 0 :(得分:0)
如果您只想更改一个特定的NavigationController的色调颜色,请添加代码
navigationController?.navigationBar.tintColor = /*your color*/
在viewController的viewDidLoad()中。
或者您想要更改所有NavigationController的色调颜色,您可以添加代码
UINavigationBar.appearance().tintColor = /*your color*/
在func应用程序中(application,didFinishLaunchingWithOptions)
或者您可以使用全局色调颜色选项更改Storyboard文件中App的色调颜色。
答案 1 :(得分:0)
我找到了解决方案,我的同事分别设置了每个导航控制器的颜色。只需从所有导航控制器中删除“tintColor”即可。 谢谢@ user3441734。 NavigationController也不会从UIView继承。