I'm trying to merge these two projects.
At this point I'm just trying to keep these in separate view controllers and getting the functionality of the Thumbnail Picker working in it's own controller.
I'm getting the error, as stated in the title, "Property 'images' not found on object of type 'UIViewController *'"
The error is coming from the AppDelegate.m file:
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[UIViewController alloc] init];
NSArray *paths = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil];
NSMutableArray *images = [NSMutableArray arrayWithCapacity:paths.count];
for (NSString *path in paths) {
[images addObject:[UIImage imageWithContentsOfFile:path]];
}
self.viewController.images = images;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
Here is the AppDelegate.h:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;
@end
I've tried declaring a property like so:
@property (strong, nonatomic) UIImageView *images;
I can't seem to fix this even though I painstakingly merged these two codebases.
Here is the Xcode project of where I'm at at this point:
I solved it. The problem was that I was merging a project using Storyboards and one that was using programmatically generated ViewController. Well, part of the problem.
Since, I merged the projects I had to give the view controller with the ThumbnailView another name. I named it ElfViewController.
This is the working code:
AppDelegate.h
AppDelegate.m
I'm still new to Objective-C and have only learned how to create ViewControllers in Storyboard and not programmatically.
Also I didn't know that you can declare a property to a specific View Controller rather than just a general
UIViewContoller
. That's another place I got tripped up.the "
images
" property you've declared in your .h file:is not the NSMutableArray you are trying to assign to it via this line:
If you can get the types to be the same (i.e. either a single UIImageView object or a NSMutableArray containing many UIImages), then you should have better luck with assigning things to that property.