Not work UITableView in cellForRowAt But numberOfRowsInsection Work in Swift












0















I wrote a function to add a Cell in a UITableView.



numberOfRowsInSection works but cellForRowAt does not work.



class ShopMenuViewCell: UITableViewCell {
@IBOutlet weak var menuTableView: UITableView!

var menuPrice: MenuPrice!

override func awakeFromNib()
{
super.awakeFromNib()
}
}

extension ShopMenuViewCell
{
func setView()
{
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])

DispatchQueue.main.async
{
self.menuTableView.reloadData()
}
}
}

extension ShopMenuViewCell : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuInformationCell", for: indexPath) as? ShopMenuInformationCell,
let menu = self.menuPrice,
let name = menu.name,
let price = menu.amt else { return ShopMenuInformationCell() }

return cell
}
}


In ShpMenuInformationCell.swift



class ShopMenuInformationCell: UITableViewCell
{
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var shopNameLabel: UILabel!
@IBOutlet weak var menuNameLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!

override func awakeFromNib()
{
super.awakeFromNib()
}
}


I saw the answer to add a ViewController, but I do not know what to do because it is not a storyboard. (.xib)



I think it is because I add UITableViewCell in the UITableViewCell class.



Do you know why?










share|improve this question

























  • Please add regCells function code.

    – iVarun
    Nov 19 '18 at 9:05













  • I did not understand your request.

    – Enkha
    Nov 19 '18 at 9:09






  • 1





    tableview is inside another tableview cell. they don't have viewDidLoad. @i

    – Anand Verma
    Nov 19 '18 at 9:16













  • Thank you for your feedback.

    – Enkha
    Nov 19 '18 at 9:33











  • I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

    – sohan vanani
    Nov 19 '18 at 13:11
















0















I wrote a function to add a Cell in a UITableView.



numberOfRowsInSection works but cellForRowAt does not work.



class ShopMenuViewCell: UITableViewCell {
@IBOutlet weak var menuTableView: UITableView!

var menuPrice: MenuPrice!

override func awakeFromNib()
{
super.awakeFromNib()
}
}

extension ShopMenuViewCell
{
func setView()
{
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])

DispatchQueue.main.async
{
self.menuTableView.reloadData()
}
}
}

extension ShopMenuViewCell : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuInformationCell", for: indexPath) as? ShopMenuInformationCell,
let menu = self.menuPrice,
let name = menu.name,
let price = menu.amt else { return ShopMenuInformationCell() }

return cell
}
}


In ShpMenuInformationCell.swift



class ShopMenuInformationCell: UITableViewCell
{
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var shopNameLabel: UILabel!
@IBOutlet weak var menuNameLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!

override func awakeFromNib()
{
super.awakeFromNib()
}
}


I saw the answer to add a ViewController, but I do not know what to do because it is not a storyboard. (.xib)



I think it is because I add UITableViewCell in the UITableViewCell class.



Do you know why?










share|improve this question

























  • Please add regCells function code.

    – iVarun
    Nov 19 '18 at 9:05













  • I did not understand your request.

    – Enkha
    Nov 19 '18 at 9:09






  • 1





    tableview is inside another tableview cell. they don't have viewDidLoad. @i

    – Anand Verma
    Nov 19 '18 at 9:16













  • Thank you for your feedback.

    – Enkha
    Nov 19 '18 at 9:33











  • I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

    – sohan vanani
    Nov 19 '18 at 13:11














0












0








0








I wrote a function to add a Cell in a UITableView.



numberOfRowsInSection works but cellForRowAt does not work.



class ShopMenuViewCell: UITableViewCell {
@IBOutlet weak var menuTableView: UITableView!

var menuPrice: MenuPrice!

override func awakeFromNib()
{
super.awakeFromNib()
}
}

extension ShopMenuViewCell
{
func setView()
{
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])

DispatchQueue.main.async
{
self.menuTableView.reloadData()
}
}
}

extension ShopMenuViewCell : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuInformationCell", for: indexPath) as? ShopMenuInformationCell,
let menu = self.menuPrice,
let name = menu.name,
let price = menu.amt else { return ShopMenuInformationCell() }

return cell
}
}


In ShpMenuInformationCell.swift



class ShopMenuInformationCell: UITableViewCell
{
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var shopNameLabel: UILabel!
@IBOutlet weak var menuNameLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!

override func awakeFromNib()
{
super.awakeFromNib()
}
}


I saw the answer to add a ViewController, but I do not know what to do because it is not a storyboard. (.xib)



I think it is because I add UITableViewCell in the UITableViewCell class.



Do you know why?










share|improve this question
















I wrote a function to add a Cell in a UITableView.



