0
私はGoogleの場所で働いています。私はユーザーの位置とテーブルビューの各セルに近くの場所をダウンロードしたtableViewでVCを持っています。場所と写真の写真。私は写真の円形循環型写真をGoogleからダウンロードします(Googleの場所、即時)
import UIKit
@IBDesignable
class RoundImage: UIImageView {
@IBInspectable var cornerRadius: CGFloat = 0 {
didSet {
self.layer.cornerRadius = cornerRadius
}
}
@IBInspectable var borderWidth: CGFloat = 0 {
didSet {
self.layer.borderWidth = borderWidth
}
}
@IBInspectable var borderColor: UIColor = UIColor.clear {
didSet {
self.layer.borderColor = borderColor.cgColor
}
}
}
を作るためにカスタムクラスを作成したが、問題は、私はこのクラス
import UIKit
private let widthKey = "width"
private let heightKey = "height"
private let photoReferenceKey = "photo_reference"
class QPhoto: NSObject {
var width: Int?
var height: Int?
var photoRef: String?
init(photoInfo: [String:Any]) {
height = photoInfo[heightKey] as? Int
width = photoInfo[widthKey] as? Int
photoRef = photoInfo[photoReferenceKey] as? String
}
func getPhotoURL(maxWidth:Int) -> URL? {
if let ref = self.photoRef {
return NearbyPlaces.googlePhotoURL(photoReference: ref, maxWidth: maxWidth)
}
return nil
}
}
と場所の写真をダウンロードすることであると私はそれを調整することができますどのように知っていただきたいと思いますこのクラスでは、ストーリーボードの画像ビューにRoundImage
クラスを置いてもダウンロードした写真は常に平方です。
ありがとうございます! –