Persistence Layer Note DAO h interface Note DAO
- Slides: 37
Persistence Layer(数据持久� )
Note. DAO. h代� @interface Note. DAO : NSObject //保存数据列表 @property (nonatomic, strong) NSMutable. Array* list. Data; + (Note. DAO*)shared. Manager; //插入Note方法 -(int) create: (Note*)model; //� 除Note方法 -(int) remove: (Note*)model; //修改Note方法 -(int) modify: (Note*)model; //�� 所有数据方法 -(NSMutable. Array*) find. All; //按照主��� 数据方法 -(Note*) find. By. Id: (Note*)model; @end 16 智捷i. OS� 堂
� 例�� DAO static Note. DAO *shared. Manager = nil; + (Note. DAO*)shared. Manager { static dispatch_once_t once; dispatch_once(&once, ^{ shared. Manager = [[self alloc] init]; . . . }); return shared. Manager; } 17 智捷i. OS� 堂
插入和� 除方法 //插入Note方法 -(int) create: (Note*)model { [self. list. Data add. Object: model]; return 0; } //� 除Note方法 -(int) remove: (Note*)model { for (Note* note in self. list. Data) { //比� 日期主� 是否相等 if ([note. date is. Equal. To. Date: model. date]){ [self. list. Data remove. Object: note]; break; } } return 0; } 18 智捷i. OS� 堂
修改方法 //修改Note方法 -(int) modify: (Note*)model { for (Note* note in self. list. Data) { //比� 日期主� 是否相等 if ([note. date is. Equal. To. Date: model. date]){ note. content = model. content; break; } } return 0; } 19 智捷i. OS� 堂
�� 方法 //�� 所有数据方法 -(NSMutable. Array*) find. All { return self. list. Data; } //按照主��� 数据方法 -(Note*) find. By. Id: (Note*)model { for (Note* note in self. list. Data) { //比� 日期主� 是否相等 if ([note. date is. Equal. To. Date: model. date]){ return note; } } return nil; } 20 智捷i. OS� 堂
Domain中Note // // Note. h #import <Foundation/Foundation. h> @interface Note : NSObject @property(nonatomic, strong) NSDate* date; @property(nonatomic, strong) NSString* content; @end // // Note. m #import "Note. h" @implementation Note @end 21 智捷i. OS� 堂
Business. Logic Layer(����� )
Note. BL. m //插入Note方法 -(NSMutable. Array*) create. Note: (Note*)model { Note. DAO *dao = [Note. DAO shared. Manager]; [dao create: model]; return [dao find. All]; } //� 除Note方法 -(NSMutable. Array*) remove: (Note*)model { Note. DAO *dao = [Note. DAO shared. Manager]; [dao remove: model]; return [dao find. All]; } //�� 所有数据方法 -(NSMutable. Array*) find. All { Note. DAO *dao = [Note. DAO shared. Manager]; return [dao find. All]; } 24 智捷i. OS� 堂
Presentation Layer(表示� )
App. Delegate. h和App. Delegate. m,� 用程序委托� 象; Master. View. Controller. h和Master. View. Controller. m,Master�� 控制器; Detail. View. Controller. h和Detail. View. Controller. m,Detail�� 控制器; Add. View. Controller. h和Add. View. Controller. m,Add�� 控制器; Main. Storyboard_i. Phone. storyboard,i. Phone版的故事板文件; Main. Storyboard_i. Pad. storyboard,i. Pad版的故事板文件。 26 智捷i. OS� 堂
判断�� if ([[UIDevice current. Device] user. Interface. Idiom] == UIUser. Interface. Idiom. Phone) { CGSize screen. Size = [[UIScreen main. Screen] bounds]. size; // i. Phone�� if (screen. Size. height > 480. 0 f) { // i. Phone 5 �� } else { // i. Phone 5 之前�� } } else { // i. Pad �� } 27 智捷i. OS� 堂
�� Tel: 158 -0157 -7739 Mail: ios@51 work 6. com 新浪微博:@tony_关� 升 博客:CSDN:http: //blog. csdn. net/tonny_guan 51 CTO:http: //2009315319. blog. 51 cto. com/
- Admek technologies
- An interface
- Interface in java
- Areas of the screen that behave as if they were independent
- Office interface vs industrial interface
- Layer 2 vs layer 3 bitstream
- Secure socket layer and transport layer security
- Secure socket layer and transport layer security
- Presentation layer functions
- Layer 2 e layer 3
- Fig 19
- Secure socket layer and transport layer security
- Layer-by-layer assembly
- How are glands classified
- Secure socket layer and transport layer security
- Thickness formula
- Goods received note
- Simple discount rate formula
- Difference between note making and note taking
- Debit note and credit note
- Signal word
- Debit note là gì
- Difference between note making and note taking
- Relevance of note making
- Object persistence in java
- Persistence paměti
- Salvador dali nacio en
- Breana samayoa
- Memory is the persistence of learning over time
- Persistence of memory art movement
- The persistence of learning over time
- Ian frankenburg
- Widening cast
- Herança jpa
- Object persistence formats
- Persistence gwanyanya
- Persistence weather forecasting
- What is the persistence of learning over time