我正在使用 AFNetworking 解析 JSON。
我将 2 个图像和文本从一个视图传递到另一个视图,但我无法在 UIImage 视图上查看图像。
我可以在控制台上看到图像的链接。
这是我的代码(链接到 github)
#import "KKDetailsViewController.h"
@interface KKDetailsViewController ()
@end
@implementation KKDetailsViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.textView.text = [self.importVideoMetaData objectForKey:@"description"];
self.imageView.image = [[UIImage alloc] init];
self.imageView.image = [UIImage imageNamed:[(NSDictionary *)self.importThumbnail objectForKey:@"hqDefault"]];
NSLog(@" imported thumbnail %@", self.importThumbnail);
}
这是.h文件
#import <UIKit/UIKit.h>
@interface KKDetailsViewController : UIViewController
@property (weak, nonatomic) NSDictionary *importVideoMetaData;
@property (weak, nonatomic) NSDictionary *importThumbnail;
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end