文档章节

Basic Principles in Writing Object-C codes

ChenQi
 ChenQi
发布于 2014/07/30 11:23
字数 141
阅读 24
收藏 0

1. Code should be designed to be read out loud from left to right and make sense.

2. The app needs save critical data it's working on when it's told to enter background, because the app might be terminated while it's suspended.

3. property attributes

strong: variable stays in memory

weak: when the object is deallocated, property variable is set to nil automatically

assign: perform no memory copy

copy: perform memory copy

readwrite: both getter and setter methods are generated

readonly: only getter method is generated

nonatomic: no lock, not thread-safe

4. proptery variable reference

If it's a member of parent class, self.xxxx;

If it's this class' property, _xxxx or self.xxxx, the former is preferred.

If it's not a property, but only a variable, xxxx;






© 著作权归作者所有

ChenQi
粉丝 61
博文 191
码字总数 111579
作品 0
丰台
高级程序员
私信 提问
How to write elegant code?(Part 2)

I have talked about the basic principles。And in this section I am diving into the details, take asynchronous actions and exception as example。 Enjoy yourself~~ 一 asynchrono......

-鹏
2016/07/01
17
1
Language Descriptions(摘自 code complete)

Language Descriptions The development histories of some languages are interesting, as are their general capabilities. Here are descriptions of the most common languages in use t......

面码
2014/05/30
50
0
Reading UTF-8 with C++ streams

Introduction This article is about reading and writing Unicode to character streams in UTF-8 encoding. And as a consequence is about an often mis-known aspect of the C++ STL / I......

小熊猫大暴走
2012/04/26
558
0
Cocos2d-x::Actions

Actions are orders given to a CCNode object.These actions usually modify some of the object's attributes like position, rotation, scale, etc.If these attributes are modified dur......

小小霸王枪
2013/12/23
68
0
JavaScript Promises 学习笔记

本文是 ECMAScript 2015 原生异步方法 Promise 的学习笔记。网上课程由 Udacity + Google 提供,老师是卡梅伦·皮特曼(Cameron Pittman)。 学习笔记分为 8 个部分: callbacks vs thens P...

HongyangWang
2017/04/23
0
0

没有更多内容

加载失败,请刷新页面

加载更多

ES6

ES6:不改变原理的基础上,让API变得更简单 一、let:代替var用于声明变量 1、var的缺点: (1)声明提前 (2)没有块级作用域 2、let的优点: (1)组织了申明提前 (2)让let所在的块({}),...

wytao1995
今天
3
0
kubernetes 环境搭建 —— minikube

创建集群 minikube start 搭建好 k8s 集群后,可以查看集群的状态以及部署应用。主要用到的是 k8s 的 api,这通常需借助于 kutectl 命令行工具 基本操作 kubectl versionkubectl cluster-i...

lemos
今天
9
0
关于js混淆与反混淆还原操作

使用js的混淆加密,其目的是为了保护我们的前端代码逻辑,对应一些搞技术吃饭的公司来说,为了防止被竞争对手抓取或使用自己的代码,就会考虑如何加密,或者混淆js来达到代码保护。 1、为什么...

开源oschina
今天
11
0
用盛金公式解三次方程(ansi c版)

/* cc cubic.c -lm gcc cubic.c -lm Shengjin's Formulas Univariate cubic equation aX ^ 3 + bX ^ 2 + cX + d = 0, (a, b, c, d < R, and a!= 0). Multiple root disc......

wangxuwei
今天
9
0
JBolt开发平台入门(16)- 弹出Dialog显示指定区域的html内容

在JBolt里,有个主从表Demo。 子表中除了普通的table显示,还有其它从表显示形式 比如下方案例:是针对一个升级管理子表中存放版本的changelog富文本信息。 需求是点击左上角的弹出查看按钮,...

山东-小木
今天
46
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部