Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. //
  2. // ViewController.m
  3. // Labb3TodoList
  4. //
  5. // Created by Henrik Doré on 2020-01-20.
  6. // Copyright © 2020 Henrik Doré. All rights reserved.
  7. //
  8.  
  9. #import "ViewController.h"
  10. #import "addNewTodoViewController.h"
  11.  
  12. @interface ViewController ()
  13.  
  14.  
  15. @end
  16.  
  17. @implementation ViewController
  18.  
  19.  
  20. @synthesize todoListArray;
  21. @synthesize todolistArrayNewFromUser;
  22.  
  23.  
  24.  
  25.  
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28.  
  29. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  30. NSMutableArray *todolistFromUser = [[defaults objectForKey:@"todoarrayKey"] mutableCopy];
  31.  
  32. todolistArrayNewFromUser = todolistFromUser;
  33. }
  34. -(void)viewDidAppear:(BOOL)animated{
  35. [self ];
  36. [_tableView reloadData];
  37. }
  38.  
  39.  
  40.  
  41. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  42. return todolistArrayNewFromUser.count;
  43.  
  44. }
  45.  
  46.  
  47.  
  48.  
  49.  
  50. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  51.  
  52. UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
  53.  
  54. if (cell == nil){
  55. cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  56. }
  57. cell.textLabel.text = [todolistArrayNewFromUser objectAtIndex:indexPath.row];
  58.  
  59. return cell;
  60.  
  61. }
  62. - (IBAction)newtodoBtn:(id)sender {
  63. }
  64.  
  65.  
  66. - (IBAction)updateBtn:(id)sender {
  67.  
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement