iOSDropDown
iOSDropDown copied to clipboard
Prevent dropDown from opening when some pre condition not satisfy on dropDown.listWillAppear ?
Hello guys, I want to track initial tap when any user taps on dropdown to check initially some condition & if condition satisfy then and then only user can tap on drop down otherwise some related user friendly message I will show.
Currently there is only post selection i.e. (dropDown.didSelection) method available but I want method when user taps initially to check some pre condition.
lazy var departmentDropDown: DropDown = {
let dd = DropDown()
dd.translatesAutoresizingMaskIntoConstraints = false
dd.placeholder = "Select Department"
dd.textColor = .darkGray
dd.font = UIFont.systemFont(ofSize: 16, weight: .medium)
// dd.addTarget(self, action: #selector(handleDepartmentDropDown), for: .touchUpInside) // want to track below func
return dd
}()
@objc func handleDepartmentDropDown() {
print(123)
}
available Closures
listWillAppear() { //You can Do anything when iOS DropDown willAppear }
listDidAppear() { //You can Do anything when iOS DropDown listDidAppear }
listWillDisappear() { //You can Do anything when iOS DropDown listWillDisappear }
listDidDisappear() { //You can Do anything when iOS DropDown listDidDisappear }
Thanks @jriosdev , I was forget that.
give one star to iOSDropDown If you like :)
Yes sure @jriosdev, also have one question that have you fully check from memory leaks and some related optimisation factors?
@jriosdev can you please guide how can I prevent dropDown form opening when some condition not satisfies on willAppear?
Hidelist in the dropdown
On Thu, 22 Aug 2019 at 6:00 PM Irfan Ajmeri [email protected] wrote:
Reopened #50 https://github.com/jriosdev/iOSDropDown/issues/50.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/jriosdev/iOSDropDown/issues/50?email_source=notifications&email_token=AJI3B66CSMNJBIKNBES7JNDQF2BGPA5CNFSM4IOT56L2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOTGHTFRA#event-2576298692, or mute the thread https://github.com/notifications/unsubscribe-auth/AJI3B653BBWUWRSI224ZUC3QF2BGPANCNFSM4IOT56LQ .
Hidelist in the dropdown … On Thu, 22 Aug 2019 at 6:00 PM Irfan Ajmeri @.***> wrote: Reopened #50 <#50>. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#50?email_source=notifications&email_token=AJI3B66CSMNJBIKNBES7JNDQF2BGPA5CNFSM4IOT56L2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOTGHTFRA#event-2576298692>, or mute the thread https://github.com/notifications/unsubscribe-auth/AJI3B653BBWUWRSI224ZUC3QF2BGPANCNFSM4IOT56LQ .
It causes crash when I will try to do dropDown.hideList() Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
public func hideList() {
TableWillDisappearCompletion()
UIView.animate(withDuration: 0.75,
delay: 0.25,
usingSpringWithDamping: 0.5,
initialSpringVelocity: 0,
options: .curveLinear,
animations: { () -> Void in
self.table.frame = CGRect(x: self.pointToParent.x,
y: self.pointToParent.y+self.frame.height,
width: self.frame.width,
height: 0)
self.shadow.alpha = 0
self.shadow.frame = self.table.frame
self.arrow.position = .down
},
completion: { (didFinish) -> Void in
self.shadow.removeFromSuperview()
self.table.removeFromSuperview()
self.backgroundView.removeFromSuperview()
self.isSelected = false
self.TableDidDisappearCompletion()
})
}
@jriosdev kindly guide how can I prevent to opening dropDown if some condition not satisfies with steps or code snippet?