浮生若梦

凡所有相,皆是虚妄


  • 首页

  • 归档

  • 分类

  • 搜索

weakSelf的几种写法

发表于 2015-05-17   |   分类于 开发那些事 , iOS   |  
1
2
3
__weak typeof(self) weakSelf = self;
__weak __typeof(self) weakSelf = self;
__weak typeof(&*self) weakSelf = self;

参考:
http://www.tuicool.com/articles/bYBB7r

实用的shell命令

发表于 2015-05-14   |   分类于 开发那些事 , Shell   |  

使用上一个命令的参数

1
2
mkdir a b c
rmdir !:1 !:2 !:$

!:n代表上一个命令的第n个参数
!$ 代表上一个命令的最后一个参数
Alt+.也可以试试

iOS Code Snippet

发表于 2015-05-13   |   分类于 开发那些事 , iOS   |  

设置全局UINavigationBar和UITabBar风格

1
2
3
4
5
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:10/255.0f green:10/255.0f blue:10/255.0f alpha:0]];
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:10/255.0 green:10/255.0 blue:10/255.0 alpha:0]];
[[UITabBar appearance] setBarStyle:UIBarStyleDefault];

Objective-C Coding Guidelines In Chinese

发表于 2015-05-13   |  

Objective-C编码规范,内容来自苹果、谷歌的文档翻译,自己的编码经验和对其它资料的总结。

转自https://github.com/QianKaiLu/Objective-C-Coding-Guidelines-In-Chinese

##概要

Objective-C是一门面向对象的动态编程语言,主要用于编写iOS和Mac应用程序。关于Objective-C的编码规范,苹果和谷歌都已经有很好的总结:

  • Apple Coding Guidelines for Cocoa
  • Google Objective-C Style Guide

本文主要整合了对上述文档的翻译、作者自己的编程经验和其他的相关资料,为公司总结出一份通用的编码规范。

阅读全文 »

Git常用命令

发表于 2015-05-13   |   分类于 开发那些事 , Git   |  

取消已经跟踪的文件(目录)

1
2
3
4
// 文件
git rm --cached filename
// 目录
git rm -r --cached dir

isKindOfClass 和 isMemberOfClass 区别

发表于 2015-05-12   |   分类于 开发那些事 , iOS   |  

isKindOfClass

return YES if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class.

isMemberOfClass

return YES if the receiver is an instance of the specified class.

参考:

  • http://stackoverflow.com/a/3653947/3355097
  • https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/index.html

retain、copy、assign、strong、weak区别

发表于 2015-05-07   |   分类于 开发那些事 , iOS   |  

参考:
Objective-C ARC: strong vs retain and weak vs assign

Delegate正确声明方式

发表于 2015-05-07   |   分类于 开发那些事 , iOS   |  

@property (nonatomic, weak) id delegate;

@property (nonatomic, assign) id delegate;

当delegate所指向的对象(0xxxxxxx)已经销毁的时候
weak: delegate == nil
assign:还会指向那个地址(0xxxxxxx)

参考:
Whats the difference between ‘weak’ and ‘assign’ in delegate property declaration

Hello Amy

发表于 2015-05-07   |   分类于 随笔   |  

Hello Amy

今儿去买手机,路上注意安全。

SDWebImage cause error while using XCTest in XCode6.3

发表于 2015-05-06   |   分类于 开发那些事 , iOS   |  

Got the solution finally. select info of the project then select Configuration select the dropdown Debug. From that list select your test target and change the None in Configurations Set Tab into Pods. Do the same in Release Tab also

参考:
AFNetworking Cause Error while using XCTest in Xcode5
CocoaPods’s wiki: multiple-targets may give you some advices

1234
时光

时光

32 日志
12 分类
18 标签
RSS
GitHub StackOverflow Twitter Weibo
© 2012 - 2017 时光
由 Hexo 强力驱动
主题 - NexT.Pisces