【发布时间】:2015-04-29 22:44:01
【问题描述】:
我正在使用 Parse 中的数组编写表视图控制器。我需要通过 segue 发送数据,但我不知道为什么它总是返回 nil。我将不得不发送图像和文本,但现在我只是将标签 title1 中的文本插入到名为 example 的变量类型 String 中。
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "toDetail" {
var detailScene = segue.destinationViewController as! detailViewController
let cell = sender as! UITableViewCell
let indexPath = tableView?.indexPathForCell(cell)
detailScene.example = self.timelineData[indexPath!.row].title1?.text
}
}
对于我使用过的数组:
var timelineData : NSMutableArray = NSMutableArray()
还有函数loaddata,与函数viewDidAppear一起使用
func loaddata () {
timelineData.removeAllObjects()
var findTimelineData:PFQuery = PFQuery(className: "ii")
findTimelineData.findObjectsInBackgroundWithBlock{
(objects, error)->Void in
if error == nil{
for object in objects!{
let ii:PFObject = object as! PFObject
self.timelineData.addObject(ii)
}
let array:NSArray = self.timelineData.reverseObjectEnumerator().allObjects
self.timelineData = NSMutableArray(array: array)
self.tableView.reloadData()
}
}
}
【问题讨论】:
-
请分享
self.timelineData初始化和填充数据的代码。
标签: ios swift parse-platform tableview