strong:適用於OC對象,作用和非ARC中的retain作用相同,它修飾的成員變數為強指標類型weak:適用於OC對象,作用和非ARC中的assign作用相同,修飾的成員變數為弱指標類型assging:適用於非OC物件類型 在OC對象循環參考的時候一端為strong類型,另一段為weak類型 範例程式碼如下:複製代碼複製代碼/****************************** Teacher.h檔案 ***********************************/#import <Foundation/Foundation.h>@class Student;@interface Teacher : NSObject@property (nonatomic,strong) Student *student;@property (nonatomic,strong) NSString *teacherName;@end /****************************** Teacher.m檔案 ***********************************/#import "Teacher.h"#import "Student.h"@implementation Teacher- (void)dealloc{ NSLog(@"叫%@的Teacher對象被銷毀了",_teacherName);}@end /****************************** Student.h檔案 ***********************************/#import <Foundation/Foundation.h>@class Teacher;@interface Student : NSObject@property (nonatomic,weak) Teacher *teahcher;@property (nonatomic,strong) NSStirng *studentName;@end /****************************** Student.m檔案 ***********************************/#import "Student.h"#import "Teacher.h"@implementation Student- (void)dealloc{ NSLog(@"叫%@的Student對象被銷毀了",_stuName);}@end /****************************** main.m檔案 ***********************************/#import <Foundation/Foundation.h>#import "Teacher.h"#import "Student.h"int main(int argc, const char * argv[]){ Teacher *teacher = [[Teacher alloc] init]; teacher.teacherName = @"張老師"; Student *student = [[Student alloc] init]; student.stuName = @"李同學"; // Student類對象中的Teacher屬性為弱引用 student.teahcher = teacher; // Teacher類對象中的Student屬性為強引用 teacher.student = student; return 0;}