如何使div与img旁边的高度相同?

时间:2018-08-11 13:45:29

标签: flexbox resize alignment responsive sizing

我需要帮助使div的高度与同一flex行中其旁边的img相同

这是html

func displayAlerts() { // rajish version

        ref = Database.database().reference()

        databaseHandle = ref?.child("Community").child("Alert Notifications").observe(.childAdded, with: { (snapshot) in

            //            defer { self.dummyFunctionToFoolFirebaseObservers() }
            guard let data = snapshot.value as? [String:String] else { return }
            guard let firebaseKey = snapshot.key as? String else { return }

            //                let date = data!["Date"]
            //                let time = data!["Time"]
            let dataLatitude = data["Latitude"]!
            let dataLongitude = data["Longitude"]!

            let type = data["Description"]!
            let id = Int(data["Id"]!)
            let doubledLatitude = Double(dataLatitude)
            let doubledLongitude = Double(dataLongitude)
            let recombinedCoordinate = CLLocationCoordinate2D(latitude: doubledLatitude!, longitude: doubledLongitude!)

            print("Firebase post retrieved !")

            print("Longitude Actual DataKey is \(String(describing: firebaseKey))")

            print("fir long \((snapshot.value!, snapshot.key))")
            var userAlertAnnotation = UserAlert(type: type, coordinate: recombinedCoordinate, firebaseKey: firebaseKey, title: type,id: id!)
            self.userAlertNotificationArray.append(userAlertAnnotation)  // array of notifications coming from Firebase
            print("user alert array after append from Firebase is : \(self.userAlertNotificationArray)")
            self.alertNotificationArray.append(recombinedCoordinate) // array for checkig alerts on route
            self.mapView.addAnnotation(userAlertAnnotation)

        })

    }

我希望.textbox的大小和.headshot的大小相同。到目前为止,我的宽度是相同的,但是我不能使高度相同。

这是CSS:

    let annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "")


    if annotation is MKUserLocation{
        return nil
    } else {

        print(annotation.coordinate)

        annotationView.image = UIImage(named:(annotationView.annotation?.title)! ?? "")

        //            annotationView.canShowCallout = true

        let transform = CGAffineTransform(scaleX: 0.27, y: 0.27)
        annotationView.transform = transform
        return annotationView
    }
}

我确定这是一些简单的解决方案,但是我一直在努力解决它,因此,我们将不胜感激! :)

1 个答案:

答案 0 :(得分:0)

尝试为“文本框”类设置height:100%