iOS学习笔记

来源:互联网 发布:联通软件下载 编辑:程序博客网 时间:2024/06/08 16:21

2016.07.27

均详见syuykt for iOS。

iOS切换页面似乎主要是用UINavigationController来实现,昨天遇到问题,根页面是tab,通过show进入下一级页面结果tabbar依然显示,今天将根更换为nav,解决问题。


iOS全局设置样式,

    [UITabBar appearance].tintColor = UIColorFromRGB(0xb31312);// tabbar 选中颜色    [UINavigationBar appearance].barTintColor = UIColorFromRGB(0xb31312);// nav 背景    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];// nav 返回键颜色    NSDictionary *textAttr = @{NSForegroundColorAttributeName : [UIColor whiteColor]};    [[UINavigationBar appearance] setTitleTextAttributes:textAttr];// nav title字体(此处只是设置了颜色)

设置全局宏方法:新建pch文件。

http://www.jianshu.com/p/52caf0d53762


hex string to UIColor:

#define UIColorFromRGB(rgbValue) \[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \                green:((float)((rgbValue & 0x00FF00) >>  8))/255.0 \                 blue:((float)((rgbValue & 0x0000FF) >>  0))/255.0 \                alpha:1.0]
http://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string

2016.08.01

均详见syuykt for iOS。

NSDictionary to JSONString

http://stackoverflow.com/questions/6368867/generate-json-string-from-nsdictionary-in-ios


2016.08.04

均详见syuykt for iOS。

LaunchScreen.xib只支持iOS8+,所以iOS7需要使用LaunchImage,并且设置仅仅iOS6、7,LaunchScreen可以和LaunchImage同时使用,iOS8+使用xib


Lumberjack可以打印彩色log。

但是首先需要安装插件,下载XcodeColors并编译运行,重启xcode即可。

Lumberjack引入方法为下载源码,引入class文件夹,extension文件夹和swift文件会有问题,删掉。

需要在appdelegate didfinish...里增加代码:

    [DDLog addLogger:[DDTTYLogger sharedInstance]];    [[DDTTYLogger sharedInstance] setColorsEnabled:YES];// 启用颜色区分

然后就可以通过

DDLogError(@"error");

打印log了

https://github.com/CocoaLumberjack/CocoaLumberjack

https://github.com/robbiehanson/XcodeColors

http://www.mamicode.com/info-detail-992023.html


显示函数、行数:

自定义类实现代理DDLogFormatter 的formatLogMessage方法

然后设置

    LineNumberLogFormatter *formatter = [[LineNumberLogFormatter alloc] init];    [[DDTTYLogger sharedInstance] setLogFormatter:formatter];

http://stackoverflow.com/questions/19137867/cocoa-lumberjack-how-to-show-file-and-line-number



0 0