从Parse.com抓取NSString并将其粘贴到UILabel [英] Grab NSString from Parse.com and paste it into UILabel
问题描述
我想从Parse.com抓取NSString,并将其粘贴到我的iOS应用程序的标签中。
I'd like to grab a NSString from the Parse.com and paste it into a Label in my iOS App.
有没有人知道如何做?
我遇到了很多问题:/
Does anyone know how to do so ? I'm having massive problems with it :/
提前感谢
推荐答案
反问题是你想要获得哪个NSString?我假设它是一个PFObject的一些属性,你想显示,对吧?
让这个属性如此有趣的是什么?
The counter-question is "Which NSString do you want to get"? I assume it's some property of a PFObject that you want to display, right? What makes this property so interesting?
假设您想显示图书 >
Let's say you want to display the title of a Book whose author is Hemmingway.
首先,您要找到对象:
PFQuery *query = [PFQuery queryWithClassName:@"Book"]; // I want to find a book
[query whereKey:@"author" equalTo:@"Hemmingway"]; // authored by hemmingway
PFObject *book = [query findFirstObject]; // go get it!
然后你只需读取它的属性 objectForKey
Then you just read its properties with objectForKey
myLabel.text = [book objectForKey:@"title"];
查看 iOS指南,以了解更多高级问题。如果您计划显示许多PFObject的许多属性,您可能需要查看 PFQueryTableViewController
Check out the iOS guides for more advanced questions. If you plan to display many properties of many PFObjects, you might want to check out the PFQueryTableViewController
这篇关于从Parse.com抓取NSString并将其粘贴到UILabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!