UITabBarItem 更改图像的高度和宽度/UINavigationBar 更改样式
来源:互联网 发布:js字符串首字母大写 编辑:程序博客网 时间:2024/05/19 23:16
从苹果文档的最大大小的一张图片在 TabBar 是 30 x 30 (60 x 60 的视网膜显示器)。
我不认为它是可能采取整个 TabBar 不拉伸图像的高度。我认为最好的解决办法是中心中使用 imageInset TabBar 的图像
tabBarItem1.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
否则你可以玩这 imageInset 和拉伸图像像在截图中
tabBarItem1.imageInsets = UIEdgeInsetsMake(0, -10, -6, -10);
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController; UITabBar *tabBar = tabBarController.tabBar; UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0]; UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1]; UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2]; //add image to tabbarItems tabBarItem1.imageInsets = UIEdgeInsetsMake(0, -10, -6, -10);}
0 0
- UITabBarItem 更改图像的高度和宽度/UINavigationBar 更改样式
- UITabBarItem 更改图像的高度和宽度
- [ios]UITabBarItem 更改图像的高度和宽度
- iOS-更改UINavigationBar样式+更改返回ButtonItem文字
- UITabBarItem更改外观
- 163编辑器 自适应宽度 +更改高度
- 更改TableHeaderView的高度
- UINavigationBar 和 UITabBarItem 属性设置
- 更改actionBar的背景和文字样式
- css3更改radio的颜色和样式
- 更改ProgressDialog的样式
- 更改图像的对比度和亮度
- 更改Tab下划线的宽度
- IOS更改UITabBarItem的图片及字体颜色
- 怎么通过CSS样式更改GridView中checkbox样式以及其中一列的宽度
- h264图像宽度和高度
- 如何更改UIPickerView的高度
- UItableView 更改tableHeaderView的高度
- 第十三周 项目一:数组大折腾(1.5)
- Python中的映射:字典
- turn.js单页翻书页面
- 从客户端中检测到有潜在危险的 Request.Form 值
- zsim shmget出现shmget:Invalid argument错误的解决办法
- UITabBarItem 更改图像的高度和宽度/UINavigationBar 更改样式
- Hadoop RPC实现NIO通信Server端剖析
- 深入理解Android:Wi-Fi NFC和GPS.pdf
- BMS 民主测评 研发-QA
- HTTP请求以及HTTP响应
- java throw抛出异常
- 第12、13讲 课后自主学习及实践方案 代码
- json数据与JAVA数据的转换
- html5 audio读取文件流播放音频
[[UINavigationBarappearance] setTintColor:[UIColorwhiteColor]];
NSShadow *shadow = [[NSShadowalloc] init];
shadow.shadowColor = [UIColorcolorWithRed:0.0green:0.0blue:0.0alpha:0.0];
shadow.shadowOffset =CGSizeMake(0,1);
// [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0]
[[UINavigationBarappearance] setTitleTextAttributes: [NSDictionarydictionaryWithObjectsAndKeys:
[UIColorgrayColor], NSForegroundColorAttributeName,
shadow,NSShadowAttributeName,
[UIFontfontWithName:@"Avenir-Medium" size:20.0],NSFontAttributeName, nil]];
UIBarButtonItem *cameraItem = [[UIBarButtonItemalloc] initWithImage:[selfscaleImageToSize:[UIImageimageNamed:@"ico_location_up"] size:CGSizeMake(20,26)] style:UIBarButtonItemStyleBorderedtarget:selfaction:@selector(do)];
self.navigationItem.leftBarButtonItem = cameraItem;
//修改图片大小和控件一致
- (UIImage *)scaleImageToSize:(UIImage *)img size:(CGSize)size
{
UIGraphicsBeginImageContext(size);
[imgdrawInRect:CGRectMake(0,0, size.width, size.height)];
UIImage* scaledImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}