0
Parse와 함께 처음으로 이동합니다. Parse가 포드를했는데, Bridging-Hearder에서 클래스를 가져오고 Delegate (신속한) ID와 내가 사용할 clientKey를 선언했습니다. 내 의심, 내가 뭘 파스 에서이 데이터를 얻고 TableView에 그들을 삽입해야합니까? 당신이해야신속하게 사용하는 구문 분석 (Tableview)
Parse와 함께 처음으로 이동합니다. Parse가 포드를했는데, Bridging-Hearder에서 클래스를 가져오고 Delegate (신속한) ID와 내가 사용할 clientKey를 선언했습니다. 내 의심, 내가 뭘 파스 에서이 데이터를 얻고 TableView에 그들을 삽입해야합니까? 당신이해야신속하게 사용하는 구문 분석 (Tableview)
확인을 제일 먼저 ID가 테이블을 지금
func loaddata()
{
var dataParse:NSMutableArray = NSMutableArray()
var findDataParse:PFQuery = PFQuery(className: "NAME ROW IN YOUR DATABASE PARSE")
findDataParse.findObjectsInBackgroundWithBlock{
(objects:AnyObject[]!, error:NSError!)->Void in
if (!error){
for object:PFObject! in objects
{
self.dataParse.addObject(object)
}
}
//// add data into array
let array:NSArray = self.dataParse.reverseObjectEnumerator().allObjects
self.dataParse = array as NSMutableArray
self.tableView.reloadData()
}
}
var message:PFObject = PFObject(className:"CLASS-NAME")
message["NAME ROW IN YOUR DATABASE PARSE"] = messageBox.text as String
message["User"] = PFUser.currentUser()
message.saveInBackground()
로드 데이터 분석 객체를 생성
을func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
Parse.setApplicationId("ID-PARSE", clientKey: "KEY-PARSE") return true }
을 구문 분석 따라 설정된 AppDelegate에에
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int
{
return 1
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int
{
return self.dataParse.count
}
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell?
{
let cell:CustomCell = tableView!.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath!) as CustomCell
let cellDataParse:PFObject = self.dataParse.objectAtIndex(indexPath!.row) as PFObject
cell.mensajeBox.text = cellDataParse.objectForKey("NAME ROW IN YOUR DATABASE PARSE") as String return cell }
이 도움이 되었기를 바랍니다.
Parse iOS 가이드는 ObjC 예제를 따라 이미 신속한 코드 예제를 추가했기 때문에 크게 도움이됩니다. https://parse.com/docs/ios_guide – tsafrir