SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.24k stars 741 forks source link

SwiftMessages custom CenteredView extends to the screen's full height #530

Closed adamvnovak closed 8 months ago

adamvnovak commented 8 months ago

I have been using a custom view for SwiftMessages from loadFromNib() function in many projects and presenting it without any issues.

But now, suddenly, it's as if the view is constrained to the top and bottom of the screen, and one of the labels expands

Here's my code:

let messageView: CustomCenteredView = try! SwiftMessages.viewFromNib()            
messageView.configureContent(title: title, body: body)
messageView.customConfig(approveText: approveActionTitle, dismissText: rejectActionTitle ?? "")
messageView.approveAction = {
    SwiftMessages.hide()
    approveActionHandler()
}
messageView.dismissAction = {
    SwiftMessages.hide()
    rejectActionHandler?()
}

messageView.configureBackgroundView(width: 300)

var config = SwiftMessages.defaultConfig
config.presentationStyle = .center
config.duration = .forever
config.dimMode = .color(color: .customBlack.withAlphaComponent(0.8), interactive: false)
config.interactiveHide = false
config.presentationContext  = .window(windowLevel: UIWindow.Level.statusBar)

SwiftMessages.show(config: config, view: messageView)

Is there some underlying UI property I'm missing that I need to account for?

Screenshot 2023-10-11 at 10 23 05 AM

wtmoose commented 8 months ago

Them main thing I'd need to weigh in on this is the nib file to inspect the layout. Could you provide that?

adamvnovak commented 8 months ago

Well, suddenly this issue is no longer occurring, without any changes to code.

Perhaps it was an issue with the simulator or iOS 17. I'll reopen if the issue comes back.

wtmoose commented 8 months ago

Glad its working now