ios 怎么用代码显示.svg 的矢量图

ios 怎么用代码显示.svg 的矢量图


阿晨1998
浏览 794回答 2
2回答

米琪卡哇伊

写一个控制器继承自UITabBarController,在该控制器的ViewDidLoad方法中加入如下代码// tabBarItem的图片名称NSArray *images = @[@"tabBarItem_allTest_normal.png",@"tabBarItem_allTest_selected.png",@"tabBarItem_oneStation_normal.png",@"tabBarItem_oneStation_selected.png",@"tabBarItem_testResult_normal.png",@"tabBarItem_testResult_selected.png",@"tabBarItem_userCenter_normal.png",@"tabBarItem_userCenter_selected.png"];for(int i= 0;i< 8;){// 分别给tabBarItem设置图片,图片模式为源图片UITabBarItem *item = [self.tabBar.items objectAtIndex:i/2];UIImage *normalImage = [UIImage imageNamed:images[i+1]];normalImage = [normalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];UIImage *selectImage = [UIImage imageNamed:images[i]];selectImage = [selectImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];[item setFinishedSelectedImage:normalImagewithFinishedUnselectedImage:selectImage];i+=2;}// 设置tabbar的选中和未选中的字体颜色[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor lightGrayColor]} forState:UIControlStateNormal];[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor lightGrayColor]} forState:UIControlStateSelected];
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

iOS