FMDB Model

配置cocoaPods配置第三方文件

第一步。打開終端

第二步婚苹。cd+文件夾

第三步浪漠。pod init

第四步。打開podfild文件

第五步朴艰。pod install 安裝第三方


展示界面oneviewcontroll:

#import "OneViewController.h"

#import "FMDateFiction.h"

#import "FMDateFictionModel.h"

#import "tianjiaViewController.h"

#import "xiugaiViewController.h"

{

UITableView *theTable;

NSArray *theArr;

}

-(void)viewWillAppear:(BOOL)animated

{

theArr = [[FMDateFiction sharedFM]getAll];

[theTable reloadData];

}

- (void)viewDidLoad {

[super viewDidLoad];

self.view.backgroundColor = [UIColor whiteColor];

theTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)style:UITableViewStyleGrouped];

theTable.delegate = self;

theTable.dataSource =self;

theTable.rowHeight = 80;

[self.view addSubview:theTable];

self.navigationItem.title = @"物流信息";

UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"添加" style:UIBarButtonItemStylePlain target:self action:@selector(onClickedOKbtn)];

self.navigationItem.rightBarButtonItem = rightBarItem;

}

-(void)onClickedOKbtn

{

NSLog(@"添加");

tianjiaViewController *theT = [[tianjiaViewController alloc]init];

[self.navigationController pushViewController:theT animated:NO];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

return theArr.count;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

static NSString *Str = @"Cell";

UITableViewCell *theTVC = [tableView dequeueReusableCellWithIdentifier:Str];

if (!theTVC) {

theTVC = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];

}

FMDateFictionModel *theModel = theArr[indexPath.row];

NSString *ss = [NSString stringWithFormat:@"類型:%@? 收人:%@? 手機號:%@",theModel.theFenglei,theModel.theShouHuoRen,theModel.theDianHua];

theTVC.textLabel.text =ss;

NSString *theSS = [NSString stringWithFormat:@"收獲地址:%@? ? 備注:%@",theModel.theDiZhi,theModel.theBeiZhu];

theTVC.detailTextLabel.text = theSS;

return theTVC;

}

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

{

FMDateFictionModel *m = [theArr objectAtIndex:indexPath.row];

[[FMDateFiction sharedFM]deleteMusic:m];

theArr = [[FMDateFiction sharedFM]getAll];

[theTable reloadData];

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

xiugaiViewController *theXG = [[xiugaiViewController alloc]init];

[self.navigationController pushViewController:theXG animated:NO];

}

在ViewControll里:


tianjiaViewController:


self.view.backgroundColor = [UIColor whiteColor];

theYoujian = [[UITextField alloc]initWithFrame:CGRectMake(50, 100, self.view.frame.size.width-100, 40)];

theYoujian.backgroundColor = [UIColor greenColor];

theYoujian.placeholder = @"型";

[self.view addSubview:theYoujian];

thedizhi = [[UITextField alloc]initWithFrame:CGRectMake(50, 150, self.view.frame.size.width-100, 40)];

thedizhi.backgroundColor = [UIColor greenColor];

thedizhi.placeholder = @"收";

[self.view addSubview:thedizhi];

theshouren = [[UITextField alloc]initWithFrame:CGRectMake(50, 200, self.view.frame.size.width-100, 40)];

theshouren.backgroundColor = [UIColor greenColor];

theshouren.placeholder = @"人";

[self.view addSubview:theshouren];

thedianhua = [[UITextField alloc]initWithFrame:CGRectMake(50, 250, self.view.frame.size.width-100, 40)];

thedianhua.backgroundColor = [UIColor greenColor];

thedianhua.placeholder = @"話";

[self.view addSubview:thedianhua];

thebeizhu = [[UITextField alloc]initWithFrame:CGRectMake(50, 300, self.view.frame.size.width-100, 40)];

thebeizhu.backgroundColor = [UIColor greenColor];

thebeizhu.placeholder = @"注";

[self.view addSubview:thebeizhu];

