Hey guys, so i have a viewController that takes a picture and saves it to Documents. In my secondViewController i want to load the image by retrieving it from Documents. Currently i am using:
Code:
+(UIImage *)imageWithContentsOfFile:(NSString *)Path
to define it.
Can someone please let me if i am on the right track with my code:
secondViewController.H
Code:
@interface SliderController : UIViewController {
UIImage *initPuzzle;
}
@property (nonatomic, retain) UIImage *initPuzzle;
- (id)init;
secondViewController.M
Code:
@synthesize initPuzzle;
- (id)init {
// Retrieve the image for the view
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Documents/Test" ofType:@"png"]];
[self setInitPuzzle:image];
return self;
}
// Load the picture into view here
- (void)viewDidLoad {
// self.view.backgroundColor = [UIColor redColor];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Documents/Test.png"]];
self.tiles = [[NSMutableArray alloc] init];
// [self initPuzzle:@"Documents/Test.png"];
[super viewDidLoad];
}
I just added the code that i need to load the image. If more is need please let me know.
Thanks,
Steve