快速掌握 ObjectiveC (For C/C++ developer)

Objective-C
 
Objective-C学习之旅(四)----内存管理2----retain点语法
摘要: 一、retain属性的主要作用 1、O-C内存管理和点语法 1>OC内存管理正常情况要使用大量的retain和relrese操作 2>点语法可以减少使用retain和release的操作二、@property(retain)编译器如何申明 编译器对于@property中的retain展开是不一样的 主要是要释放上一次的值,增加本次计数器 在dog.h中声明的: @property(retain)Dog *dog; 展开后为: -(void) setDog:(Dog *)aDog; -(Dog *)dog;三、@synthesize编译器如何实现展开 在dog.m中...阅读全文
posted @ 2012-12-23 13:32 caishuhua226 阅读(256) | 评论 (2) 编辑
 
Objective-C学习之旅(三)----内存管理1--点语法
摘要: 1、点语法及其好处 1、方便程序员能够很快的转到O-C上来 2、让程序设计简单化 3、隐藏了内存管理细节 4、隐藏了多线程、同步、加锁细 节 5、点语法的使用 Dog *dog=[[Dog aloc] init]; [dog setAge:100]; int dogAge=[dog age]; NSLog(@"Dog Age is %d",dogAge); 下面的代码用点语法 dog.age=200;//调用setAge方法 dogAge=dog.age;//调用age方法 这里的点不上调用的dog这个对象的字段,而且在调用方法。dog.age是在调用setAge这个...阅读全文
posted @ 2012-12-23 00:33 caishuhua226 阅读(397) | 评论 (0) 编辑
 
Objective-C学习之旅(二)----函数、类、作用域
摘要: 1、面向对象概述比较项目 OC基类 NSObject单继承 是单继承接口 支持接口(协议)@protocol多继承 使用接口来实现多继承多态 支持多态抽象类 支持抽象类异常处理 简单的异常处理@try @catch @finally虚函数 所有的函数都是虚函数头文件 #import2、OC有别于C/C++的一些比较 1、BOOL YES NO 在oc中布尔类型是BOOL,布尔值是yes,no 2、id类型 O-C中每个目标都可以表达为id类型,可以认为是NSObject*或者是voi...阅读全文
posted @ 2012-12-22 23:03 caishuhua226 阅读(45) | 评论 (0) 编辑
 
Object-C学习之旅(一)----纠错篇---the running destination my Mac 64-bit is not valid for running the scheme
摘要: 1、问题描述the running destination my Mac 64-bit is not valid for running the scheme2、solutionSolution,to change the Base SDK Version: 1) Click on the project icon in the left hand panel. 2) In the right hand panel that appears, select Build Settings » all. 3) You'll see the option to change the阅读全文
posted @ 2012-12-13 16:37 caishuhua226 阅读(7) | 评论 (0) 编辑
 
快速掌握 Objective-C (For C/C++ developer)
摘要: 本文通过触类旁通的启发方式,方便具备C/C++经验的筒子们快速掌握Objective-C。基本语法首先看一段简单的Objective-C的代码.Objective-C支持和C++一样的分离编译模式。C++中是*.h和*.cpp文件; Objective-C是 *.h和 *.m文件来组成一个类。下面是Rectangle.h文件[html] view plaincopyprint?#import <Foundation/NSObject.h> @interface Rectangle: NSObject { int width; int height; @private int pri阅读全文
posted @ 2012-12-12 16:17 caishuhua226 阅读(10) | 评论 (0) 编辑
 
原文地址:https://www.cnblogs.com/Leo_wl/p/2830124.html