小编ven*_*nky的帖子

' - [__ NSCFString objectForKey:]:无法识别的选择器发送到实例0x9c515c0'

先生问题是------我从url获取数据和arrayobj中的数据.当我运行这个项目时,我收到了这个错误.我做错了声明或项目中的代码请检查connectiondidfinishloadingcellforrowanindexpath.

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error ;
NSMutableDictionary *dictobj = [NSJSONSerialization JSONObjectWithData:dataobj options:NSJSONReadingMutableContainers error:&error];

newsobj=[dictobj objectForKey:@"news"];

//NSArray *longdeceobj=[newsobj objectForKey:@"long_desc"];

 for (NSDictionary *dict in  newsobj)
 {
    NSDictionary *title=[dict objectForKey:@"title"];
    [arrayobj addObject:title];
 }
 [[self tableobj]reloadData];
}
Run Code Online (Sandbox Code Playgroud)

//这是索引路径代码中行的单元格

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString*cellide=@"identifier";
newcustomobj=(newsCustamView *) [tableView dequeueReusableCellWithIdentifier:cellide];
if (newcustomobj==nil)
{
    [[NSBundle mainBundle]loadNibNamed:@"newsCustamView" owner:self options:nil];
}
newcustomobj.newstitle.text=[[[arrayobj objectAtIndex:0]objectForKey:@"news"]objectForKey:@"title"];
return newcustomobj;
}
Run Code Online (Sandbox Code Playgroud)

错误是:

2014-05-23 18:34:04.913 newsdata[6518:90b] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x9c515c0
2014-05-23 18:34:04.915 …
Run Code Online (Sandbox Code Playgroud)

objective-c nsarray ios

2
推荐指数
1
解决办法
6715
查看次数

来自网址的图片以及如何减少iPhone中的图片尺寸

我的问题是:我从服务器获取图像.当我从服务器图像大小138x91获取图像但我给我的图像大小是我的自定义单元格大小85x56.它装载好.但是,当我单击行时,它会增加服务器图像大小.当我在tableview中获取图像时如何减小图像大小以及当我单击row时如何不更改图像大小.解决我的问题.我希望图像从url获取以及如何在iOS.goto中减小图像大小波纹管链接.
1).点击之前.
http://radiokhushi.com/siri-admin/uploads/Beforclick.png
2).ofter点击
http://radiokhushi.com/siri-admin/uploads/ofterclick.png

这是在索引路径中获取行的单元格中的数据代码的图像.在显示一个placeholderimage之前加载.

 newsobject.imageView.image = [UIImage imageNamed:@"Placeholder.png"];
 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
                dispatch_async(queue, ^{
NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"%@",[[newsarry objectAtIndex:indexPath.row] objectForKey:@"thumb_file"]]];

                    NSData *data = [NSData dataWithContentsOfURL:url];
                    UIImage *image = [UIImage imageWithData:data];
                    dispatch_async(dispatch_get_main_queue(), ^{

                [tableView cellForRowAtIndexPath:indexPath].imageView.image = image;

            });
        });
Run Code Online (Sandbox Code Playgroud)

image objective-c ios

0
推荐指数
1
解决办法
425
查看次数

标签 统计

ios ×2

objective-c ×2

image ×1

nsarray ×1