Insert new row into a section of UITableView based on selected row in UIPickerView - Swift -


i have custom inline uipickerview (essentially expanding/collapsing uipickerview) , there 3 options (rows) in picker view: "weekly", "monthly" , "enter manually". trying accomplish if user chooses row "enter manually", new row inserted below row containing custom uipickerview (which contain custom textinputcell have created - thats aside matter). uitableview represents form user can create "event" speak. there 4 sections , each section has different amount of rows, rows have expanding/collapsing uipickerviews , others have custom uitextfields, , others have expanding/collapsing uidatepickers. want happen 1 particular uipickerview, cannot seem working. had tried in didselectrowatindexpath when uipickerview collapsed selecting it's row:

   tableview.beginupdates()     if(cell.iskindofclass(pickercell)) {         let pickertableviewcell = cell as! pickercell         if(!pickertableviewcell.isexpanded() && pickertableviewcell.rightlabeltext() == numclasses[2]) {             alertoptions.insert("number of weeks", atindex: 1)             numberofrowsatsection[2] = 5             tableview.insertrowsatindexpaths([                 nsindexpath(forrow: alertoptions.count-3, insection: 2)                 ], withrowanimation: .automatic)         }     }     tableview.endupdates() 

the numclasses array uipickerview row data:

let numclasses = ["weekly", "monthly", "enter manually"] 

all uitableview data in separate arrays each section follows:

var numberofrowsatsection: [int] = [3, 4, 4, 3]  let mainoptions = ["client name", "invoicing email", "invoicing address"] let dateoptions = ["all day", "starts", "ends", "time zone"] var alertoptions = ["how many classes", "shown on calendar as", "alert email", "alert text"] let billingoptions = ["amount charged", "tax included", "billing date"] 

and suppose put condition between tablebeginupdates() , tableendupdates() test if right uipickerview like:

if(pickerviewtablecell.pickerview == numclassespicker.pickerview) { ... } 

is i'm trying possible or on right track? help!

here images better visual:

prior selecting "enter manually":

before

during selecting "enter manually", uipickerview expanded:

during

and after, collapsed , "enter manually" selected, i'm going here have new row between "how many classes" , "show on calendar as":

after

in alertoptions, add new object , reload tableview after finished action in pickerview.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -