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 ...
随机推荐
- 第九章 消息总线: Spring Cloud Bus
在微服务架构的系统中, 我们通常会使用轻量级的消息代理来构建一个共用的消息主题让系统中所有微服务实例都连接上来, 由于该主题中产生的消息会被所有实例监听和消费, 所以我们称它为消息总线. 在总线上的各 ...
- python中nltk的下载安装方式
首先去http://nltk.org/install.html下载相关的安装程序,然后 在cmd窗口中,进入到python的文件夹内的 Scripts内,运行easy_install pip 安装Py ...
- kali2.0安装及使用笔记(附带vim配置,长期更新)
作者:陈栋权 时间:16/08/19 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明, 且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利. 如有特别用途,请与我联系邮 ...
- datagridview绑定xml
//加载描述的XML private bool loadXML() { //创建DataTable对象dt DataTable dt = new DataTable("clientXML&q ...
- 在线程中调用其它主界面的模块,因为中间有休息1000ms,所以调用前要检查DateTimeRun变量;在From_load 启动线程;在From_closing From_closed 设置DateTimeRun=false
//系统启动后,自动启动时钟 void jishi_kernel() { try { while (DateTimeRun) { Thread.Sleep(); if (myRunning) Runn ...
- 左侧倒换菜单 frameset 已过时
<!doctype html><html><frameset cols="200,*"> <frame src="left.ht ...
- DAVINCI开发原理
本文中约定: [host] 表示主机PC机Linux [target] 表示目标板Linux DAVINCI开发原理之一----ARM端开发环境的建立(DVEVM) 1. 对DAVINCI平台,TI在 ...
- Perl 获取时间函数
Perl 时间日期 Perl中处理时间的函数有如下几种: 1.time() 函数:返回从1970年1月1日起累计的秒数 2.localtime() 函数:获取本地时区时间(多用这个) ...
- 【BZOJ2780】Sevenk Love Oimaster【广义后缀自动机】
题意 给出你n个字符串和q个查询,每个查询给出一个字符串s,对于每个查询你都要输出这个字符串s在上面多少个字符串中出现过. 分析 广义后缀自动机的裸题.建好SAM以后再跑一遍得到每个状态的ocu和la ...
- 92. Reverse Linked List II (List)
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1-> ...