Skip to content

Commit

Permalink
make sliderHeight a variable constant
Browse files Browse the repository at this point in the history
  • Loading branch information
xuefanzhang committed Oct 25, 2015
1 parent b888cf4 commit 044a7d6
Showing 1 changed file with 11 additions and 32 deletions.
43 changes: 11 additions & 32 deletions photosphere/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,41 @@ import GoogleMaps
class ViewController: UIViewController, GMSMapViewDelegate {
var panoView: GMSPanoramaView!
var sliderView: UISlider!

let sliderOffsetX: CGFloat = 50
let sliderOffsetY: CGFloat = 40

let sliderHeight: CGFloat = 15

override func viewDidLoad() {
super.viewDidLoad()

panoView = GMSPanoramaView()
self.view.addSubview(panoView)

//TODO: move this out to function
panoView.moveNearCoordinate(CLLocationCoordinate2DMake(-33.732, 150.312))



//TODO: hook up target
sliderView = UISlider()
self.view.addSubview(sliderView)

// TODO: stylez
// var mapButton = UIButton(type: UIButtonType.System)
// mapButton.frame = CGRectMake(500, 10, 40, 40)
// mapButton.backgroundColor = UIColor.blueColor()
// mapButton.setTitle("Map", forState: UIControlState.Normal)
// mapButton.addTarget(self, action: "onMapClicked:", forControlEvents: UIControlEvents.TouchUpInside)



// self.view.addSubview(mapButton)

}

override func viewWillLayoutSubviews() {
panoView.frame = self.view.bounds

sliderView.frame = CGRectMake(CGRectGetMinX(self.view.bounds) + sliderOffsetX, CGRectGetMaxY(self.view.bounds) - sliderOffsetY,
self.view.bounds.width - 2 * sliderOffsetX, 15)
self.view.bounds.width - 2 * sliderOffsetX, sliderHeight)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func onMapClicked(sender:UIButton!){
//TODO: push to explore/map view controller
print("on Map button clicked")
let mapViewController:MapViewController = MapViewController()
self.presentViewController(mapViewController, animated: true, completion: nil)
//navigationController?.pushViewController("MapViewController", animated: true)

}


override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.All
}

override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
self.view.setNeedsLayout()
}
Expand Down

0 comments on commit 044a7d6

Please sign in to comment.