NotificationBanner icon indicating copy to clipboard operation
NotificationBanner copied to clipboard

FloatingNotificationBanner missing on recently release 2.4.0?

Open rigaldamez opened this issue 7 years ago • 12 comments

Hi,

regarding #213

image

rigaldamez avatar Jul 15 '19 02:07 rigaldamez

Hi @rigaldamez! I plan on fixing this tomorrow. Sorry for the inconvenience. Stay tuned!

Daltron avatar Jul 15 '19 02:07 Daltron

This has been fixed in the 2.4.1 Cocoapods release!

Daltron avatar Jul 15 '19 14:07 Daltron

thanks Daltron, how can I load a custom view within FloatingNotificationBanner?

image

rigaldamez avatar Jul 16 '19 00:07 rigaldamez

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.

Daltron avatar Jul 16 '19 01:07 Daltron

@rigaldamez, this can now be found in the 2.5.0 CocoaPods release!

Daltron avatar Jul 17 '19 14:07 Daltron

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()

rigaldamez avatar Jul 22 '19 01:07 rigaldamez

You will need to set the cornerRadius when calling the show() method like so: show(cornerRadius: 10)

Daltron avatar Jul 22 '19 13:07 Daltron

I'm scratching my head, this is my code and the output is still square corners?

image

image

rigaldamez avatar Jul 22 '19 23:07 rigaldamez

Simulator Screen Shot - iPhone 8 Plus - 2019-07-22 at 20 52 45

Can you show me what your custom view consists of and how you are initializing it. I'm not seeing any issues.

Daltron avatar Jul 23 '19 01:07 Daltron

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]
        
    }
}

rigaldamez avatar Jul 23 '19 03:07 rigaldamez

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. 👍

Daltron avatar Jul 24 '19 13:07 Daltron

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 :)

rigaldamez avatar Jul 24 '19 23:07 rigaldamez