问题描述
我尝试将标签栏图标的颜色从默认的蓝色更改为红色...我收到此错误在程序中流浪'\ 342'" ..我在-(void)recolorItemsWithColor:......."以及在实现部分得到了错误……无论如何,它都可以解决dis错误...还有其他方法可以将标签栏图标从默认的蓝色更改为其他颜色
i m trying to change the tabbar icon color from default blue to red...i m getting this error"Stray '\342'in program".. i m getting the error at "-(void)recolorItemsWithColor:......." and also at the implementation section...is der anyway to solve dis error...is there anyother method to change the tab bar icon from default blue to some other color
@interface UITabBar (ColorExtensions)
– (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur;
@end
推荐答案
尝试将49x49 png图像添加到项目中,然后将这些代码行粘贴到applicationDidFinishLaunching内部的应用程序委托中,然后添加子视图.
Try adding a 49x49 png image into your project, then paste these line of code into your app delegate inside the applicationDidFinishLaunching and before adding a subview.
CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *view = [[UIView alloc] initWithFrame:frame];
UIImage *tabBarBackgroundImage = [UIImage imageNamed:@"49x49.png"];
UIColor *color = [[UIColor alloc] initWithPatternImage:tabBarBackgroundImage];
[view setBackgroundColor:color];
[color release];
[[tabcontroller tabBar] insertSubview:view atIndex:0];
[view release];
希望这会有所帮助.
这篇关于将标签栏图标的颜色从默认的蓝色更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!