0

I am still trying to do simple things so I am keeping this example as simple as they come. Here are my files:

h:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

 - (NSMutableArray *) createArray;

@property NSMutableArray *myArray;



@end

m:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self createArray];

    NSLog(@"this is my array: %@",self.myArray);

}

- (NSMutableArray*) createArray {


    self.myArray = [[NSMutableArray alloc]init];

    for (int i = 0; i < (20); i++){
        [self.myArray addObject:[NSNumber
                         numberWithInt:i]];
    }


    return self.myArray;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

@end

I am not sure if my logic is wrong, or this is just a small error in what I am typing. Why doesn't this work? Thanks.

Paul
  • 1,277
  • 5
  • 28
  • 56

0 Answers0