Posts

Showing posts from November, 2022

UIStepper action with apply the value to the label iOS swift

 Solution: I had connected the stepper for action with change value.While user clicks + or - action then it will be apply the value to the stepperlabel using the below code.Stepper don't had any label you have to connect with other one.   @IBAction   func   didTaponStepper ( _  sender:  Any ) {          stepperLabel . text  = (sender  as !  UIStepper ). value . description     }

Dropdown with custom view swift || dropdown option with customcell in swift

Image
 Solution: {      let  dropDown =  DropDown ()      var  control: UIView ! = btn. plainView      var  items:[ String ] = []      for  value  in  values {          let  name = value[ "name" ]         items. append ( " \(name) " )     }     dropDown. anchorView  = sender !=  nil  ? sender : control  // UIView or UIBarButtonItem     dropDown. selectionBackgroundCo lor  = . gray     dropDown. direction  = . any     dropDown. dataSource  = items     dropDown. cellHeight  = 60     dropDown. separatorColor  = . gray     dropDown. cellNib  =  UINib ( nibName :  "Cell" ,  bundle :  nil )     dropDown. customCellConfigurati on  = { [viewControl] (index:  Index , item:  String , cell:  DropDownCell ) ->  Void   in         guard   let  cell = cell  as ?  Cell   else  {  return  }                  cell. optionLabel . text  = item         // Setup your custom UI components     }         dropDown. selectionAction  = { [ unowned  viewControl] (index:  Int , item:  Stri