iOS学习笔记

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值