1. When processing constant volume data using Fmdb, the data must be encapsulated as an object, or the program will crash and error. For example, when I want to store a bool value in the database, I need to do these things:
-(BOOL) Insertnewmodeldatatodatabase: (Flower *) flower{fmdatabase*db =[Fmdatabase DatabaseWithPath:self.databasePath]; if(! [DB Open])returnNO; int isnotification = (flower.neednotification)? 1:0; BOOL Success= [db executeupdate:@"INSERT into flowers (name, soil, date, time, pic, Noti) VALUES (?,?,?,?,?,?)", Flower.name, Flower.soil, Flower.date, Flower.time, Flower.pic, [NSNumber numberwithint:isnot Ification]]; [DB close]; if(!success) NSLog (@"%@", [DB lasterrormessage]); returnYES;}
2. How to remove the blank of the UITableViewCell line, add the following code:
#pragmaMark displays the full split line (clear left blank)-(void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) indexpath{if([Cell Respondstoselector: @selector (setseparatorinset:)]) {[Cell Setseparatorinset:uiedgeinsetszero]; } if([Cell Respondstoselector: @selector (setlayoutmargins:)]) {[Cell Setlayoutmargins:uiedgeinsetszero]; }}- (void) viewdidlayoutsubviews{if([Self.detailtableview respondstoselector: @selector (setseparatorinset:)]) {[Self.detailtableview setSeparator Inset:uiedgeinsetszero]; } if([Self.detailtableview respondstoselector: @selector (setlayoutmargins:)]) {[Self.detailtableview Setlayoutmarg Ins:uiedgeinsetszero]; }}
Learn essay notes (not organized)