NYTimes Objective-C 编程风格指南
view.backgroundColor = [UIColor orangeColor];
[UIApplication sharedApplication].delegate;
[view setBackgroundColor:[UIColor orangeColor]];
UIApplication.sharedApplication.delegate;
if (user.isHappy) {
//Do something
}
else {
//Do something else
}
if (!error) {
return success;
}
if (!error)
return success;
if (!error) return success;
result = a > b ? x : y;
result = a > b ? x = c > d ? c : d : y;
(void)setExampleText:(NSString *)text image:(UIImage *)image;
NSString *text;
NSString* text;
NSString * text;
@interface NYTSection: NSObject
@property (nonatomic) NSString *headline;
@end
@interface NYTSection : NSObject {
NSString *headline;
}
UIButton *setBut;
static const NSTimeInterval NYTArticleViewControllerNavigationFadeAnimationDuration = 0.3;
static const NSTimeInterval fadetime = 1.7;
@synthesize descriptiveVariableName = _descriptiveVariableName;
id varnm;
NSArray *names = @[@"Brian", @"Matt", @"Chris", @"Alex", @"Steve", @"Paul"];
NSDictionary *productManagers = @{@"iPhone" : @"Kate", @"iPad" : @"Kamal", @"Mobile Web" : @"Bill"};
NSNumber *shouldUseLiterals = @YES;
NSNumber *buildingZIPCode = @10018;
NSArray *names = [NSArray arrayWithObjects:@"Brian", @"Matt", @"Chris", @"Alex", @"Steve", @"Paul", nil];
NSDictionary *productManagers = [NSDictionary dictionaryWithObjectsAndKeys: @"Kate", @"iPhone", @"Kamal", @"iPad", @"Bill", @"Mobile Web", nil];
NSNumber *shouldUseLiterals = [NSNumber numberWithBool:YES];
NSNumber *ZIPCode = [NSNumber numberWithInteger:10018];
CGRect frame = self.view.frame;
CGFloat x = CGRectGetMinX(frame);
CGFloat y = CGRectGetMinY(frame);
CGFloat width = CGRectGetWidth(frame);
CGFloat height = CGRectGetHeight(frame);
CGRect frame = self.view.frame;
CGFloat x = frame.origin.x;
CGFloat y = frame.origin.y;
CGFloat width = frame.size.width;
CGFloat height = frame.size.height;
static NSString * const NYTAboutViewControllerCompanyName = @"The New York Times Company";
static const CGFloat NYTImageThumbnailHeight = 50.0;
#define CompanyName @"The New York Times Company"
#define thumbnailHeight 2
typedef NS_ENUM(NSInteger, NYTAdRequestState) {
NYTAdRequestStateInactive,
NYTAdRequestStateLoading
};
私有属性
@interface NYTAdvertisement ()
@property (nonatomic, strong) GADBannerView *googleAdView;
@property (nonatomic, strong) ADBannerView *iAdView;
@property (nonatomic, strong) UIWebView *adXWebView;
@end
RefreshBarButtonItem / RefreshBarButtonItem@2x and RefreshBarButtonItemSelected / RefreshBarButtonItemSelected@2x
ArticleNavigationBarWhite / ArticleNavigationBarWhite@2x and ArticleNavigationBarBlackSelected / ArticleNavigationBarBlackSelected@2x.
if (!someObject) {
if (someObject == nil) {
}
if (isAwesome)
if (![someObject boolValue])
if ([someObject boolValue] == NO)
if (isAwesome == YES) // Never do this.
@property (assign, getter=isEditable) BOOL editable;
(instancetype)sharedInstance {
static id sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
NYTimes Objective-C 编程风格指南的更多相关文章
- Google Java编程风格指南
出处:http://hawstein.com/posts/google-java-style.html 声明:本文采用以下协议进行授权: 自由转载-非商用-非衍生-保持署名|Creative Comm ...
- Google Java编程风格指南中文版
作者:Hawstein出处:http://hawstein.com/posts/google-java-style.html声明:本文采用以下协议进行授权: 自由转载-非商用-非衍生-保持署名|Cre ...
- Java学习笔记(四)——google java编程风格指南(上)
[前面的话] 年后开始正式上班,计划着想做很多事情,但是总会有这样那样的打扰,不知道是自己要求太高还是自我的奋斗意识不够?接下来好好加油.好好学学技术,好好学习英语,好好学习做点自己喜欢的事情,趁着自 ...
- Java学习笔记(五)——google java编程风格指南(中)
[前面的话] 年后开始正式上班,计划着想做很多事情,但是总会有这样那样的打扰,不知道是自己要求太高还是自我的奋斗意识不够?接下来好好加油.好好学学技术,好好学习英语,好好学习做点自己喜欢的事情,趁着自 ...
- Java学习笔记(六)——google java编程风格指南(下)
[前面的话] 年后开始正式上班,计划着想做很多事情,但是总会有这样那样的打扰,不知道是自己要求太高还是自我的奋斗意识不够?接下来好好加油.好好学学技术,好好学习英语,好好学习做点自己喜欢的事情,趁着自 ...
- MATLAB 编程风格指南及注意事项
MATLAB编程风格指南Richard Johnson 著Genial 译MATLAB 编程风格指南Richard JohnsonVersion 1.5,Oct. 2002版权: Datatool 所 ...
- Swift 编程风格指南(raywenderlich.com 版本号)
官方 raywenderlich.com Swift 编程风格指南 本文版权归 raywenderlich.com .The Official raywenderlich.com Swift Styl ...
- Google的Java编程风格指南(Java编码规范)
这份文档是Google Java编程风格规范的完整定义.当且仅当一个Java源文件符合此文档中的规则, 我们才认为它符合Google的Java编程风格. 与其它的编程风格指南一样,这里所讨论的不仅仅是 ...
- Google C++编程风格指南
作者:Hawstein 出处:http://hawstein.com/posts/google-cpp-style-guide.html 前言 越来越发现一致的编程风格的重要性,于是把Google的C ...
随机推荐
- python与冒泡排序
上一篇文章,介绍了一个非常快的排序算法--桶排序,但是它的缺点就是太耗资源了,这次要实现的算法就不用太耗资源了,它就是冒泡排序. 问题提出: 将以下数据升序排列:9, 2, 8, 6, 4 冒泡排序原 ...
- MYSQL用户权限管理GRANT使用
http://yanue.net/post-97.html GRANT语句的语法: mysql> grant 权限1,权限2,-权限n on 数据库名称.表名称 to 用户名@用户地址 iden ...
- zookeeper的概念和基础
1.1ZooKeeper的使命 当开发人员使用ZooKeeper进行开发时,开发人员设计的那些应⽤往往可以看成成组连接到ZooKeeper服务器端的客户端,它们通过ZooKeeper的客户端API连接 ...
- swagger 接口文档,控制器 和 object类型的参数与返回值 的 注释不显示问题
一.控制器的注释不显示:是因为配置swagger的时候没有将includeControllerXmlComments参数配置为true,因为其默认值为false 二.object 类型的参数和返回值 ...
- Spring -- <context:component-scan>使用说明
在xml配置了这个标签后,spring可以自动去扫描base-pack下面或者子包下面的java文件,如果扫描到有@Component @Controller@Service等这些注解的类,则把这些类 ...
- mysql 挑选列导入
insert into boleht_development.`htprojects`(id,pname,`general`,imgsrc,whatwedo,howwedo,bp) select ci ...
- Eclipse 异常关闭
缺失 Java Builder 造成运行main方法,找不到主类, 系统没有自动编译 在.project 文件中添加 <buildSpec> <buildCommand> &l ...
- [转载]用 FFMPEG 合并 MP4 视频
因为 ffmpeg 是支持切分 mp4 视频的,所以我就理所当然的以为 ffmpeg 是支持视频合并.直到今天同事找我问方法,才发现一直以为的方法是错误的, mp4 不支持直接 concate(丢人了 ...
- vertex shader(4)
Swizzling and Masking 如果你使用输入.常量.临时寄存器作为源寄存器,你可以彼此独立地swizzle .x,.y,.z,.w值.如果你使用输出.临时寄存器作为目标寄存器,你可以把. ...
- Zabbix 监控 Mysql 状态
简介: 如何使用 Zabbix 来监控 Mysql 状态 ? Zabbix 有自带监控 Mysql 的模板,但是却不能直接使用.. 需要我们根据模板提供的 Key 自己写脚本获取数据 1.查看都有哪些 ...