How do you move the legal sign in mapview

后端 未结 11 2053
别跟我提以往
别跟我提以往 2020-12-05 20:24

I wonder if anyone know how you move the legal sign on a mapview, right now my toolbar is covering it. Does anyone know how? There is lot\'s of help with the google logo but

11条回答
  •  难免孤独
    2020-12-05 20:39

    @Dymtro's answer works well for me, but I would suggest checking the size of the subviews first. This should at least prevent possible crashes if the view hierarchy changes in the future:

    override func viewWillLayoutSubviews() {
        positionLegalMapLabel()
    }
    
    func positionLegalMapLabel() {
        if self.mapView.subviews.count > 1 {
            let legalMapLabel = self.mapView.subviews[1]
    
            legalMapLabel.frame.origin = CGPointMake(self.mapView.bounds.size.width - legalMapLabel.frame.size.width - 7, legalMapLabel.frame.origin.y)
        }
    }
    

提交回复
热议问题