skywinder / ActionSheetPicker-3.0

Quickly reproduce the dropdown UIPickerView / ActionSheet functionality on iOS.
http://skywinder.github.io/ActionSheetPicker-3.0
BSD 3-Clause "New" or "Revised" License
3.4k stars 740 forks source link

Picker not showing on iPad but only on iPhone #540

Closed mrafayfarooq closed 3 years ago

mrafayfarooq commented 3 years ago

I am working on an app that uses ActionSheetPicker version 2.7.1. The app shows all the pickers fine when use from iPhone but fails on iPad. Below is the code to show the picker and it's being shown from a table view cell

let datePicker = ActionSheetDatePicker(title: titleText,
                                               datePickerMode: mode,
                                               selectedDate: selectedDate,
                                               doneBlock: { (picker, value, index) in

                                                if let date = value as? Date {
                                                    completion(true, date)

                                                } else {
                                                    completion(false, nil)
                                                }
        }, cancel: { (picker) in
            completion(false, nil)

        }, origin: view)
        if #available(iOS 13.4, *) {
            datePicker?.datePickerStyle = .automatic
        }
        datePicker?.show()
    }

on the logs, I get this

2021-09-18 18:58:34.097959-0500 Beeconz[73715:14480128] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600002d74370 UIView:0x7fe931f130b0.top == UILayoutGuide:0x6000034fe300.top>",
    "<NSLayoutConstraint:0x600002d77480 UIView:0x7fe931f130b0.bottom == UILayoutGuide:0x6000034fe300.bottom>",
    "<NSLayoutConstraint:0x600002e95090 UIView:0x7fe9319d4dd0.height == 0>",
    "<NSLayoutConstraint:0x600002d75cc0 UIView:0x7fe9319d4dd0.bottom == UILayoutGuide:0x6000034fe300.bottom + 13>",
    "<NSLayoutConstraint:0x600002d76300 UILayoutGuide:0x6000034fe300.top == UIView:0x7fe9319d4dd0.top>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600002d77480 UIView:0x7fe931f130b0.bottom == UILayoutGuide:0x6000034fe300.bottom>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

so somewhere it's breaking the view. Any help would be appreciated.

noorulain17 commented 3 years ago

@mrafayfarooq you need to define the origin view in iPad (other than the main UIViewController view)

Screen Shot 2021-09-19 at 5 06 46 PM