UIButton *theyanzheng = [[UIButton alloc]initWithFrame:CGRectMake(100, 350, self.view.frame.size.width-200, 40)];

theyanzheng.backgroundColor = [UIColor redColor];

[theyanzheng setTitle:@"添加" forState:UIControlStateNormal];

[theyanzheng addTarget:self action:@selector(tianjia) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:theyanzheng];

}

-(void)tianjia

{

FMDateFictionModel *theModel = [[FMDateFictionModel alloc]init];

theModel.theFenglei = theYoujian.text;

theModel.theShouHuoRen = theshouren.text;

theModel.theDiZhi = thedizhi.text;

theModel.theDianHua = thedianhua.text;

theModel.theBeiZhu = thebeizhu.text;

[[FMDateFiction sharedFM]insertMusic:theModel];

[self.navigationController popViewControllerAnimated:NO];

}

xiugaiViewController里:


FMDateFictionModel.h里:


FMDateFictionModel.m里


FMDateFictionmodel.h里:


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末观蓄,一起剝皮案震驚了整個濱河市混移,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌侮穿,老刑警劉巖歌径,帶你破解...
    沈念sama閱讀 219,589評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異亲茅,居然都是意外死亡沮脖,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,615評論 3 396
  • 文/潘曉璐 我一進店門芯急,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人驶俊,你說我怎么就攤上這事娶耍。” “怎么了饼酿?”我有些...
    開封第一講書人閱讀 165,933評論 0 356
  • 文/不壞的土叔 我叫張陵榕酒,是天一觀的道長。 經(jīng)常有香客問我故俐,道長想鹰,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,976評論 1 295
  • 正文 為了忘掉前任药版,我火速辦了婚禮辑舷,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘槽片。我一直安慰自己何缓,他們只是感情好,可當我...
    茶點故事閱讀 67,999評論 6 393
  • 文/花漫 我一把揭開白布还栓。 她就那樣靜靜地躺著碌廓,像睡著了一般。 火紅的嫁衣襯著肌膚如雪剩盒。 梳的紋絲不亂的頭發(fā)上谷婆,一...
    開封第一講書人閱讀 51,775評論 1 307
  • 那天,我揣著相機與錄音辽聊,去河邊找鬼纪挎。 笑死,一個胖子當著我的面吹牛身隐,可吹牛的內(nèi)容都是我干的廷区。 我是一名探鬼主播,決...
    沈念sama閱讀 40,474評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼贾铝,長吁一口氣:“原來是場噩夢啊……” “哼隙轻!你這毒婦竟也來了埠帕?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,359評論 0 276
  • 序言:老撾萬榮一對情侶失蹤玖绿,失蹤者是張志新(化名)和其女友劉穎敛瓷,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體斑匪,經(jīng)...
    沈念sama閱讀 45,854評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡呐籽,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,007評論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了蚀瘸。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片狡蝶。...
    茶點故事閱讀 40,146評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖贮勃,靈堂內(nèi)的尸體忽然破棺而出贪惹,到底是詐尸還是另有隱情,我是刑警寧澤寂嘉,帶...
    沈念sama閱讀 35,826評論 5 346
  • 正文 年R本政府宣布奏瞬,位于F島的核電站,受9級特大地震影響泉孩,放射性物質(zhì)發(fā)生泄漏硼端。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,484評論 3 331
  • 文/蒙蒙 一寓搬、第九天 我趴在偏房一處隱蔽的房頂上張望珍昨。 院中可真熱鬧,春花似錦句喷、人聲如沸曼尊。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,029評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽骆撇。三九已至,卻和暖如春父叙,著一層夾襖步出監(jiān)牢的瞬間神郊,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,153評論 1 272
  • 我被黑心中介騙來泰國打工趾唱, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留涌乳,地道東北人。 一個月前我還...
    沈念sama閱讀 48,420評論 3 373
  • 正文 我出身青樓甜癞,卻偏偏與公主長得像夕晓,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子悠咱,可洞房花燭夜當晚...
    茶點故事閱讀 45,107評論 2 356

推薦閱讀更多精彩內(nèi)容