PDFListViewController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. //
  2. // PDFListViewController.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 11/23/15.
  6. // Copyright © 2015 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "PDFListViewController.h"
  9. #import "PDFListTableViewCell.h"
  10. #import "iSalesNetwork.h"
  11. #import "PDFViewController.h"
  12. #import "MainViewController.h"
  13. #import "DefaultAppearance.h"
  14. #import "DefaultTableHeaderView.h"
  15. @interface PDFListViewController ()
  16. @end
  17. @implementation PDFListViewController
  18. -(void) logout
  19. {
  20. self.offset = 0;
  21. self.limit = 25;
  22. [self.content_data removeAllObjects];
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. self.offset = 0;
  27. self.limit = 25;
  28. self.content_data = [[NSMutableArray alloc]init];
  29. UIRefreshControl *ref = [[UIRefreshControl alloc]init];
  30. ref.tag = 201 ;
  31. ref.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
  32. ref.tintColor = [UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7];
  33. // ref.hidden = true;
  34. [ref addTarget:self action:@selector(manually_refresh) forControlEvents:UIControlEventValueChanged];
  35. [self.table addSubview:ref];
  36. self.label_net_err.layer.borderColor = [UIColor darkGrayColor].CGColor;
  37. self.label_net_err.layer.borderWidth = 2.0;
  38. self.label_net_err.layer.cornerRadius=15;
  39. self.label_net_err.layer.masksToBounds=true;
  40. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
  41. // tap.minimumPressDuration = 0.8; //定义按的时间
  42. [self.label_net_err addGestureRecognizer:tap];
  43. // Do any additional setup after loading the view.
  44. }
  45. - (void)didReceiveMemoryWarning {
  46. [super didReceiveMemoryWarning];
  47. // Dispose of any resources that can be recreated.
  48. }
  49. -(void) reload_container_getdata:(bool) update_data
  50. {
  51. [super reload_container_getdata:update_data];
  52. if(update_data)
  53. {
  54. self.offset = 0;
  55. [self.content_data removeAllObjects];
  56. self.norefresh=true;
  57. [self loadpage];
  58. }
  59. else
  60. [self.table reloadData];
  61. }
  62. - (void)viewWillAppear:(BOOL)animated
  63. {
  64. [super viewWillAppear:animated];
  65. // if(!self.norefresh)//避免 多次刷新
  66. // {
  67. // self.norefresh = true;
  68. // self.offset = 0;
  69. // [self.content_data removeAllObjects];
  70. // [self loadpage];
  71. //
  72. // }
  73. [[self navigationController] setNavigationBarHidden:YES animated:NO];
  74. }
  75. -(void)manually_refresh
  76. {
  77. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:201];
  78. if(self.isrefreshing)
  79. {
  80. [reF endRefreshing];
  81. return;
  82. }
  83. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Refreshing"];
  84. [self performSelector:@selector(ReloadData) withObject:nil afterDelay:1];
  85. }
  86. -(void)ReloadData
  87. {
  88. [self.content_data removeAllObjects];
  89. [self.table reloadData];
  90. // self.table_order.hidden = true;
  91. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:201];
  92. [reF endRefreshing];
  93. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
  94. self.keywords=self.searchbar.text;
  95. self.offset = 0;
  96. // [self.content_data removeAllObjects];
  97. // [self.table_order reloadData];
  98. [self loadpage];
  99. // [self loadpage];
  100. }
  101. -(void) loadpage
  102. {
  103. dispatch_async(dispatch_get_main_queue(), ^{
  104. if(self.isrefreshing)
  105. return;
  106. self.label_net_err.hidden=true;
  107. self.isrefreshing=true;
  108. self.table.hidden =true;
  109. self.mum.center = self.view.center;
  110. self.mum.hidden = false;
  111. [self.mum startAnimating];
  112. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  113. NSMutableDictionary* content=nil;
  114. content=[[iSalesNetwork request_PDFList:self.offset limit : self.limit keywords:self.keywords] mutableCopy];
  115. dispatch_async(dispatch_get_main_queue(), ^{
  116. [self.mum stopAnimating];
  117. int result=[[content valueForKey:@"result"] intValue];
  118. if(result==2||result==0)
  119. {
  120. self.table.hidden =false;
  121. int count = [[content valueForKey:@"count" ] intValue] ;
  122. // self.time_zone = [content valueForKey:@"time_zone" ];
  123. self.offset += count;
  124. for(int i=0;i<count;i++)
  125. {
  126. NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
  127. [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
  128. }
  129. if(count<self.limit)
  130. {
  131. // int i =self.btnrefresh.state;
  132. self.load_more_hint=@"All loaded";
  133. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
  134. // [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
  135. }
  136. else
  137. {
  138. self.load_more_hint=@"Load more...";
  139. // self.btnrefresh.enabled = true;
  140. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
  141. // [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
  142. }
  143. [self.table reloadData ];
  144. }
  145. else if(result==RESULT_NET_ERROR)
  146. {
  147. self.label_net_err.hidden=false;
  148. self.table.hidden=true;
  149. }
  150. else
  151. {
  152. [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Portfilio List" controller:self] ;
  153. }
  154. // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  155. // bool autologin =[defaults boolForKey:@"autologin"];
  156. // if(!autologin)
  157. // {
  158. // TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
  159. // [self presentViewController:viewController animated:YES completion:^{
  160. //
  161. // }];
  162. // }
  163. self.isrefreshing=false;
  164. });
  165. });
  166. });
  167. }
  168. - (void)loadmore
  169. {
  170. // self.btnrefresh.enabled = NO;
  171. // self.btnrefresh.titleLabel.text =NSLocalizedString(@"loading",nil);
  172. // [self.btnrefresh setTitle:@"Loading..." forState:UIControlStateNormal];
  173. [self loadpage];
  174. }
  175. /*
  176. #pragma mark - Navigation
  177. // In a storyboard-based application, you will often want to do a little preparation before navigation
  178. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  179. // Get the new view controller using [segue destinationViewController].
  180. // Pass the selected object to the new view controller.
  181. }
  182. */
  183. #pragma mark - Table view data source
  184. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
  185. {
  186. return 66;
  187. }
  188. //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  189. //{
  190. // return 0;
  191. //}
  192. //- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  193. //{
  194. // return 0;
  195. //}
  196. //- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  197. //{
  198. // UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  199. // return myView;
  200. //
  201. //}
  202. - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  203. {
  204. NSString* value =[DefaultAppearance get_noneappearance_value:@"DefaultTableHeaderView" valuename:@"title_text_color"];
  205. if(value==nil)
  206. value=@"";
  207. unsigned long color = strtoul([value UTF8String],0,16);
  208. DefaultTableHeaderView* myView = [[DefaultTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 0.0001)];
  209. // myView.backgroundColor = UIColorFromRGB(color);
  210. myView.layer.shadowColor = [UIColor blackColor].CGColor;
  211. myView.layer.shadowOffset = CGSizeMake(0, 0);
  212. myView.layer.shadowOpacity = 0.5;
  213. myView.layer.shadowRadius = 2.0;
  214. UILabel *namelabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 11, 75, 22)];
  215. namelabel.textColor=UIColorFromRGB(color);
  216. namelabel.backgroundColor = [UIColor clearColor];
  217. namelabel.text=NSLocalizedString(@"Name", nil);
  218. [namelabel sizeToFit];
  219. [myView addSubview:namelabel];
  220. // UILabel *solabel = [[UILabel alloc] initWithFrame:CGRectMake(173, 5.5, 130, 22)];
  221. // solabel.textColor=[UIColor whiteColor];
  222. // solabel.backgroundColor = [UIColor clearColor];
  223. // solabel.text=NSLocalizedString(@"Name", nil);
  224. // [solabel sizeToFit];
  225. // [myView addSubview:solabel];
  226. UILabel *notelabel = [[UILabel alloc] initWithFrame:CGRectMake(250, 11, 75, 22)];
  227. notelabel.textColor=UIColorFromRGB(color);
  228. notelabel.backgroundColor = [UIColor clearColor];
  229. notelabel.text=NSLocalizedString(@"Notes", nil);
  230. [notelabel sizeToFit];
  231. [myView addSubview:notelabel];
  232. UILabel *timelabel = [[UILabel alloc] initWithFrame:CGRectMake(553,11, 148, 22)];
  233. timelabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin;
  234. timelabel.textColor=UIColorFromRGB(color);
  235. timelabel.backgroundColor = [UIColor clearColor];
  236. timelabel.text=@"Create time";
  237. [timelabel sizeToFit];
  238. [myView addSubview:timelabel];
  239. myView.autoresizesSubviews=true;
  240. // [myView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
  241. // modellabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  242. // pricelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  243. // timelabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  244. myView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
  245. //
  246. return myView;
  247. }
  248. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  249. {
  250. return 44;
  251. }
  252. //
  253. //- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  254. // if(section==0)
  255. // return nil;
  256. // else
  257. // return @"detail section";
  258. //}
  259. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  260. {
  261. return 1;
  262. }
  263. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  264. {
  265. // NSDictionary * item_json = [self.content_data objectForKey:@"items"];
  266. if( self.content_data.count==0)
  267. return 0;
  268. return self.content_data.count+1;
  269. }
  270. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  271. {
  272. // if(tableView==self.itemListTable)
  273. // {
  274. // if(indexPath.row>self.content_data.count)
  275. // {
  276. // int debug=true;
  277. // }
  278. // NSLog(@"row %ld",(long)indexPath.row);
  279. if(indexPath.row==self.content_data.count)
  280. {
  281. UITableViewCell *moreCell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"mores"];
  282. UILabel *moreDataLabel=[[UILabel alloc] init];
  283. moreDataLabel.tag=200;
  284. moreDataLabel.text=self.load_more_hint;
  285. [moreDataLabel setFont:[UIFont systemFontOfSize:14.0f]];
  286. [moreDataLabel setTextAlignment:NSTextAlignmentCenter];
  287. moreDataLabel.frame=CGRectMake(0, 10, self.table.bounds.size.width, 20);
  288. [moreDataLabel setBackgroundColor:[UIColor clearColor]];
  289. // [moreDataLabel addTarget:self action:@selector(changeCell) forControlEvents:UIControlEventValueChanged];
  290. [moreCell.contentView addSubview:moreDataLabel];
  291. if([self.load_more_hint isEqualToString:@"Load more..."])
  292. [self performSelector:@selector(loadmore) withObject:nil afterDelay:1];
  293. // NSLog(@"更多...");
  294. moreCell.backgroundColor = [UIColor whiteColor];
  295. return moreCell;
  296. }
  297. else
  298. {
  299. NSString *CellIdentifier = @"PDFListTableViewCell";
  300. PDFListTableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  301. // int _id= [[self.content_data[indexPath.row] valueForKey:@"_id"] intValue];
  302. NSString* name= [self.content_data[indexPath.row] valueForKey:@"tear_name"];
  303. NSString* note= [self.content_data[indexPath.row] valueForKey:@"tear_note"];
  304. NSString* create_time= [self.content_data[indexPath.row] valueForKey:@"create_time"];
  305. // NSString* type = [self.content_data[indexPath.row] valueForKey:@"type"] ;
  306. // NSString* file_name = [self.content_data[indexPath.row] valueForKey:@"file_name"];
  307. cell.labelName.text = name;
  308. cell.labelTime.text = create_time;
  309. cell.labelNote.text = note;
  310. // cell.labelType.text = type;
  311. // cell.labelprice.text=price;
  312. // cell.label_date.text=purchase_time;
  313. // cell.label_contact.text=customer_name;
  314. // cell.label_model.text = model_count;
  315. //
  316. // cell.label_status.text=status;
  317. cell.backgroundColor = [UIColor whiteColor];
  318. return cell;
  319. }
  320. // NSDictionary * item_json = [self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
  321. // NSDictionary * combine_json =[item_json objectForKey:@"combine"];
  322. // cell.bundle_item=combine_json;
  323. // NSString* img_url = [item_json valueForKey:@"img_url"];
  324. // NSString* description = [item_json valueForKey:@"description"];
  325. // // NSString* identifier = [item_json valueForKey:@"identifier"];
  326. // // NSString* attribute = [item_json valueForKey:@"attribute"];
  327. // NSString* currency = [item_json valueForKey:@"currency"];
  328. // int count =[[item_json valueForKey:@"count"] intValue];
  329. // double price =[[item_json valueForKey:@"price"] doubleValue];
  330. // // cell.labelAttribute.text = attribute;
  331. // cell.labelCurrency.text = currency;
  332. // cell.labelDescription.text = description;
  333. // // cell.labelIdentifier.text = identifier;
  334. // cell.labelPrice.text = [NSString stringWithFormat:@"%.2f",price];
  335. //
  336. //
  337. //
  338. // [cell set_Count:count];
  339. // NSString* file_name=[img_url lastPathComponent];
  340. // NSData* img_data=[iSalesDB load_cached_img:file_name];
  341. // if(img_data!=nil)
  342. // {
  343. //
  344. // UIImage * img =[UIImage imageWithData:img_data];
  345. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  346. // }
  347. // else
  348. // {
  349. //
  350. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  351. //
  352. // NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
  353. //
  354. // dispatch_async(dispatch_get_main_queue(), ^{
  355. //
  356. //
  357. //
  358. // if(downloadimg_data!=nil)
  359. // {
  360. // [iSalesDB cache_img:downloadimg_data :file_name ];
  361. //
  362. // UIImage * img =[UIImage imageWithData:downloadimg_data];
  363. // [cell.btnImage setBackgroundImage:img forState:UIControlStateNormal];
  364. // }
  365. //
  366. // });
  367. // });
  368. //
  369. //
  370. // }
  371. // }
  372. // else
  373. // {
  374. // NSString *CellIdentifier = @"OrderInfoListItem";
  375. // UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  376. // return cell;
  377. // }
  378. }
  379. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  380. {
  381. if(self.content_data.count== indexPath.row)
  382. return;
  383. NSString* name=[self.content_data[indexPath.row] valueForKey:@"tear_name"];
  384. NSString* url= [self.content_data[indexPath.row] valueForKey:@"pdf_path"];
  385. PDFViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFViewController"];
  386. ViewController.url = url;
  387. ViewController.canSave = false;
  388. NSString* subject;
  389. // if (company.length==0) {
  390. NSString* cur_time =[RAUtils current_date];
  391. subject =name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
  392. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  393. NSString* customer_email= [appDelegate.customerInfo valueForKey:@"customer_email"];
  394. NSMutableArray* send_to = [[NSMutableArray alloc]init];
  395. if(customer_email.length>0)
  396. {
  397. send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
  398. // customer_email compo
  399. // [send_to addObject:customer_email];
  400. }
  401. ViewController.mail_to = send_to;
  402. // }
  403. // else
  404. // {
  405. // subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
  406. // }
  407. ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
  408. ViewController.mail_subject = subject;
  409. ViewController.hidenavi = false;
  410. [self.navigationController pushViewController:ViewController animated:YES];
  411. //[self.navigationController setNavigationBarHidden:NO animated:NO];
  412. }
  413. #pragma mark - searchBar delegate;
  414. - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
  415. {
  416. self.keywords=searchBar.text;
  417. self.offset = 0;
  418. [self.content_data removeAllObjects];
  419. [self loadpage];
  420. }
  421. - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
  422. {
  423. if([searchText isEqualToString:@""] && !self.reset)
  424. {
  425. NSLog(@"clear");
  426. self.reset=true;
  427. self.keywords=nil;
  428. self.offset = 0;
  429. [self.content_data removeAllObjects];
  430. [self loadpage];
  431. }
  432. else
  433. self.reset = false;
  434. }
  435. #pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮
  436. - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
  437. {
  438. NSString* listid= [self.content_data[indexPath.row] valueForKey:@"tearsheetsId"];
  439. UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
  440. NSLog(@"delete click");
  441. // UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Delete confirm", nil) message:NSLocalizedString(@"Are you sure to remove portfolio?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil), nil];
  442. // // alert.tag = ALERT_DEL;
  443. // // alert.
  444. // [alert show];
  445. //
  446. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to remove this portfolio?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  447. //block代码块取代了delegate
  448. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  449. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Remove Portfilio"];
  450. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  451. NSDictionary* cart_json = [iSalesNetwork delete_portfoliolist:listid];
  452. dispatch_async(dispatch_get_main_queue(), ^{
  453. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  454. if([[cart_json valueForKey:@"result"] intValue]==2)
  455. {
  456. [self ReloadData];
  457. }
  458. else
  459. {
  460. [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Portfolio" controller:self] ;
  461. }
  462. });
  463. });
  464. }];
  465. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  466. NSLog(@"No");
  467. }];
  468. [alertControl addAction:actionOne];
  469. [alertControl addAction:alertthree];
  470. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  471. [self presentViewController:alertControl animated:YES completion:nil];
  472. }];
  473. deleteRowAction.backgroundColor = UIColorFromRGB(0x336699);
  474. NSString* create_user= [self.content_data[indexPath.row] valueForKey:@"create_user"];
  475. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  476. if([create_user isEqualToString:appDelegate.user])
  477. {
  478. return @[deleteRowAction];
  479. }
  480. return nil;
  481. }
  482. - (void)tableView:(UITableView *)tableView
  483. commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  484. }
  485. @end