Advertisement
Guest User

Untitled

a guest
May 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. @IBAction func yourSegname(sender: UISegmentedControl)
  2. {
  3. switch segmentedControl.selectedSegmentIndex
  4. {
  5. case 0:
  6. yourtableView.tag = 1
  7. // call first webservice and reload the data
  8.  
  9. case 1:
  10. yourtableView.tag = 2
  11. // call second webservice and reload the data
  12. case 2:
  13. yourtableView.tag = 3
  14. // call third webservice and reload the data
  15.  
  16. default:
  17. break;
  18. }
  19. }
  20.  
  21. func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  22.  
  23.  
  24. return comments.count
  25. }
  26.  
  27.  
  28. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  29. //post's section == 0
  30. var cell: UITableViewCell!
  31. if tableView.tag == 1 {
  32. // load the past data
  33. }
  34. else if tableView.tag == 2{
  35. // load present data
  36. }
  37. else {
  38. // load future data
  39. }
  40.  
  41. return cell
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement