HomeView.swift 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright (C) 2016 Inigo Valentin
  2. //
  3. // This file is part of the Gasteizko Margolariak IOS app.
  4. //
  5. // The Gasteizko Margolariak IOS app is free software: you can
  6. // redistribute it and/or modify it under the terms of the
  7. // GNU General Public License as published by the Free Software
  8. // Foundation, either version 3 of the License, or (at your
  9. // option) any later version.
  10. //
  11. // The Gasteizko Margolariak IOS app is distributed in the
  12. // hope that it will be useful, but WITHOUT ANY WARRANTY;
  13. // without even the implied warranty of MERCHANTABILITY or
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  15. // Public License for more details.
  16. //
  17. // You should have received a copy of the GNU General Public
  18. // License along with the Gasteizko Margolariak IOS app.
  19. // If not, see <http://www.gnu.org/licenses/>.
  20. import Foundation
  21. import UIKit
  22. /**
  23. Class to handle the home view.
  24. */
  25. class HomeView: UIView {
  26. //The main scroll view.
  27. @IBOutlet weak var scrollView: UIScrollView!
  28. //The container of the view.
  29. @IBOutlet weak var container: UIView!
  30. //Each of the sections of the view.
  31. @IBOutlet weak var locationSection: Section!
  32. @IBOutlet weak var lablancaSection: Section!
  33. @IBOutlet weak var futureActivitiesSection: Section!
  34. @IBOutlet weak var blogSection: Section!
  35. @IBOutlet weak var gallerySection: Section!
  36. @IBOutlet weak var pastActivitiesSection: Section!
  37. @IBOutlet weak var socialSection: Section!
  38. /**
  39. Run when the view is started.
  40. */
  41. required init?(coder aDecoder: NSCoder) {
  42. super.init(coder: aDecoder)
  43. //Load the contents of the HomeView.xib file.
  44. Bundle.main.loadNibNamed("HomeView", owner: self, options: nil)
  45. self.addSubview(container)
  46. container.frame = self.bounds
  47. //Set titles for each section
  48. locationSection.setTitle(text: "Encuentranos")
  49. lablancaSection.setTitle(text: "La Blanca")
  50. futureActivitiesSection.setTitle(text: "Proximas actividades")
  51. blogSection.setTitle(text: "Ultimos posts")
  52. gallerySection.setTitle(text: "Ultimas fotos")
  53. pastActivitiesSection.setTitle(text: "Ultimas actividades")
  54. socialSection.setTitle(text: "Siguenos")
  55. //Always at the end: update scrollview
  56. var h: Int = 0
  57. for view in scrollView.subviews {
  58. //contentRect = contentRect.union(view.frame);
  59. h = h + Int(view.frame.height) + 30 //Why 30?
  60. print("curh: \(h)")
  61. }
  62. self.scrollView.contentSize.height = CGFloat(h);
  63. }
  64. func setUpPastActivities(){
  65. }
  66. }