Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.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
Ios 将图像查询到UITableView_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 将图像查询到UITableView

Ios 将图像查询到UITableView,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我正在尝试在我的UITableview中查询图像,但在尝试配置单元格时遇到问题。创建UITableViewCell的子类,并向其添加UIImageView属性。下面是头文件的示例: #import <UIKit/UIKit.h> @interface CustomTableViewCell : UITableViewCell @property (nonatomic, weak) IBOutlet UIImageView *icon; //@property (nonatomi

我正在尝试在我的
UITableview
中查询图像,但在尝试配置单元格时遇到问题。

创建
UITableViewCell
的子类,并向其添加
UIImageView
属性。下面是头文件的示例:

#import <UIKit/UIKit.h>

@interface CustomTableViewCell : UITableViewCell

@property (nonatomic, weak) IBOutlet UIImageView *icon;

//@property (nonatomic, strong) UIImageView *icon; //Only if you're not using an XIB/storyboard

@end

另外,请确保在主线程上调用
reloadData

您需要在主线程上重新加载表,而不是在后台线程上。但是,我应该在UIImage*YourImageWhere图像中放入什么。如何从
PFObject
s获取图像?我在问你一个问题,我不知道你在
PFObject
s中存储了什么。好的,请看我的编辑。您需要了解图像的存储方式,并将其相应地放入图像视图中。这可能有助于您:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier=@"cellimage";
    CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    //the following assumes that your self.images array contains UIImages
    cell.icon.image = [self.images objectAtIndex:indexPath.row];

    return cell;
}