Showing
5 changed files
with
58 additions
and
26 deletions
No preview for this file type
| ... | @@ -29,7 +29,8 @@ private extension CSMButton { | ... | @@ -29,7 +29,8 @@ private extension CSMButton { |
| 29 | setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | 29 | setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) |
| 30 | titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) | 30 | titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) |
| 31 | setTitleColor(.white, for: .normal) | 31 | setTitleColor(.white, for: .normal) |
| 32 | - backgroundColor = UIColor(rgb: 0x79BF14) | 32 | +// backgroundColor = UIColor(rgb: 0x79BF14) |
| 33 | + backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00) | ||
| 33 | layer.cornerRadius = 12.0 | 34 | layer.cornerRadius = 12.0 |
| 34 | 35 | ||
| 35 | imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0); | 36 | imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0); | ... | ... |
| ... | @@ -21,9 +21,11 @@ import MapKit | ... | @@ -21,9 +21,11 @@ import MapKit |
| 21 | @IBOutlet private var hoursView: UILabel! | 21 | @IBOutlet private var hoursView: UILabel! |
| 22 | @IBOutlet private var phoneView: UILabel! | 22 | @IBOutlet private var phoneView: UILabel! |
| 23 | @IBOutlet private var addressView: UILabel! | 23 | @IBOutlet private var addressView: UILabel! |
| 24 | - @IBOutlet private var directionsButton: CSMButton! | 24 | + @IBOutlet private var directionsButton: UIButton! |
| 25 | @IBOutlet private var infoTopConstraint: NSLayoutConstraint! | 25 | @IBOutlet private var infoTopConstraint: NSLayoutConstraint! |
| 26 | @IBOutlet weak var topBorderLine: UIImageView! | 26 | @IBOutlet weak var topBorderLine: UIImageView! |
| 27 | + @IBOutlet weak var phoneImageView: UIImageView! | ||
| 28 | + @IBOutlet weak var addressImageView: UIImageView! | ||
| 27 | 29 | ||
| 28 | // public | 30 | // public |
| 29 | public var couponSet: swiftApi.CouponSetItemModel? | 31 | public var couponSet: swiftApi.CouponSetItemModel? |
| ... | @@ -48,6 +50,8 @@ import MapKit | ... | @@ -48,6 +50,8 @@ import MapKit |
| 48 | setNavigationTitle("Καταστήματα") | 50 | setNavigationTitle("Καταστήματα") |
| 49 | 51 | ||
| 50 | backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 52 | backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 53 | + phoneImageView.image = UIImage(named: "ic_phone", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 54 | + addressImageView.image = UIImage(named: "ic_address", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 51 | 55 | ||
| 52 | mapView.delegate = self | 56 | mapView.delegate = self |
| 53 | mapView.centerToLocation(initialLocation, regionRadius: 1000000) | 57 | mapView.centerToLocation(initialLocation, regionRadius: 1000000) |
| ... | @@ -56,25 +60,26 @@ import MapKit | ... | @@ -56,25 +60,26 @@ import MapKit |
| 56 | // mapView.layer.cornerRadius = 30 | 60 | // mapView.layer.cornerRadius = 30 |
| 57 | // mapView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 61 | // mapView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius |
| 58 | 62 | ||
| 59 | - let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! | 63 | +// let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! |
| 60 | - var aspectR: CGFloat = 0.0 | 64 | +// var aspectR: CGFloat = 0.0 |
| 61 | - | 65 | +// |
| 62 | - aspectR = image.size.width/image.size.height | 66 | +// aspectR = image.size.width/image.size.height |
| 63 | - | ||
| 64 | - topBorderLine.translatesAutoresizingMaskIntoConstraints = false | ||
| 65 | - topBorderLine.image = image | ||
| 66 | - topBorderLine.contentMode = .scaleAspectFill | ||
| 67 | 67 | ||
| 68 | - NSLayoutConstraint.activate([ | 68 | +// topBorderLine.translatesAutoresizingMaskIntoConstraints = false |
| 69 | - topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0), | 69 | +// topBorderLine.image = image |
| 70 | - topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0), | 70 | +// topBorderLine.contentMode = .scaleAspectFill |
| 71 | - topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0), | 71 | +// |
| 72 | - topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width), | 72 | +// NSLayoutConstraint.activate([ |
| 73 | - topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR) | 73 | +// topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0), |
| 74 | - ]) | 74 | +// topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0), |
| 75 | +// topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0), | ||
| 76 | +// topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width), | ||
| 77 | +// topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR) | ||
| 78 | +// ]) | ||
| 75 | 79 | ||
| 76 | 80 | ||
| 77 | closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) | 81 | closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) |
| 82 | + closeButton.setImage(UIImage(named: "ic_close_3", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | ||
| 78 | 83 | ||
| 79 | titleView.font = UIFont(name: "PFSquareSansPro-Bold", size: 19) | 84 | titleView.font = UIFont(name: "PFSquareSansPro-Bold", size: 19) |
| 80 | titleView.textColor = UIColor(rgb: 0x757575) | 85 | titleView.textColor = UIColor(rgb: 0x757575) |
| ... | @@ -95,12 +100,17 @@ import MapKit | ... | @@ -95,12 +100,17 @@ import MapKit |
| 95 | directionsButton.setTitle("Οδηγίες", for: .normal) | 100 | directionsButton.setTitle("Οδηγίες", for: .normal) |
| 96 | directionsButton.setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | 101 | directionsButton.setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) |
| 97 | 102 | ||
| 103 | +// directionsButton.sizeToFit() | ||
| 104 | + directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) | ||
| 105 | + directionsButton.setTitleColor(.white, for: .normal) | ||
| 106 | + directionsButton.tintColor = .white | ||
| 107 | + directionsButton.backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00) | ||
| 108 | + directionsButton.layer.cornerRadius = 16.0 | ||
| 98 | // directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); | 109 | // directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); |
| 99 | // directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); | 110 | // directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); |
| 100 | -// directionsButton.sizeToFit() | 111 | + directionsButton.frame = CGRect(x: 0.0, y: 0.0, width: directionsButton.intrinsicContentSize.width+10, height: 50) |
| 101 | - //directionsButton.setTitleColor(.white, for: .normal) | 112 | +// directionsButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15) |
| 102 | - //directionsButton.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00) | 113 | + directionsButton.setInsets(forContentPadding: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), imageTitlePadding: 10) |
| 103 | - //directionsButton.layer.cornerRadius = 12.0 | ||
| 104 | 114 | ||
| 105 | load() | 115 | load() |
| 106 | } | 116 | } |
| ... | @@ -149,16 +159,16 @@ import MapKit | ... | @@ -149,16 +159,16 @@ import MapKit |
| 149 | 159 | ||
| 150 | let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) | 160 | let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) |
| 151 | 161 | ||
| 152 | - if (self.isMarket == true) { | 162 | +// if (self.isMarket == true) { |
| 153 | self.merchantsArray = filteredMerchants | 163 | self.merchantsArray = filteredMerchants |
| 154 | 164 | ||
| 155 | if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) { | 165 | if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) { |
| 156 | self.parentMerchant = parent | 166 | self.parentMerchant = parent |
| 157 | } | 167 | } |
| 158 | 168 | ||
| 159 | - } else { | 169 | +// } else { |
| 160 | - self.merchantsArray = merchantsData ?? [] | 170 | +// self.merchantsArray = merchantsData ?? [] |
| 161 | - } | 171 | +// } |
| 162 | 172 | ||
| 163 | self.loadMapPins() | 173 | self.loadMapPins() |
| 164 | 174 | ||
| ... | @@ -318,7 +328,8 @@ import MapKit | ... | @@ -318,7 +328,8 @@ import MapKit |
| 318 | private func loadPinDetailsView(_ annotation: MerchantAnnotation) { | 328 | private func loadPinDetailsView(_ annotation: MerchantAnnotation) { |
| 319 | self.selectedMerchant = annotation.model | 329 | self.selectedMerchant = annotation.model |
| 320 | 330 | ||
| 321 | - self.titleView.text = self.selectedMerchant?._admin_name | 331 | +// self.titleView.text = self.selectedMerchant?._admin_name |
| 332 | + self.titleView.text = self.parentMerchant?._admin_name | ||
| 322 | 333 | ||
| 323 | if (self.isMarket == true) { | 334 | if (self.isMarket == true) { |
| 324 | self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 335 | self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -607,3 +607,23 @@ extension UIView { | ... | @@ -607,3 +607,23 @@ extension UIView { |
| 607 | layer.mask = shape | 607 | layer.mask = shape |
| 608 | } | 608 | } |
| 609 | } | 609 | } |
| 610 | + | ||
| 611 | +extension UIButton { | ||
| 612 | + func setInsets( | ||
| 613 | + forContentPadding contentPadding: UIEdgeInsets, | ||
| 614 | + imageTitlePadding: CGFloat | ||
| 615 | + ) { | ||
| 616 | + self.contentEdgeInsets = UIEdgeInsets( | ||
| 617 | + top: contentPadding.top, | ||
| 618 | + left: contentPadding.left, | ||
| 619 | + bottom: contentPadding.bottom, | ||
| 620 | + right: contentPadding.right + imageTitlePadding | ||
| 621 | + ) | ||
| 622 | + self.titleEdgeInsets = UIEdgeInsets( | ||
| 623 | + top: 0, | ||
| 624 | + left: imageTitlePadding, | ||
| 625 | + bottom: 0, | ||
| 626 | + right: -imageTitlePadding | ||
| 627 | + ) | ||
| 628 | + } | ||
| 629 | +} | ... | ... |
-
Please register or login to post a comment