上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 34 下一页
摘要: mian #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { // NSRange范围结构体 NSString* str=@"Object-C is a cool 阅读全文
posted @ 2020-07-08 23:21 逆欢 阅读(130) 评论(0) 推荐(0) 编辑
摘要: main #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { NSArray* array=@[@1,@2,@3,@4];//[NSNumber numberWi 阅读全文
posted @ 2020-07-08 22:22 逆欢 阅读(276) 评论(0) 推荐(0) 编辑
摘要: h #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN //字符串对象 最好使用copy, 防止受外部的影响 @interface Person : NSObject <NSCopying> @property(nonatomic,co 阅读全文
posted @ 2020-07-08 21:39 逆欢 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #import <Foundation/Foundation.h> #import "Person.h" int main(int argc, const char * argv[]) { @autoreleasepool { //自己创建的对象 虽然放在自动释放池中,但是不受管理 加上 autor 阅读全文
posted @ 2020-07-06 22:50 逆欢 阅读(261) 评论(0) 推荐(0) 编辑
摘要: mrc模式下 person.h #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /* @propety 1.原子性 :atomic 线程安全 (默认) nonatomic 执行速度更快 2.对象的所有权 assign 基本数据类型 阅读全文
posted @ 2020-07-06 22:12 逆欢 阅读(316) 评论(0) 推荐(0) 编辑
摘要: c语言中内存管理存在问题 静态内存分配: 局部变量 栈 全局变量 数据区 动态内存分配 堆 内存分配函数 malloc calloc realloc 内存释放 free 使用原则 用完了释放 问题1. 内存泄漏 ,用完了动态分配的内存就不释放,就产生内存泄漏 解决 :用完malloc 用free 问 阅读全文
posted @ 2020-07-04 22:05 逆欢 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 什么是代理? 1.代理(委托):自己不亲身做,让别人做 2.定义了协议的类可以看作将协议定义的方法代理给了实现这些方法的类 boss h #import <Foundation/Foundation.h> #import "Assisant.h" @interface boss : NSObject 阅读全文
posted @ 2020-07-02 23:16 逆欢 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 协议文件 //协议 @protocol IOSBase -(void)knowc; -(void)knowoc; -(void)canDevelopiOS; @end @protocol IOSBaseplus @optional//可选的 -(void)knowcpower; @required/ 阅读全文
posted @ 2020-07-02 22:11 逆欢 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 未命名类别 在()中不指定类别的名字 可以定义附加的实例变量 声明的方法需要在主实现区域实现 实例变量和方法都是私有的 如果想要写一个类,而且数据和方法仅供给这个类本身使用,未命名类比较适合 优点: 分解大块代码 为类做扩展 .h #import <Foundation/Foundation.h> 阅读全文
posted @ 2020-07-01 22:28 逆欢 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 类别的创建 integer.h @interface integer : NSObject @property int integer; @end integer.m @implementation integer @end 类别 integer+display.h integer+display. 阅读全文
posted @ 2020-06-28 22:57 逆欢 阅读(128) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 34 下一页