what approach should i follow - swift










1















enter image description here



how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.



and all cell are clickable (push to another Viewcontroller)










share|improve this question

















  • 1





    It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

    – Paulw11
    Nov 15 '18 at 10:34











  • @Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

    – harinder rana
    Nov 15 '18 at 10:37







  • 2





    Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

    – Alladinian
    Nov 15 '18 at 10:42












  • you are not getting my point , here the cells are not fixed

    – harinder rana
    Nov 15 '18 at 11:06











  • Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

    – Paulw11
    Nov 15 '18 at 19:27















1















enter image description here



how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.



and all cell are clickable (push to another Viewcontroller)










share|improve this question

















  • 1





    It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

    – Paulw11
    Nov 15 '18 at 10:34











  • @Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

    – harinder rana
    Nov 15 '18 at 10:37







  • 2





    Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

    – Alladinian
    Nov 15 '18 at 10:42












  • you are not getting my point , here the cells are not fixed

    – harinder rana
    Nov 15 '18 at 11:06











  • Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

    – Paulw11
    Nov 15 '18 at 19:27













1












1








1








enter image description here



how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.



and all cell are clickable (push to another Viewcontroller)










share|improve this question














enter image description here



how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.



and all cell are clickable (push to another Viewcontroller)







ios swift tableview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 10:30









harinder ranaharinder rana

177




177







  • 1





    It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

    – Paulw11
    Nov 15 '18 at 10:34











  • @Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

    – harinder rana
    Nov 15 '18 at 10:37







  • 2





    Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

    – Alladinian
    Nov 15 '18 at 10:42












  • you are not getting my point , here the cells are not fixed

    – harinder rana
    Nov 15 '18 at 11:06











  • Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

    – Paulw11
    Nov 15 '18 at 19:27












  • 1





    It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

    – Paulw11
    Nov 15 '18 at 10:34











  • @Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

    – harinder rana
    Nov 15 '18 at 10:37







  • 2





    Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

    – Alladinian
    Nov 15 '18 at 10:42












  • you are not getting my point , here the cells are not fixed

    – harinder rana
    Nov 15 '18 at 11:06











  • Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

    – Paulw11
    Nov 15 '18 at 19:27







1




1





It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

– Paulw11
Nov 15 '18 at 10:34





It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.

– Paulw11
Nov 15 '18 at 10:34













@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

– harinder rana
Nov 15 '18 at 10:37






@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed

– harinder rana
Nov 15 '18 at 10:37





2




2





Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

– Alladinian
Nov 15 '18 at 10:42






Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a grouped style tableView, returning different types of cells in -cellForRowAtIndexPath:

– Alladinian
Nov 15 '18 at 10:42














you are not getting my point , here the cells are not fixed

– harinder rana
Nov 15 '18 at 11:06





you are not getting my point , here the cells are not fixed

– harinder rana
Nov 15 '18 at 11:06













Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

– Paulw11
Nov 15 '18 at 19:27





Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.

– Paulw11
Nov 15 '18 at 19:27












2 Answers
2






active

oldest

votes


















0














In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.



to register a prototype cell programatically use



func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)


if you use storyboard - you can simply drags multiple cells into the tableview



then in the



func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


you dequeue the right cell type



func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?


cell is "selectable" by utilising the tableview's delegate method



optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)





share|improve this answer






























    -1














    In order to create this view the easiest way from my side is
    Create a simple collection view with different sections and in each section, multiple rows will be there



    Here you check the screenshot of demoapp :
    http://prntscr.com/lioqjz



    Where section and rows both are dynamic



    To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:



    extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource 


    func numberOfSections(in collectionView: UICollectionView) -> Int
    return 3


    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
    return 5
    //If you have different rows with different sections then you follow through array count


    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

    let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell

    cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
    return cell





    and here is the SS of storyboard:
    http://prntscr.com/liosvm



    And to cell use to clickable, you can add UITapgesture in each cell






    share|improve this answer

























    • the exact view i want to build is this link link 2

      – harinder rana
      Nov 15 '18 at 13:20












    • Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

      – khusboo suhasini
      Nov 15 '18 at 13:56












    • imageView is not required

      – harinder rana
      Nov 16 '18 at 10:16










    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317375%2fwhat-approach-should-i-follow-swift%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.



    to register a prototype cell programatically use



    func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)


    if you use storyboard - you can simply drags multiple cells into the tableview



    then in the



    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


    you dequeue the right cell type



    func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?


    cell is "selectable" by utilising the tableview's delegate method



    optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)





    share|improve this answer



























      0














      In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.



      to register a prototype cell programatically use



      func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)


      if you use storyboard - you can simply drags multiple cells into the tableview



      then in the



      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


      you dequeue the right cell type



      func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?


      cell is "selectable" by utilising the tableview's delegate method



      optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)





      share|improve this answer

























        0












        0








        0







        In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.



        to register a prototype cell programatically use



        func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)


        if you use storyboard - you can simply drags multiple cells into the tableview



        then in the



        func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


        you dequeue the right cell type



        func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?


        cell is "selectable" by utilising the tableview's delegate method



        optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)





        share|improve this answer













        In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.



        to register a prototype cell programatically use



        func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)


        if you use storyboard - you can simply drags multiple cells into the tableview



        then in the



        func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


        you dequeue the right cell type



        func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?


        cell is "selectable" by utilising the tableview's delegate method



        optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 11:19









        Peter PajchlPeter Pajchl

        2,2321624




        2,2321624























            -1














            In order to create this view the easiest way from my side is
            Create a simple collection view with different sections and in each section, multiple rows will be there



            Here you check the screenshot of demoapp :
            http://prntscr.com/lioqjz



            Where section and rows both are dynamic



            To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:



            extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource 


            func numberOfSections(in collectionView: UICollectionView) -> Int
            return 3


            func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
            return 5
            //If you have different rows with different sections then you follow through array count


            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

            let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell

            cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
            return cell





            and here is the SS of storyboard:
            http://prntscr.com/liosvm



            And to cell use to clickable, you can add UITapgesture in each cell






            share|improve this answer

























            • the exact view i want to build is this link link 2

              – harinder rana
              Nov 15 '18 at 13:20












            • Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

              – khusboo suhasini
              Nov 15 '18 at 13:56












            • imageView is not required

              – harinder rana
              Nov 16 '18 at 10:16















            -1














            In order to create this view the easiest way from my side is
            Create a simple collection view with different sections and in each section, multiple rows will be there



            Here you check the screenshot of demoapp :
            http://prntscr.com/lioqjz



            Where section and rows both are dynamic



            To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:



            extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource 


            func numberOfSections(in collectionView: UICollectionView) -> Int
            return 3


            func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
            return 5
            //If you have different rows with different sections then you follow through array count


            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

            let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell

            cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
            return cell





            and here is the SS of storyboard:
            http://prntscr.com/liosvm



            And to cell use to clickable, you can add UITapgesture in each cell






            share|improve this answer

























            • the exact view i want to build is this link link 2

              – harinder rana
              Nov 15 '18 at 13:20












            • Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

              – khusboo suhasini
              Nov 15 '18 at 13:56












            • imageView is not required

              – harinder rana
              Nov 16 '18 at 10:16













            -1












            -1








            -1







            In order to create this view the easiest way from my side is
            Create a simple collection view with different sections and in each section, multiple rows will be there



            Here you check the screenshot of demoapp :
            http://prntscr.com/lioqjz



            Where section and rows both are dynamic



            To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:



            extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource 


            func numberOfSections(in collectionView: UICollectionView) -> Int
            return 3


            func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
            return 5
            //If you have different rows with different sections then you follow through array count


            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

            let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell

            cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
            return cell





            and here is the SS of storyboard:
            http://prntscr.com/liosvm



            And to cell use to clickable, you can add UITapgesture in each cell






            share|improve this answer















            In order to create this view the easiest way from my side is
            Create a simple collection view with different sections and in each section, multiple rows will be there



            Here you check the screenshot of demoapp :
            http://prntscr.com/lioqjz



            Where section and rows both are dynamic



            To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:



            extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource 


            func numberOfSections(in collectionView: UICollectionView) -> Int
            return 3


            func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
            return 5
            //If you have different rows with different sections then you follow through array count


            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

            let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell

            cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
            return cell





            and here is the SS of storyboard:
            http://prntscr.com/liosvm



            And to cell use to clickable, you can add UITapgesture in each cell







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 15 '18 at 12:30

























            answered Nov 15 '18 at 12:23









            khusboo suhasinikhusboo suhasini

            205111




            205111












            • the exact view i want to build is this link link 2

              – harinder rana
              Nov 15 '18 at 13:20












            • Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

              – khusboo suhasini
              Nov 15 '18 at 13:56












            • imageView is not required

              – harinder rana
              Nov 16 '18 at 10:16

















            • the exact view i want to build is this link link 2

              – harinder rana
              Nov 15 '18 at 13:20












            • Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

              – khusboo suhasini
              Nov 15 '18 at 13:56












            • imageView is not required

              – harinder rana
              Nov 16 '18 at 10:16
















            the exact view i want to build is this link link 2

            – harinder rana
            Nov 15 '18 at 13:20






            the exact view i want to build is this link link 2

            – harinder rana
            Nov 15 '18 at 13:20














            Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

            – khusboo suhasini
            Nov 15 '18 at 13:56






            Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g

            – khusboo suhasini
            Nov 15 '18 at 13:56














            imageView is not required

            – harinder rana
            Nov 16 '18 at 10:16





            imageView is not required

            – harinder rana
            Nov 16 '18 at 10:16

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317375%2fwhat-approach-should-i-follow-swift%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

            Museum of Modern and Contemporary Art of Trento and Rovereto