我正在尝试合并这两个项目。
在这一点上,我只是试图将它们保存在单独的视图控制器中,并让 Thumbnail Picker 的功能在它自己的控制器中工作。
我收到了错误,如标题中所述,“在'UIViewController *'类型的对象上找不到属性'图像'”
错误来自 AppDelegate.m 文件:
#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
这是 AppDelegate.h:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;
@end
我试过像这样声明一个属性:
@property (strong, nonatomic) UIImageView *images;
即使我煞费苦心地合并了这两个代码库,我似乎也无法解决这个问题。
这是我目前所处的 Xcode 项目: