iOS7 相关资料整理
2016-02-20 11:18
323 查看
一、更改self.title中字体颜色及大小
解释:self.title为显示navigationController中间的标题文字.iOS5默认为白色,iOS7以后,默认为黑色。且没有直接修改的api思路:获得当前navigationItem.titleView,强制转换为UILabel,然后做相应的颜色。
二、更改self.title中字体颜色及大小
原文链接:http://www.raywenderlich.com/49316/how-to-update-your-app-for-ios-7from:http://www.raywenderlich.com
这是一个非常好的学习、更新、了解iOS的网站,希望对大家在iOS开发过程中有所帮助!
三、iOS7 UIStatusBar 字体颜色设置
iOS7后,字体颜色默认只有白黑两种,可以自定义window的方式,不过比较麻烦,先不介绍。此处以设置为白颜色为例。
a、直接在xxx-info.plist来设置
info.plist中添加View controller-based status bar appearance,设置为NO
info.plist中添加Status bar style,设置为Transparent black style (alpha of 0.5)
b、xxx-info.plist结合代码
info.plist中添加View controller-based status bar appearance,设置为NO
在.m文件中加[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
或者在.m文件中加以下代码
//- (BOOL)prefersStatusBarHidden {
// return NO;
//}
//
//- (UIStatusBarStyle)preferredStatusBarStyle {
// return UIStatusBarStyleLightContent;
//}
四、iOS7 tintColor for
navigationBar
// for iOS7.0+
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (systemVersion >= 7.0)
{
[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
}
五、iOS6.0后,类似xxxFunction
is deprecated编译警告warning处理。
最近在把一个iOS5.0的老项目升级到iOS7.1,发现在iOS6.0的时候,就有一些函数和枚举值被废弃。
那么在做版本兼容的时候,我们可以使用respondsToSelector这个函数,具体怎么使用就不多说了。
iOS6.0以下版本的函数、枚举(红色表示iOS6.0以上可用)
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0);
- (void)dismissModalViewControllerAnimated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_AVAILABLE_IOS(5_0);
typedef NS_ENUM(NSInteger, UILineBreakMode) {
UILineBreakModeWordWrap = 0, // Wrap at word boundaries
UILineBreakModeCharacterWrap, // Wrap at character boundaries
UILineBreakModeClip, // Simply clip when it hits the end of the rect
UILineBreakModeHeadTruncation, // Truncate at head of line: "…wxyz". Will truncate multiline text on first line
UILineBreakModeTailTruncation, // Truncate at tail of line: "abcd…". Will truncate multiline text on last line
UILineBreakModeMiddleTruncation, // Truncate middle of line: "ab…yz". Will truncate multiline text in the middle
} NS_DEPRECATED_IOS(2_0,6_0);
typedef NS_ENUM(NSInteger, NSLineBreakMode) { /* What to do with long lines */
NSLineBreakByWordWrapping = 0, /* Wrap at word boundaries, default */
NSLineBreakByCharWrapping, /* Wrap at character boundaries */
NSLineBreakByClipping, /* Simply clip */
NSLineBreakByTruncatingHead, /* Truncate at head of line: "…wxyz" */
NSLineBreakByTruncatingTail, /* Truncate at tail of line: "abcd…" */
NSLineBreakByTruncatingMiddle /* Truncate middle of line: "ab…yz" */
} NS_ENUM_AVAILABLE_IOS(6_0);
// Deprecated: use NSTextAlignment enum in UIKit/NSText.h
typedef NS_ENUM(NSInteger, UITextAlignment) {
UITextAlignmentLeft = 0,
UITextAlignmentCenter,
UITextAlignmentRight, // could add justified in future
} NS_DEPRECATED_IOS(2_0,6_0);
/* Values for NSTextAlignment */
typedef NS_ENUM(NSInteger, NSTextAlignment) {
NSTextAlignmentLeft = 0, // Visually left aligned
#if TARGET_OS_IPHONE
NSTextAlignmentCenter = 1, // Visually centered
NSTextAlignmentRight = 2, // Visually right aligned
#else /* !TARGET_OS_IPHONE */
NSTextAlignmentRight = 1, // Visually right aligned
NSTextAlignmentCenter = 2, // Visually centered
#endif
NSTextAlignmentJustified = 3, // Fully-justified. The last line in a paragraph is natural-aligned.
NSTextAlignmentNatural = 4, // Indicates the default alignment for script
} NS_ENUM_AVAILABLE_IOS(6_0);
相关文章推荐
- [IOS]edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets
- iOS6.0后一些Rotations的变更
- iOS获取文件长度和文件大小
- 个推推送iOS版 常见问题详解
- iOS 开发之动画篇 - Transform和KeyFrame动画
- ios NSInvocation简单使用
- IOS应用提交所需尺寸
- 面向对象3-键值编码(KVC)和键值监听(KVO)
- Tableview详细方法
- IOS基础:retain,copy,assign及autorelease
- iOS Xcode7.2开发时使用SBJson解析时 出现野指针的问题解决
- iOS取证将如漫漫长夜
- iOS-使用代码CGImage调节tabBar上按钮图片的大小
- iOS 调试技巧
- IOS基础之 (八) Foundation框架
- XCode调试中的输出技巧
- iOS部分 理论:
- iOS屏幕适配
- iOS中 简单易懂的秒杀倒计时/倒计时
- iOS中 简单易懂的秒杀倒计时/倒计时