SwiftKickMobile / SwiftMessages

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

Error layout in iphone12 pro max , Iphone11pro max, Xs max #457

Closed trinhson97 closed 3 years ago

trinhson97 commented 3 years ago

layout Margin Additions displayed incorrectly on iphone12 pro max , Iphone11pro max and iphone Xs max. Simulator Screen Shot - iPhone 11 Pro Max - 2021-02-25 at 14 28 30

trinhson97 commented 3 years ago

Here is the code used:

trinhson97 commented 3 years ago
    let success = MessageView.viewFromNib(layout: .cardView)
    success.configureTheme(.success)
    success.configureDropShadow()
    success.configureContent(title: "Success", body: "Something good happened!")
    success.button?.isHidden = false

    var successConfig = SwiftMessages.defaultConfig
    successConfig.presentationStyle = .top
    successConfig.presentationContext = .window(windowLevel: UIWindow.Level.normal)
    SwiftMessages.show(config: successConfig, view: success)
trinhson97 commented 3 years ago

plz help me

wtmoose commented 3 years ago

What do you want it to look like?

trinhson97 commented 3 years ago

I do want it to show as follows on screen ngang iphone xs max / iphone 11pro max : Simulator Screen Shot - iPhone 11 Pro - 2021-02-26 at 13 43 16

trinhson97 commented 3 years ago

can you help me

canhth commented 3 years ago

@wtmoose Let me clarify @trinhson97 question.

He's facing an issue in landscape mode with CardView on iPhone12 Pro Max, 11 Pro Max, Xs Max.

The CornerRoundingView frame should be updated when switching from Portrait to Landscape. In his case, the size still the same in both Portrait and Landscape mode. (It works with other iPhone type except Pro Max version)

For @trinhson97, please create a Pull Request if you do know how to fix this issue.

Kamui-IOS commented 3 years ago

i have the same problem.

wtmoose commented 3 years ago

@canhth thank you.

This is behaving as designed. The Max phones are regular size class in landscape. SwiftMessages uses a different layout in regular size class because developers didn't want the messages to span across the entire screen on iPad. The regular size class layout uses the view's intrinsic width with a maximum width of 500pt @ 950 priority.

My suggestion is that folks stick with the current behavior. If not, my thoughts are:

  1. App developers can add a width or minimum width constraint to messageView.backgroundView to preserve a desired width.
  2. SwiftMessages could add an option to always use the compact size class layout. However, the option would be apply to iPad and Max phones. If app developers only want to apply the option to Max phones, they would be responsible for implementing that logic.

I am in the middle of a major layout system revamp (check out the head of master) that will gives app developers straight forward and powerful control of the message layout, so I'm not very interested in taking on (2) as a tangent.

I'm open to suggestions.

trinhson97 commented 3 years ago

@wtmoose thank you.

trinhson97 commented 3 years ago

Can you help me demo?

wtmoose commented 3 years ago

@trinhson97 I don't understand what you're asking for

wtmoose commented 3 years ago

No reply...closing