numberOfRowsInSection works but cellForRowAt does not work.



class ShopMenuViewCell: UITableViewCell {
@IBOutlet weak var menuTableView: UITableView!

var menuPrice: MenuPrice!

override func awakeFromNib()
{
super.awakeFromNib()
}
}

extension ShopMenuViewCell
{
func setView()
{
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])

DispatchQueue.main.async
{
self.menuTableView.reloadData()
}
}
}

extension ShopMenuViewCell : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuInformationCell", for: indexPath) as? ShopMenuInformationCell,
let menu = self.menuPrice,
let name = menu.name,
let price = menu.amt else { return ShopMenuInformationCell() }

return cell
}
}


In ShpMenuInformationCell.swift



class ShopMenuInformationCell: UITableViewCell
{
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var shopNameLabel: UILabel!
@IBOutlet weak var menuNameLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!

override func awakeFromNib()
{
super.awakeFromNib()
}
}


I saw the answer to add a ViewController, but I do not know what to do because it is not a storyboard. (.xib)



I think it is because I add UITableViewCell in the UITableViewCell class.



Do you know why?







ios swift uitableview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 1:09







Enkha

















asked Nov 19 '18 at 9:01









EnkhaEnkha

1459




1459













  • Please add regCells function code.

    – iVarun
    Nov 19 '18 at 9:05













  • I did not understand your request.

    – Enkha
    Nov 19 '18 at 9:09






  • 1





    tableview is inside another tableview cell. they don't have viewDidLoad. @i

    – Anand Verma
    Nov 19 '18 at 9:16













  • Thank you for your feedback.

    – Enkha
    Nov 19 '18 at 9:33











  • I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

    – sohan vanani
    Nov 19 '18 at 13:11



















  • Please add regCells function code.

    – iVarun
    Nov 19 '18 at 9:05













  • I did not understand your request.

    – Enkha
    Nov 19 '18 at 9:09






  • 1





    tableview is inside another tableview cell. they don't have viewDidLoad. @i

    – Anand Verma
    Nov 19 '18 at 9:16













  • Thank you for your feedback.

    – Enkha
    Nov 19 '18 at 9:33











  • I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

    – sohan vanani
    Nov 19 '18 at 13:11

















Please add regCells function code.

– iVarun
Nov 19 '18 at 9:05







Please add regCells function code.

– iVarun
Nov 19 '18 at 9:05















I did not understand your request.

– Enkha
Nov 19 '18 at 9:09





I did not understand your request.

– Enkha
Nov 19 '18 at 9:09




1




1





tableview is inside another tableview cell. they don't have viewDidLoad. @i

– Anand Verma
Nov 19 '18 at 9:16







tableview is inside another tableview cell. they don't have viewDidLoad. @i

– Anand Verma
Nov 19 '18 at 9:16















Thank you for your feedback.

– Enkha
Nov 19 '18 at 9:33





Thank you for your feedback.

– Enkha
Nov 19 '18 at 9:33













I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

– sohan vanani
Nov 19 '18 at 13:11





I think your cell is not visible on screen that's why cellForRow is not calling have you checked with setting the background color to ShopMenuViewCell?

– sohan vanani
Nov 19 '18 at 13:11












3 Answers
3






active

oldest

votes


















1














Please try below code:



class ShopMenuViewCell: UITableViewCell
{
@IBOutlet weak var menuTableView: UITableView!

var menuPrice: MenuPrice!

override func awakeFromNib()
{
super.awakeFromNib()
}

fun setUpTable() {
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
self.menuTableView.reloadData()
}
}


and call the function setUpTable() from ShopMenuViewCell as an cell.setUpTable()






share|improve this answer
























  • I thought this was the answer, but it did not work. It's really sad.

    – Enkha
    Nov 19 '18 at 9:32











  • can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

    – Anand Verma
    Nov 19 '18 at 9:39













  • I added the code to the question.

    – Enkha
    Nov 19 '18 at 9:42











  • I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

    – Anand Verma
    Nov 19 '18 at 9:45













  • @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

    – Anand Verma
    Nov 19 '18 at 9:48





















0














Try below code:



Solution 1



class ShopMenuViewCell: UITableViewCell {

@IBOutlet weak var menuTableView: UITableView! {
didSet {
self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
self.menuTableView.delegate = self
self.menuTableView.dataSource = self
}
}
}




Solution 2: Please check Anand Verma Answer






