Closed rigaldamez closed 5 years ago
Hi @rigaldamez! I plan on fixing this tomorrow. Sorry for the inconvenience. Stay tuned!
This has been fixed in the 2.4.1 Cocoapods release!
thanks Daltron, how can I load a custom view within FloatingNotificationBanner
?
That currently isn't possible as FloatingNotificationBanner
doesn't inherit from NotificationBanner
which is the only class that supports custom views. This definitely needs to be added though. I have created an issue to track this.
@rigaldamez, this can now be found in the 2.5.0
CocoaPods release!
finally got a chance to test this and its not working for me... do I need to set the corner radius?
let banner = FloatingNotificationBanner(customView: myCustomView)
banner.show()
You will need to set the cornerRadius
when calling the show()
method like so: show(cornerRadius: 10)
I'm scratching my head, this is my code and the output is still square corners?
Can you show me what your custom view consists of and how you are initializing it. I'm not seeing any issues.
Initialising myCustomView
and displaying using FloatingNotificationBanner
let imageData:NSData = NSData(contentsOf: imageUrl)!
DispatchQueue.main.async {
let image = UIImage(data: imageData as Data)
let myCustomView = NotificationBannerReply()
myCustomView.contentView.backgroundColor = #colorLiteral(red: 0.8745098039, green: 0.3019607843, blue: 0.4117647059, alpha: 1)
myCustomView.clinkBtnView.isHidden = false
myCustomView.userSelectedId = toId
myCustomView.venueId = venueId
myCustomView.nameLbl.text = name
myCustomView.profileImg.image = image
myCustomView.messageLbl.text = "Acknowledged your compliment"
//Banner
let banner = FloatingNotificationBanner(customView: myCustomView)
banner.autoDismiss = false
banner.dismissOnTap = true
banner.dismissOnSwipeUp = true
banner.show(cornerRadius: 10)
//Then remove from firebase once banner message has been shown
let ref = self.REF_USERS_COMPLIMENTS_ACK.child(uid).child(complimentId)
ref.removeValue()
}//end DispatchQueue.main.async
This is my NotificationBannerReply
class NotificationBannerReply: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet weak var profileImg: CircleImage!
@IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var messageLbl: UILabel!
@IBOutlet weak var clinkBtnView: DropShadowCircleView!
var userSelectedId: String?
var venueId: String?
//taptic
let tapticGenerator = UINotificationFeedbackGenerator()
override init(frame: CGRect) {
super.init(frame: frame)
loadViewFromXib()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadViewFromXib()
}
func loadViewFromXib() {
Bundle.main.loadNibNamed("NotificationBannerReply", owner: self, options: nil)
addSubview(contentView)
contentView.frame = self.bounds
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}
I believe the problem is your loading your contentView from a xib and adding it as a subview. There is no workaround for this right now. You will need to set the cornerRadius of the contentView yourself in the xib or via code in this class. It should work then. 👍
that worked!
Thanks so much for your support and for the great work you've put in to make this library available for us learners to use :)
Hi,
regarding #213