2016-07-28 3 views
1

지도보기 (아래 코드 참조)에 내보기를 표시하려고했지만 모든지도가 표시되지 않습니다. 나는 무엇을해야할지 모른다.MapView 뒤에 붙어있는 모습

segmentedControl = DPSegmentedControl.init(
      FrameWithoutIcon: CGRectMake(307.5, 566, 235, 37.5), 
      items: ["Standard", "Satellite", "Hybrid"], 
      backgroundColor: UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 1), 
      thumbColor: UIColor.init(hex: "#B60002"), 
      textColor: UIColor(hex: "#808080"), 
      selectedTextColor: UIColor(hex: "#FFFFFF")) 
     segmentedControl.alpha = 0 

     segmentedControl.selectedIndex = 0 

     segmentedControl.addTarget(self, action: #selector(self.tapSegment(_:)), forControlEvents: .ValueChanged) 
     self.view.insertSubview(self.segmentedControl, belowSubview: self.hoverBar) 
     UIApplication.sharedApplication().keyWindow!.bringSubviewToFront(self.segmentedControl) 
     UIApplication.sharedApplication().keyWindow!.sendSubviewToBack(self.mapView) 

내가 Z 위치를 사용 This is the mapView at 0.5 alpha는보기가 나타납니다,하지만 어떤 터치 동작을 (그것이 사용자 정의 컨트롤을 분할한다)을 허용하지 않습니다.

self.segmentedControl.layer.zPosition = self.mapView.layer.zPosition + 1 
+0

: [https://stackoverflow.com/questions/13182482/bringing-a-subview-to-be-in-front-of -all-other-views] (https://stackoverflow.com/questions/13182482/bringing-a-subview-to-be-in-front-of-all-other-views) – CarvicheBlack

답변

1

시도해 보셨습니까?

self.view.bringSubviewToFront(self.segmentedControl) 
self.view.sendSubviewToBack(self.mapView) 

또는

self.segmentedControl?.superview.bringSubviewToFront(self.segmentedControl) 
self.mapView?.superview.sendSubviewToBack(self.mapView) 
이미이 스레드에서 보았다
+0

감사합니다. 두 번째 작품. 나는 이것을 위해 모든 것을 조사해왔다. :) – CarvicheBlack