Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  ViewController.m
  3. //  Storage
  4. //
  5. //  Created by Pierre Boulay on 2014-09-06.
  6. //  Copyright (c) 2014 Pierre Boulay. All rights reserved.
  7. //
  8.  
  9. #import "ViewController.h"
  10. #import "AppDelegate.h"
  11.  
  12.  
  13. @interface ViewController ()
  14.  
  15. @end
  16.  
  17. @implementation ViewController
  18.  
  19.  
  20. - (void)viewDidLoad                 // Called after the controller'€™s view is loaded into memory
  21. {
  22.     [super viewDidLoad];
  23.    
  24.     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  25.     [appDelegate logString:@"viewDidLoad"];
  26.    
  27. }
  28.  
  29. - (void)didReceiveMemoryWarning     // Sent to the view controller when the app receives a memory warning
  30. {
  31.     [super didReceiveMemoryWarning];
  32.    
  33.     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  34.     [appDelegate logString:@"!!! didReceiveMemoryWarning !!!"];
  35.     [appDelegate receiveMemoryWarning];                         // Allons sauvegarder les informations
  36. }
  37.  
  38. #pragma mark - Méthode qui joue du -segue-
  39.  
  40. -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  41. {
  42.     if([segue.identifier isEqualToString:@"segFromVC"])
  43.     {
  44.         popPopViewController *popVC = (popPopViewController *)segue.destinationViewController;
  45.         [popVC setDelegate:self];                   // On laisse notre "adresse" pour que le -viewController- puisse nous appeler
  46.     }
  47. }
  48.  
  49.  
  50. #pragma mark - Les boutons du ViewController
  51.  
  52. - (IBAction)faire1:(id)sender
  53. {
  54.     NSMutableArray * llogArray = [[NSMutableArray alloc]init];
  55.     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  56.     llogArray =  [appDelegate getLog];
  57.    
  58.     NSString *myArrayString = [llogArray description];          // A string that represents the contents of the array, formatted as a property list. (read-only)
  59.     self.texteLog.text = myArrayString;                         // Affiche dans le -textView-
  60.    
  61. }
  62.  
  63. - (IBAction)clearLog:(id)sender
  64. {
  65.     AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  66.     [appDelegate clearLog];
  67.     self.texteLog.text = @"...";
  68. }
  69.  
  70. #pragma mark - Méthode du protocol <PopOverDelegate>, elle est appelée du -popOverView-
  71.  
  72. - (void) clickBack:(int)backCode
  73. {
  74.   //  NSLog(@"clickBack %d", backCode);
  75.     if (backCode == 1)    [self faire1:self];
  76.     if (backCode == 2)    [self clearLog:self];
  77. }
  78.  
  79. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement