React.Component { static navigationOptions = { tabBarLabel: '热点', tabBarIcon: ({ focused, tintColor /res/images/hot.png')} style={{ width: 26, height: 26, tintColor: tintColor }} /res/images/coterie.png')} style={{ width: 26, height: 26, tintColor: tintColor }} /res/images/tool.png')} style={{ width: 26, height: 26, tintColor: tintColor }} /res/images/my.png')} style={{ width: 26, height: 26, tintColor: tintColor }}
React.Component { static navigationOptions = { tabBarLabel: 'Home', tabBarIcon: ({ tintColor /imgs/01.png')} style={[styles.icon, {tintColor: tintColor}]} /> ), }; render() React.Component { static navigationOptions = { drawerLabel: 'Home', drawerIcon: ({ tintColor /imgs/01.png')} style={[styles.icon, {tintColor: tintColor}]} /> ), }; render( /imgs/02.png')} style={[styles.icon, {tintColor: tintColor}]} /> ), }; render(
React.Component { static navigationOptions = { tabBarLabel: '热点', tabBarIcon: ({ focused, tintColor /Images/hot.png')} style={ { width: 26, height: 26, tintColor: tintColor }} /Images/coterie.png')} style={ { width: 26, height: 26, tintColor: tintColor }} /Images/tool.png')} style={ { width: 26, height: 26, tintColor: tintColor }} /Images/my.png')} style={ { width: 26, height: 26, tintColor: tintColor }} /
默认选项卡栏将 tintColor 传递给图标组件,因此我们使用它来设置图标颜色。 }) => <Icon name="home" color={tintColor} /> } }, SearchScreen: { screen: SearchScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => <Icon name="search" color={tintColor} / , navigationOptions: { tabBarIcon: ({ tintColor }) => <Icon name="profile" color={tintColor 我们可以使用 renderIcon 函数来渲染正确的图标——通过查看源代码,该函数需要传入一个对象参数: { route, focused, tintColor }。
style:样式 tintColor string: 当前被选中的标签图标的颜色。 unselectedItemTintColor string: 当前没有被选中的标签图标的颜色。 })=>( <CustTabBarItem tintColor={tintColor} focused })=>( <CustTabBarItem tintColor={tintColor} focused })=>( <CustTabBarItem tintColor={tintColor} focused this.props.selectImage : this.props.normalImage} style={{tintColor: this.props.tintColor,
screen: Navigation, navigationOptions: { tabBarLabel: '首页', tabBarIcon: ({tintColor /home.png')} style={[{tintColor: tintColor},styles.icon]} /> screen: First, navigationOptions: { tabBarLabel: '第一页', tabBarIcon: ({tintColor /home.png')} style={[{tintColor: tintColor},styles.icon]} /> /home.png')} style={[{tintColor: tintColor},styles.icon]} />
false; UINavigationBar(全局设置) Swift示例 let appear = UINavigationBar.appearance(); //设置Item的样式 appear.tintColor : UIFont.systemFontOfSize(18)]; OC示例 UINavigationBar *appear = [UINavigationBar appearance]; appear.tintColor ]; UITabBar(全局设置) OC示例 UITabBar *tabbarAppear = [UITabBar appearance]; tabbarAppear.tintColor self.navigationController.navigationBar.barStyle = UIBarStyle.BlackTranslucent; self.navigationController.navigationBar.tintColor searchBarAppear.translucent = false; searchBarAppear.backgroundColor = UIColor.clearColor(); searchBarAppear.tintColor
this.props.selectedImage : this.props.normalImage } style={ { tintColor:this.props.tintColor }) => ( <TabBarItem tintColor={tintColor} focused={focused} }) => ( <TabBarItem tintColor={tintColor} focused={focused} /imgs/ic_like_sel.png')} style={[styles.icon, {tintColor: tintColor}]} /> /imgs/ic_mine_sel.png')} style={[styles.icon, {tintColor: tintColor}]} />
/tab_icon_home@2x.png")} />} renderSelectedIcon={() => <Image style={[styles.icon,{tintColor /tab_icon_home@2x.png")} />} renderSelectedIcon={() => <Image style={[styles.icon,{tintColor tab_icon_destn@2x.png")} />} renderSelectedIcon={() => <Image style={[styles.icon,{tintColor tab_icon_usercenter@2x.png")} />} renderSelectedIcon={() => <Image style={[styles.icon,{tintColor
AcrylicBrush x:Key="CMapUwpAcrylicBrush" BackgroundSource="HostBackdrop" TintColor TintOpacity="0.4" FallbackColor="{StaticResource SystemAccentColor}"/> 其中,TintColor CMapUwpAcrylicBrush" BackgroundSource="HostBackdrop" TintColor CMapUwpAcrylicBrush" BackgroundSource="HostBackdrop" TintColor
这个一个是默认的,黑色颜色,用于亮色背景,一个是白色用于深色背景 设置返回按钮 有时候我们会发现,我们设置的返回按钮都是蓝色的默认颜色,那么到底该怎么更改这些按钮的颜色呢 设置返回按钮的颜色,只设置tintColor 的颜色就好了 self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 只设置返回按钮的图片 - (void)goToBack 特别的解释下UIImage的imageWithRenderingMode:方法,参数UIImageRenderingModeAlwaysOriginal 表示总是用原图渲染,如果不这么设置,返回按钮将会显示tintColor target:self action:@selector(goToBack)]; leftButton.tintColor UIControlStateNormal]; [leftButton setTitle:@"返回" forState:UIControlStateNormal]; leftButton.tintColor
TabBar 只有一个,直接在 UITabBarController 的代码里写下面这段就可以 (globalBarTintColor是我自定义的浅海蓝色,后面还会出现) self.tabBar.tintColor -> Bool { // NavigationBar 颜色,全局设定 UINavigationBar.appearance().tintColor = UIColor.whiteColor navigationBar.tintColor = UIColor.whiteColor() 这个按钮的颜色貌似是改不掉的(据我刚刚尝试,是这样的)。
= YES; } } II 更改UIButton的图片颜色 应用场景:比如设计给我们的是一张黑色的返回箭头图.我们某个页面需要弄成白色的话.又不想重新设计一下新的图片 解决方法:修改tintColor 如果按钮是UIButtonTypeSystem类型的,比如修改系统导航栏的barButtonItem,直接设置tintColor即可。 vc.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor]; 但是修改自定义按钮的tintColor,需要设置图片的渲染模式为 UIImageRenderingModeAlwaysTemplate,并设置对应的tintColor UIButton *tmpView = [[UIButton alloc]init] QCTNAVicon_left] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; tmpView.tintColor
react 节点显示在header左边,例如左按钮 6)style-header的style 7)titleStyle- header的title的style (^__^) 嘻嘻…… 8)tintColor static navigationOptions内 tabBar: { label: '首页', icon: ({tintColor /app/images/home.png')} style={[{tintColor: tintColor},styles.icon]}/>), }, } /app/images/bill.png')} style={[{tintColor: tintColor},styles.icon]}/>), }, } /app/images/me.png')} style={[{tintColor: tintColor},styles.icon]}/>), }, } }
CGContextSetFillColor(context, CGColorGetComponents( [color CGColor])); // CGContextFillRect(context, rect); // self.tintColor "bg.png"]; [img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; self.tintColor
tintColor : '#999')} ]}></Text> <View style={[GStyle.badge, {position navigationOptions: { tabBarLabel: '通讯录', tabBarIcon: ({focused, tintColor tintColor : '#999')} ]}></Text> </View> ) } navigationOptions: { tabBarLabel: '我', tabBarIcon: ({focused, tintColor tintColor : '#999')} ]}></Text> <View style={[GStyle.badge_dot, {position
(毛玻璃效果) // 内部方法,核心代码,封装了毛玻璃效果 参数:半径,颜色,色彩饱和度 - (UIImage *)imageBluredWithRadius:(CGFloat)blurRadius tintColor :(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage , effectImage.CGImage); CGContextRestoreGState(outputContext); } // 添加颜色渲染 if (tintColor { CGContextSaveGState(outputContext); CGContextSetFillColorWithColor(outputContext, tintColor.CGColor
static defaultProps = { current: 0, background: '#fff', color: '#999', tintColor render() { const { background, color, tintColor, fixed } = this.props const { updateCurrent tintColor : color}}>{item.icon}</Text> {/* 圆点 */} tintColor : color}}>{item.title}</Text> </View> ))} TabBar from '@components/tabbar' <TabBar current={currentTabIndex} background='#f8f8f8' color='#999' tintColor
prevNext.momentary = YES; _prevNext.segmentedControlStyle = UISegmentedControlStyleBar; _prevNext.tintColor = actionBar.tintColor; [_prevNext addTarget:self action:@selector(handleActionBarPreviousNext:)
drawerLabel:侧滑标题; drawerIcon:侧滑的标题图标,这里会回传两个参数: {focused: boolean, tintColor: string}: focused: 表示是否是选中状态; tintColor: 表示选中的颜色; drawerLockMode:指定抽屉的锁定模式。 navigationOptions: { drawerLabel: 'Page4', drawerIcon: ({tintColor : { screen: Page4, navigationOptions: { drawerLabel: 'Page4', drawerIcon: ({tintColor 在上述代码中使用了react-native-vector-icons的矢量图标作为Tab的显示图标,drawerIcon接收一个React 组件,大家可以根据需要进行定制: tintColor: 当前状态下