UIAlertController is always outputting from the top, how can I output from the bottom, or change the output?

23 Views Asked by At

private func openTypePicker() { let alert = UIAlertController(title: "select_pay_date".localize(), message: "", preferredStyle: .actionSheet)

    let pickerView = UIPickerView(frame: CGRect(x: 0, y: 10, width: alert.view.bounds.width - 20, height: 280))
    pickerView.dataSource = self
    pickerView.delegate = self
    alert.view.addSubview(pickerView)
    alert.isModalInPopover = true
    print(alert.view.frame)
    if #available(iOS 13.0, *) {
        let theme = SharedManager.getApplicationThemeForSystem()
        alert.overrideUserInterfaceStyle = theme
        pickerView.overrideUserInterfaceStyle = theme
    }[enter image description here](https://i.stack.imgur.com/sktIN.png)
    if let vv = alert.view {
        let cons:NSLayoutConstraint = NSLayoutConstraint(item: vv, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.greaterThanOrEqual, toItem: pickerView, attribute: NSLayoutConstraint.Attribute.height, multiplier: 1.00, constant: 70)
        alert.view.addConstraint(cons)

    }
    alert.addAction(UIAlertAction(title: LanguageManager.get("OK"), style: .default, handler: { action in
        let index = pickerView.selectedRow(inComponent: 0)
        self.handlePicker(didSelectRow: index)
    }))
    **self.present(alert, animated: true, completion: nil)**
}

I am presenting the AlertViewController but it is coming from the top

0

There are 0 best solutions below