0
我使用AFNetworking解析JSON。UIImage沒有顯示
我從一個視圖傳遞2個圖像和文本到另一個,但我不能在UIImage視圖上查看圖像。
我可以在控制檯上看到圖像的鏈接。
這裏是我的代碼(link to 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
哪裏是'importVideoMetaData'設置? – trojanfoe 2013-02-08 12:19:26
self.importVideoMetaData你如何給這個對象數據,你可以發佈一些代碼。 – Rahul 2013-02-08 12:21:37
'imageNamed:'將會返回一個可用於你的目標的圖像,你不能簡單地通過一個網址,並期望它的工作... – Alladinian 2013-02-08 12:21:58