こんにちはみんなイム練習迅速にnewestから注文し、テーブルビューの迅速リストポスト、 と私は最新のポストを作りたいが、ユーザーが見ることができるようにするテーブルビュー の上部に表示されます最新の投稿を最初に!makestagram - Makeschoolのmakestagramプロジェクトによって古い
誰でもお手伝いできますか? は、ここに私のコード
override func viewDidLoad() {
super.viewDidLoad()
timelineComponent = TimelineComponent(target: self)
self.tabBarController?.delegate = self
}
func takePhoto(){
// instantiate photo taking class, provide callback for when photo is selected
photoTakingHelper = PhotoTakingHelper(viewController: self.tabBarController!,callback:{ (image: UIImage?)in
let post = Post()
post.image.value = image!
post.uploadPost()
}
)
}
override func viewDidAppear(animated: Bool) {
timelineComponent.loadInitialIfRequired()
}
func loadInRange(range: Range<Int>, completionBlock: ([Post]?) -> Void) {
ParseHelper.timelineRequestForCurrentUser(range) {
(result: [PFObject]?, error: NSError?) -> Void in
if let error = error {
ErrorHandling.defaultErrorHandler(error)
}
let posts = result as? [Post] ?? []
completionBlock(posts)
}
}
}
extension TimelineViewController: UITableViewDataSource {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return self.timelineComponent.content.count
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("PostCell")as! PostTableViewCell
let post = timelineComponent.content[indexPath.section]
post.downloadImage()
post.fetchLikes()
cell.post = post
return cell
}
}
extension TimelineViewController: UITableViewDelegate{
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
timelineComponent.targetWillDisplayEntry(indexPath.section)
}
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerCell = tableView.dequeueReusableCellWithIdentifier("PostHeader")as! PostSectionHeaderView
let post = self.timelineComponent.content[section]
headerCell.post = post
return headerCell
}
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 40
}
}
何の上に? – Shubhank
これは[動作しません](http://importblogkit.com/2015/07/does-not-work/)の投稿です。あなたはあなたの問題を十分に説明していないので、問題を説明するために[質問を編集しない](http://stackoverflow.com/posts/36970324/edit)をしていないと、質問が保留になる可能性があります。私は[MCVE](http://stackoverflow.com/help/mcve)での作業をお勧めします。 – nhgrif
すべての投稿の一番上に、最新のものから古いものへのリスト! –