Showing
5 changed files
with
132 additions
and
28 deletions
No preview for this file type
| ... | @@ -37,8 +37,8 @@ import UIKit | ... | @@ -37,8 +37,8 @@ import UIKit |
| 37 | public override func awakeFromNib() { | 37 | public override func awakeFromNib() { |
| 38 | super.awakeFromNib() | 38 | super.awakeFromNib() |
| 39 | 39 | ||
| 40 | - inboxView.layer.cornerRadius = 5.0 | 40 | +// inboxView.layer.cornerRadius = 5.0 |
| 41 | - inboxView.clipsToBounds = true | 41 | +// inboxView.clipsToBounds = true |
| 42 | 42 | ||
| 43 | newBadgeImage.image = UIImage(named: "new_icon_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 43 | newBadgeImage.image = UIImage(named: "new_icon_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 44 | curvedBgImage.image = UIImage(named: "curved_bg_white_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 44 | curvedBgImage.image = UIImage(named: "curved_bg_white_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| ... | @@ -57,6 +57,26 @@ import UIKit | ... | @@ -57,6 +57,26 @@ import UIKit |
| 57 | //set the values for top,left,bottom,right margins | 57 | //set the values for top,left,bottom,right margins |
| 58 | let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0) | 58 | let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0) |
| 59 | contentView.frame = contentView.frame.inset(by: margins) | 59 | contentView.frame = contentView.frame.inset(by: margins) |
| 60 | + | ||
| 61 | + // Add different corner radius - Do it here, otherwise it won't be applied to all cells | ||
| 62 | + inboxView.roundCorners(topLeft: 20, topRight: 45, bottomLeft: 20, bottomRight: 0) | ||
| 63 | + | ||
| 64 | + // Delete extra borderLayers added | ||
| 65 | + for layer in (inboxView.layer.sublayers ?? []) { | ||
| 66 | + if(layer.name == "MFYItemBorderLayer"){ | ||
| 67 | + layer.removeFromSuperlayer() | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + // Add borderLayer | ||
| 72 | + let borderLayer = CAShapeLayer() | ||
| 73 | + borderLayer.path = (inboxView.layer.mask! as! CAShapeLayer).path! // Reuse the Bezier path | ||
| 74 | + borderLayer.strokeColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor | ||
| 75 | + borderLayer.fillColor = UIColor.clear.cgColor | ||
| 76 | + borderLayer.lineWidth = 1 | ||
| 77 | + borderLayer.frame = inboxView.bounds | ||
| 78 | + borderLayer.name = "MFYItemBorderLayer" | ||
| 79 | + inboxView.layer.addSublayer(borderLayer) | ||
| 60 | } | 80 | } |
| 61 | 81 | ||
| 62 | 82 | ||
| ... | @@ -65,11 +85,11 @@ import UIKit | ... | @@ -65,11 +85,11 @@ import UIKit |
| 65 | self.postImageURL = campaign.logo_url ?? "" | 85 | self.postImageURL = campaign.logo_url ?? "" |
| 66 | 86 | ||
| 67 | campaignTitleLabel.text = campaign.title ?? "" | 87 | campaignTitleLabel.text = campaign.title ?? "" |
| 68 | - campaignTitleLabel.font = UIFont(name: "PFSquareSansPro-BoldItalic", size: 18) | 88 | + campaignTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 17) |
| 69 | subtitleLabel.text = campaign.subtitle ?? "" | 89 | subtitleLabel.text = campaign.subtitle ?? "" |
| 70 | - subtitleLabel.font = UIFont(name: "PFSquareSansPro-Regular", size: 16) | 90 | + subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 15) |
| 71 | descriptionLabel.text = campaign.message ?? "" | 91 | descriptionLabel.text = campaign.message ?? "" |
| 72 | - descriptionLabel.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | 92 | + descriptionLabel.font = UIFont(name: "PeridotPE-SBold", size: 15) |
| 73 | 93 | ||
| 74 | if (campaign.is_new == true) { | 94 | if (campaign.is_new == true) { |
| 75 | newBadgeImage.isHidden = false | 95 | newBadgeImage.isHidden = false |
| ... | @@ -83,11 +103,11 @@ import UIKit | ... | @@ -83,11 +103,11 @@ import UIKit |
| 83 | self.postImageURL = ccms._imageUrl | 103 | self.postImageURL = ccms._imageUrl |
| 84 | 104 | ||
| 85 | campaignTitleLabel.text = ccms._title | 105 | campaignTitleLabel.text = ccms._title |
| 86 | - campaignTitleLabel.font = UIFont(name: "PFSquareSansPro-BoldItalic", size: 18) | 106 | + campaignTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 17) |
| 87 | subtitleLabel.text = ccms._subtitle | 107 | subtitleLabel.text = ccms._subtitle |
| 88 | - subtitleLabel.font = UIFont(name: "PFSquareSansPro-Regular", size: 16) | 108 | + subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 15) |
| 89 | descriptionLabel.text = ccms._description | 109 | descriptionLabel.text = ccms._description |
| 90 | - descriptionLabel.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | 110 | + descriptionLabel.font = UIFont(name: "PeridotPE-SBold", size: 15) |
| 91 | 111 | ||
| 92 | newBadgeImage.isHidden = true | 112 | newBadgeImage.isHidden = true |
| 93 | } | 113 | } | ... | ... |
| ... | @@ -54,30 +54,30 @@ import SwiftEventBus | ... | @@ -54,30 +54,30 @@ import SwiftEventBus |
| 54 | // tableView.clipsToBounds = true | 54 | // tableView.clipsToBounds = true |
| 55 | // tableView.layer.cornerRadius = 30 | 55 | // tableView.layer.cornerRadius = 30 |
| 56 | // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 56 | // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius |
| 57 | - tableView.contentInset.top = 50 | 57 | + tableView.contentInset.top = 10 |
| 58 | 58 | ||
| 59 | // Add Top left corner radius | 59 | // Add Top left corner radius |
| 60 | // mainView.clipsToBounds = true | 60 | // mainView.clipsToBounds = true |
| 61 | // mainView.layer.cornerRadius = 30 | 61 | // mainView.layer.cornerRadius = 30 |
| 62 | // mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 62 | // mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius |
| 63 | - mainView.backgroundColor = UIColor(red: 0.22, green: 0.32, blue: 0.40, alpha: 1.00) | 63 | + mainView.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00) |
| 64 | 64 | ||
| 65 | - let image = UIImage(named: "top_border_shadow", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! | 65 | +// let image = UIImage(named: "top_border_shadow", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! |
| 66 | - var aspectR: CGFloat = 0.0 | 66 | +// var aspectR: CGFloat = 0.0 |
| 67 | - | 67 | +// |
| 68 | - aspectR = image.size.width/image.size.height | 68 | +// aspectR = image.size.width/image.size.height |
| 69 | - | 69 | +// |
| 70 | - topBorderShadow.translatesAutoresizingMaskIntoConstraints = false | 70 | +// topBorderShadow.translatesAutoresizingMaskIntoConstraints = false |
| 71 | - topBorderShadow.image = image | 71 | +// topBorderShadow.image = image |
| 72 | - topBorderShadow.contentMode = .scaleAspectFill | 72 | +// topBorderShadow.contentMode = .scaleAspectFill |
| 73 | - | 73 | +// |
| 74 | - NSLayoutConstraint.activate([ | 74 | +// NSLayoutConstraint.activate([ |
| 75 | - topBorderShadow.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0), | 75 | +// topBorderShadow.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0), |
| 76 | - topBorderShadow.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0), | 76 | +// topBorderShadow.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0), |
| 77 | - topBorderShadow.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0), | 77 | +// topBorderShadow.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0), |
| 78 | - topBorderShadow.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width), | 78 | +// topBorderShadow.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width), |
| 79 | - topBorderShadow.heightAnchor.constraint(equalTo: topBorderShadow.widthAnchor, multiplier: 1/aspectR) | 79 | +// topBorderShadow.heightAnchor.constraint(equalTo: topBorderShadow.widthAnchor, multiplier: 1/aspectR) |
| 80 | - ]) | 80 | +// ]) |
| 81 | 81 | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| ... | @@ -211,8 +211,8 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -211,8 +211,8 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
| 211 | view.backgroundColor = .clear | 211 | view.backgroundColor = .clear |
| 212 | 212 | ||
| 213 | let titleLabel = UILabel(frame: CGRect(x: 20, y: 5, width: view.frame.width - 20, height: 43)) | 213 | let titleLabel = UILabel(frame: CGRect(x: 20, y: 5, width: view.frame.width - 20, height: 43)) |
| 214 | - titleLabel.font = UIFont(name: "PFSquareSansPro-Bold", size: 21) | 214 | + titleLabel.font = UIFont(name: "BTCosmo-Bold", size: 15) |
| 215 | - titleLabel.textColor = UIColor(rgb: 0xF4F4F4) | 215 | + titleLabel.textColor = UIColor(rgb: 0x212121) |
| 216 | titleLabel.text = categories[section].name | 216 | titleLabel.text = categories[section].name |
| 217 | 217 | ||
| 218 | view.addSubview(titleLabel) | 218 | view.addSubview(titleLabel) | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -523,3 +523,87 @@ class UnselectableTappableTextView: UITextView { | ... | @@ -523,3 +523,87 @@ class UnselectableTappableTextView: UITextView { |
| 523 | return false | 523 | return false |
| 524 | } | 524 | } |
| 525 | } | 525 | } |
| 526 | + | ||
| 527 | +extension UIBezierPath { | ||
| 528 | + convenience init(shouldRoundRect rect: CGRect, topLeftRadius: CGSize = .zero, topRightRadius: CGSize = .zero, bottomLeftRadius: CGSize = .zero, bottomRightRadius: CGSize = .zero){ | ||
| 529 | + | ||
| 530 | + self.init() | ||
| 531 | + | ||
| 532 | + let path = CGMutablePath() | ||
| 533 | + | ||
| 534 | + let topLeft = rect.origin | ||
| 535 | + let topRight = CGPoint(x: rect.maxX, y: rect.minY) | ||
| 536 | + let bottomRight = CGPoint(x: rect.maxX, y: rect.maxY) | ||
| 537 | + let bottomLeft = CGPoint(x: rect.minX, y: rect.maxY) | ||
| 538 | + | ||
| 539 | + if topLeftRadius != .zero{ | ||
| 540 | + path.move(to: CGPoint(x: topLeft.x+topLeftRadius.width, y: topLeft.y)) | ||
| 541 | + } else { | ||
| 542 | + path.move(to: CGPoint(x: topLeft.x, y: topLeft.y)) | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + if topRightRadius != .zero{ | ||
| 546 | + path.addLine(to: CGPoint(x: topRight.x-topRightRadius.width, y: topRight.y)) | ||
| 547 | + path.addCurve(to: CGPoint(x: topRight.x, y: topRight.y+topRightRadius.height), control1: CGPoint(x: topRight.x, y: topRight.y), control2:CGPoint(x: topRight.x, y: topRight.y+topRightRadius.height)) | ||
| 548 | + } else { | ||
| 549 | + path.addLine(to: CGPoint(x: topRight.x, y: topRight.y)) | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | + if bottomRightRadius != .zero{ | ||
| 553 | + path.addLine(to: CGPoint(x: bottomRight.x, y: bottomRight.y-bottomRightRadius.height)) | ||
| 554 | + path.addCurve(to: CGPoint(x: bottomRight.x-bottomRightRadius.width, y: bottomRight.y), control1: CGPoint(x: bottomRight.x, y: bottomRight.y), control2: CGPoint(x: bottomRight.x-bottomRightRadius.width, y: bottomRight.y)) | ||
| 555 | + } else { | ||
| 556 | + path.addLine(to: CGPoint(x: bottomRight.x, y: bottomRight.y)) | ||
| 557 | + } | ||
| 558 | + | ||
| 559 | + if bottomLeftRadius != .zero{ | ||
| 560 | + path.addLine(to: CGPoint(x: bottomLeft.x+bottomLeftRadius.width, y: bottomLeft.y)) | ||
| 561 | + path.addCurve(to: CGPoint(x: bottomLeft.x, y: bottomLeft.y-bottomLeftRadius.height), control1: CGPoint(x: bottomLeft.x, y: bottomLeft.y), control2: CGPoint(x: bottomLeft.x, y: bottomLeft.y-bottomLeftRadius.height)) | ||
| 562 | + } else { | ||
| 563 | + path.addLine(to: CGPoint(x: bottomLeft.x, y: bottomLeft.y)) | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + if topLeftRadius != .zero{ | ||
| 567 | + path.addLine(to: CGPoint(x: topLeft.x, y: topLeft.y+topLeftRadius.height)) | ||
| 568 | + path.addCurve(to: CGPoint(x: topLeft.x+topLeftRadius.width, y: topLeft.y) , control1: CGPoint(x: topLeft.x, y: topLeft.y) , control2: CGPoint(x: topLeft.x+topLeftRadius.width, y: topLeft.y)) | ||
| 569 | + } else { | ||
| 570 | + path.addLine(to: CGPoint(x: topLeft.x, y: topLeft.y)) | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + path.closeSubpath() | ||
| 574 | + cgPath = path | ||
| 575 | + } | ||
| 576 | +} | ||
| 577 | + | ||
| 578 | +extension UIView{ | ||
| 579 | + func roundCorners(topLeft: CGFloat = 0, topRight: CGFloat = 0, bottomLeft: CGFloat = 0, bottomRight: CGFloat = 0) {//(topLeft: CGFloat, topRight: CGFloat, bottomLeft: CGFloat, bottomRight: CGFloat) { | ||
| 580 | + let topLeftRadius = CGSize(width: topLeft, height: topLeft) | ||
| 581 | + let topRightRadius = CGSize(width: topRight, height: topRight) | ||
| 582 | + let bottomLeftRadius = CGSize(width: bottomLeft, height: bottomLeft) | ||
| 583 | + let bottomRightRadius = CGSize(width: bottomRight, height: bottomRight) | ||
| 584 | + let maskPath = UIBezierPath(shouldRoundRect: bounds, topLeftRadius: topLeftRadius, topRightRadius: topRightRadius, bottomLeftRadius: bottomLeftRadius, bottomRightRadius: bottomRightRadius) | ||
| 585 | + let shape = CAShapeLayer() | ||
| 586 | + shape.path = maskPath.cgPath | ||
| 587 | + layer.mask = shape | ||
| 588 | + } | ||
| 589 | +} | ||
| 590 | + | ||
| 591 | +extension UIView { | ||
| 592 | + func applyRadiusMaskFor(topLeft: CGFloat = 0, bottomLeft: CGFloat = 0, bottomRight: CGFloat = 0, topRight: CGFloat = 0) { | ||
| 593 | + | ||
| 594 | + let path = UIBezierPath() | ||
| 595 | + path.move(to: CGPoint(x: bounds.width - topRight, y: 0)) | ||
| 596 | + path.addLine(to: CGPoint(x: topLeft, y: 0)) | ||
| 597 | + path.addQuadCurve(to: CGPoint(x: 0, y: topLeft), controlPoint: .zero) | ||
| 598 | + path.addLine(to: CGPoint(x: 0, y: bounds.height - bottomLeft)) | ||
| 599 | + path.addQuadCurve(to: CGPoint(x: bottomLeft, y: bounds.height), controlPoint: CGPoint(x: 0, y: bounds.height)) | ||
| 600 | + path.addLine(to: CGPoint(x: bounds.width - bottomRight, y: bounds.height)) | ||
| 601 | + path.addQuadCurve(to: CGPoint(x: bounds.width, y: bounds.height - bottomRight), controlPoint: CGPoint(x: bounds.width, y: bounds.height)) | ||
| 602 | + path.addLine(to: CGPoint(x: bounds.width, y: topRight)) | ||
| 603 | + path.addQuadCurve(to: CGPoint(x: bounds.width - topRight, y: 0), controlPoint: CGPoint(x: bounds.width, y: 0)) | ||
| 604 | + | ||
| 605 | + let shape = CAShapeLayer() | ||
| 606 | + shape.path = path.cgPath | ||
| 607 | + layer.mask = shape | ||
| 608 | + } | ||
| 609 | +} | ... | ... |
-
Please register or login to post a comment