share|improve this answer
























  • I`ll try. Thank you very much.

    – Enkha
    Nov 19 '18 at 10:59



















0














I had a problem for about 5 days and found a solution!



First Reference Site: Joel's Answer cellForRowAtIndexPath: not called



Second reference site: Paolo's answer
Swift: UITableViewCell rowheight



When I add another kind of TableCell, the vertical size of the cell in question is small.



So I increased the size of the Cell's RowHeight (frame.height) before reloading the data and it's fixed!



Currently, cellforrowat runs safely. Your answers were helpful to the results.






share|improve this answer























    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%2f53371245%2fnot-work-uitableview-in-cellforrowat-but-numberofrowsinsection-work-in-swift%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Please try below code:



    class ShopMenuViewCell: UITableViewCell
    {
    @IBOutlet weak var menuTableView: UITableView!

    var menuPrice: MenuPrice!

    override func awakeFromNib()
    {
    super.awakeFromNib()
    }

    fun setUpTable() {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    self.menuTableView.reloadData()
    }
    }


    and call the function setUpTable() from ShopMenuViewCell as an cell.setUpTable()






    share|improve this answer
























    • I thought this was the answer, but it did not work. It's really sad.

      – Enkha
      Nov 19 '18 at 9:32











    • can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

      – Anand Verma
      Nov 19 '18 at 9:39













    • I added the code to the question.

      – Enkha
      Nov 19 '18 at 9:42











    • I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

      – Anand Verma
      Nov 19 '18 at 9:45













    • @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

      – Anand Verma
      Nov 19 '18 at 9:48


















    1














    Please try below code:



    class ShopMenuViewCell: UITableViewCell
    {
    @IBOutlet weak var menuTableView: UITableView!

    var menuPrice: MenuPrice!

    override func awakeFromNib()
    {
    super.awakeFromNib()
    }

    fun setUpTable() {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    self.menuTableView.reloadData()
    }
    }


    and call the function setUpTable() from ShopMenuViewCell as an cell.setUpTable()






    share|improve this answer
























    • I thought this was the answer, but it did not work. It's really sad.

      – Enkha
      Nov 19 '18 at 9:32











    • can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

      – Anand Verma
      Nov 19 '18 at 9:39













    • I added the code to the question.

      – Enkha
      Nov 19 '18 at 9:42











    • I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

      – Anand Verma
      Nov 19 '18 at 9:45













    • @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

      – Anand Verma
      Nov 19 '18 at 9:48
















    1












    1








    1







    Please try below code:



    class ShopMenuViewCell: UITableViewCell
    {
    @IBOutlet weak var menuTableView: UITableView!

    var menuPrice: MenuPrice!

    override func awakeFromNib()
    {
    super.awakeFromNib()
    }

    fun setUpTable() {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    self.menuTableView.reloadData()
    }
    }


    and call the function setUpTable() from ShopMenuViewCell as an cell.setUpTable()






    share|improve this answer













    Please try below code:



    class ShopMenuViewCell: UITableViewCell
    {
    @IBOutlet weak var menuTableView: UITableView!

    var menuPrice: MenuPrice!

    override func awakeFromNib()
    {
    super.awakeFromNib()
    }

    fun setUpTable() {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    self.menuTableView.reloadData()
    }
    }


    and call the function setUpTable() from ShopMenuViewCell as an cell.setUpTable()







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 19 '18 at 9:15









    Anand VermaAnand Verma

    31938




    31938













    • I thought this was the answer, but it did not work. It's really sad.

      – Enkha
      Nov 19 '18 at 9:32











    • can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

      – Anand Verma
      Nov 19 '18 at 9:39













    • I added the code to the question.

      – Enkha
      Nov 19 '18 at 9:42











    • I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

      – Anand Verma
      Nov 19 '18 at 9:45













    • @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

      – Anand Verma
      Nov 19 '18 at 9:48





















    • I thought this was the answer, but it did not work. It's really sad.

      – Enkha
      Nov 19 '18 at 9:32











    • can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

      – Anand Verma
      Nov 19 '18 at 9:39













    • I added the code to the question.

      – Enkha
      Nov 19 '18 at 9:42











    • I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

      – Anand Verma
      Nov 19 '18 at 9:45













    • @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

      – Anand Verma
      Nov 19 '18 at 9:48



















    I thought this was the answer, but it did not work. It's really sad.

    – Enkha
    Nov 19 '18 at 9:32





    I thought this was the answer, but it did not work. It's really sad.

    – Enkha
    Nov 19 '18 at 9:32













    can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

    – Anand Verma
    Nov 19 '18 at 9:39







    can you please send regCells(cells: ["ShopMenuInformationCell"]) function.? @Enkha

    – Anand Verma
    Nov 19 '18 at 9:39















    I added the code to the question.

    – Enkha
    Nov 19 '18 at 9:42





    I added the code to the question.

    – Enkha
    Nov 19 '18 at 9:42













    I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

    – Anand Verma
    Nov 19 '18 at 9:45







    I'm not able to find out in code. It will be inside the UITableViewExtension regCells(cells: ["ShopMenuInformationCell"])

    – Anand Verma
    Nov 19 '18 at 9:45















    @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

    – Anand Verma
    Nov 19 '18 at 9:48







    @Enkha Use this code inside cellForRow func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { guard let cell = tableView.dequeueReusableCell(withIdentifier: "ShopMenuViewCell") as? ShopMenuViewCell else { fatalError() } cell.backgroudColor = .red return cell }

    – Anand Verma
    Nov 19 '18 at 9:48















    0














    Try below code:



    Solution 1



    class ShopMenuViewCell: UITableViewCell {

    @IBOutlet weak var menuTableView: UITableView! {
    didSet {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    }
    }
    }




    Solution 2: Please check Anand Verma Answer






    share|improve this answer
























    • I`ll try. Thank you very much.

      – Enkha
      Nov 19 '18 at 10:59
















    0














    Try below code:



    Solution 1



    class ShopMenuViewCell: UITableViewCell {

    @IBOutlet weak var menuTableView: UITableView! {
    didSet {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    }
    }
    }




    Solution 2: Please check Anand Verma Answer






    share|improve this answer
























    • I`ll try. Thank you very much.

      – Enkha
      Nov 19 '18 at 10:59














    0












    0








    0







    Try below code:



    Solution 1



    class ShopMenuViewCell: UITableViewCell {

    @IBOutlet weak var menuTableView: UITableView! {
    didSet {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    }
    }
    }




    Solution 2: Please check Anand Verma Answer






    share|improve this answer













    Try below code:



    Solution 1



    class ShopMenuViewCell: UITableViewCell {

    @IBOutlet weak var menuTableView: UITableView! {
    didSet {
    self.menuTableView.regCells(cells: ["ShopMenuInformationCell"])
    self.menuTableView.delegate = self
    self.menuTableView.dataSource = self
    }
    }
    }




    Solution 2: Please check Anand Verma Answer







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 19 '18 at 9:45









    iOS_MaccusiOS_Maccus

    30610




    30610













    • I`ll try. Thank you very much.

      – Enkha
      Nov 19 '18 at 10:59



















    • I`ll try. Thank you very much.

      – Enkha
      Nov 19 '18 at 10:59

















    I`ll try. Thank you very much.

    – Enkha
    Nov 19 '18 at 10:59





    I`ll try. Thank you very much.

    – Enkha
    Nov 19 '18 at 10:59











    0














    I had a problem for about 5 days and found a solution!



    First Reference Site: Joel's Answer cellForRowAtIndexPath: not called



    Second reference site: Paolo's answer
    Swift: UITableViewCell rowheight



    When I add another kind of TableCell, the vertical size of the cell in question is small.



    So I increased the size of the Cell's RowHeight (frame.height) before reloading the data and it's fixed!



    Currently, cellforrowat runs safely. Your answers were helpful to the results.






    share|improve this answer




























      0














      I had a problem for about 5 days and found a solution!



      First Reference Site: Joel's Answer cellForRowAtIndexPath: not called



      Second reference site: Paolo's answer
      Swift: UITableViewCell rowheight



      When I add another kind of TableCell, the vertical size of the cell in question is small.



      So I increased the size of the Cell's RowHeight (frame.height) before reloading the data and it's fixed!



      Currently, cellforrowat runs safely. Your answers were helpful to the results.






      share|improve this answer


























        0












        0








        0







        I had a problem for about 5 days and found a solution!



        First Reference Site: Joel's Answer cellForRowAtIndexPath: not called



        Second reference site: Paolo's answer
        Swift: UITableViewCell rowheight



        When I add another kind of TableCell, the vertical size of the cell in question is small.



        So I increased the size of the Cell's RowHeight (frame.height) before reloading the data and it's fixed!



        Currently, cellforrowat runs safely. Your answers were helpful to the results.






        share|improve this answer













        I had a problem for about 5 days and found a solution!



        First Reference Site: Joel's Answer cellForRowAtIndexPath: not called



        Second reference site: Paolo's answer
        Swift: UITableViewCell rowheight



        When I add another kind of TableCell, the vertical size of the cell in question is small.



        So I increased the size of the Cell's RowHeight (frame.height) before reloading the data and it's fixed!



        Currently, cellforrowat runs safely. Your answers were helpful to the results.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 2:13









        EnkhaEnkha

        1459




        1459






























            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%2f53371245%2fnot-work-uitableview-in-cellforrowat-but-numberofrowsinsection-work-in-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







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?