从parse.com检索图像

我不知道这是否可能,但我认为这是可能的,我不知道如何做到这一点。 我只是想从parse.com加载一个图像,就像从parse.com中检索对象一样。 我应该以同样的方式从parse.com获取string吗? 我刚刚发现如何保存图像的parsing,但没有如何让他们。 我会很高兴,如果有人可以告诉我一个链接来做到这一点或示例代码。

我已经设置了一个从parse中获取的string:

PFQuery *query = [PFQuery queryWithClassName:@"app"]; [query getObjectInBackgroundWithId:@"ID" block:^(PFObject *textdu, NSError *error) { if (!error) { UIFont *welcomeLabelFont = [UIFont boldSystemFontOfSize:17]; welcomeLabel.text = [textdu objectForKey:@"ueberschriftnews"]; welcomeLabel.font = welcomeLabelFont; welcomeLabel.textColor = [UIColor whiteColor]; welcomeLabel.textAlignment = NSTextAlignmentCenter; welcomeLabel.backgroundColor = [UIColor clearColor]; welcomeLabel.shadowColor = [UIColor blackColor]; welcomeLabel.shadowOffset = CGSizeMake(0, 1); [contentView addSubview:welcomeLabel]; // The get request succeeded. Log the score NSString *text = [textdu objectForKey:@"newstext"]; UIFont *font = nil; CGFloat points = 17; CGFloat maxHeight = infoLabel.frame.size.height; CGFloat textHeight; do { font = [UIFont systemFontOfSize:points]; CGSize size = CGSizeMake(infoLabelRect.size.width, 100000); CGSize textSize = [text sizeWithFont:font constrainedToSize:size lineBreakMode: NSLineBreakByWordWrapping]; textHeight = textSize.height; points -= 1; } while (textHeight > maxHeight); infoLabel.text = text; infoLabel.numberOfLines = 9; infoLabel.font = font; infoLabel.textColor = [UIColor whiteColor]; infoLabel.textAlignment = NSTextAlignmentCenter; infoLabel.backgroundColor = [UIColor clearColor]; infoLabel.shadowColor = [UIColor blackColor]; infoLabel.shadowOffset = CGSizeMake(0, 1); [infoLabel sizeToFit]; [contentView addSubview:infoLabel]; } else { infoLabel.text = @"something"; [infoLabel sizeToFit]; [contentView addSubview:infoLabel]; } }]; 

我的parsing设置:

在这里输入图像说明

谢谢。

是的,这是可能的。 如果你使用web界面来代替string,你应该指定PFFile作为一个types。 如果你从你的iOS客户端上传图片,这里是一个链接来parsingiOS指南如何做到这一点https://parse.com/docs/ios_guide#files/iOS 。 一旦你的图像在那里,你可以下载图像这种方式:

 PFQuery *query = [PFQuery queryWithClassName:@"app"]; [query getObjectInBackgroundWithId:@"ID" block:^(PFObject *textdu, NSError *error) { { // do your thing with text if (!error) { PFFile *imageFile = [textdu objectForKey:@"image"]; [imageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) { if (!error) { UIImage *image = [UIImage imageWithData:data]; } }]; } }];