Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在NSRL字典中插入NSURL或整数_Iphone_Nsdictionary_Nsurl_Nsuinteger - Fatal编程技术网

Iphone 在NSRL字典中插入NSURL或整数

Iphone 在NSRL字典中插入NSURL或整数,iphone,nsdictionary,nsurl,nsuinteger,Iphone,Nsdictionary,Nsurl,Nsuinteger,我有一个类“book.h”,我在其中声明 书 NSInteger WeatherID; NSString *Description; NSURL *PictureURL; BookDetailview.h #import <UIKit/UIKit.h> @class Book, XMLAppDelegate; @interface BookDetailViewController : UIViewController {

我有一个类“book.h”,我在其中声明

    NSInteger WeatherID;
    NSString *Description;  
    NSURL *PictureURL;  
BookDetailview.h

    #import <UIKit/UIKit.h>
    @class Book, XMLAppDelegate;
    @interface BookDetailViewController : UIViewController
{
    IBOutlet UITableView *tableView;
        XMLAppDelegate *appDelegate;
        Book *aBook;      //creating object of 'Book-class'
        NSMutableDictionary *EmpDictionary;
    NSMutableArray *EmpArray;
}
    @property (nonatomic, retain) Book *aBook;
    @property (nonatomic, retain) NSMutableArray *EmpArray;
    @end
ImageCell.m

    -(void)setData:(NSDictionary *)dic {
    self.titleLabel.text = [dic objectForKey:@"Description"];
    self.urlLabel.text = [dic objectForKey:@"PictureURL"];
    self.itemID = (NSInteger)[dic objectForKey:@"WeatherID"];
    NSLog(@"setting objects for keys");
    // setting up the imageView now
    self.imageView.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [dic objectForKey:@"PictureURL"]]]];
    NSLog(@"setting of image");
}

代码格式化兄弟。这是SO和其他编程站点之间的区别。使用它。如果有自定义类,为什么要使用NSDictionary?毫无意义。您的问题是复制和粘贴代码,而不是NSDictionaryWhat's aBook?这是一系列字典吗?谢谢大家的帮助!!我已经成功地运行了这个程序。我正在编辑这个代码!!
    -(void)setData:(NSDictionary *)dic {
    self.titleLabel.text = [dic objectForKey:@"Description"];
    self.urlLabel.text = [dic objectForKey:@"PictureURL"];
    self.itemID = (NSInteger)[dic objectForKey:@"WeatherID"];
    NSLog(@"setting objects for keys");
    // setting up the imageView now
    self.imageView.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [dic objectForKey:@"PictureURL"]]]];
    NSLog(@"setting of image");
}
[dict setValue:value forKey:key];

[dict setObject:object forKey:key];
NSDictionary *dict1 = [[NSDictionary alloc] initWithObjectsAndKeys:
                       @"val1", @"key1", @"val2", @"key2", @"val3", @"key3",@"val4", @"key4",@"val5", @"key5",nil];