create drop down in UITableView swift -




i have gotten point have selectable list of options, loaded same .xib files. trying make upon click on cell different .xib file populated below, , of other cells shift down. however, unsure of how have 2 different xib's tableviewcells in swift.

enter image description here

there's 2 ways can think of accomplish trying do:

  1. single xib file: should use single xib file hides lower section contains options until cell tapped. when tapped, property on uitablecell class set, e.g. isexpanded. when isexpanded set, cell unhide options (by changing constraints).
  2. multiple xibs: when tapped, insert new item datasource. in cellforrow, check identifier , load either regular cell or options cell using this:

    func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { if indexpath.row == optionsrow {     let cell = tableview.dequeuereusablecell(withidentifier: optionscellidentifier, for: indexpath) as! optionscell     //configure cell here     return cell } else {     let cell = tableview.dequeuereusablecell(withidentifier: normalcellidentifier, for: indexpath) as! normalcell     //configure cell here     return cell } 

    }





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -