mardi 29 avril 2014

iPhone - cellForRowAtIndexPath ne pas appelé et numberOfSections et numberOfRows sont plus grand que zéro - Stack Overflow


I have a strange problem that ocurrs with simulator of iPhone 4 but not with simulator of iPhone 5...


The situation is: I have a screen composed by one VC that contains a TableViewController. In the class of VC I declared the delegates classes of UITableView (UITableViewDelegate, UITableViewDataSource). Also, I have pointed the delegate and the dataSource to File's Owner.


With this situation, I run the app at iPhone 5 Simulator and all works perfectly, but it I run the app at iPhone 4 Simulator, the TableView is not shown. This ocurrs with all test that I have done.


I hardcoded the return value of methods numberOfSectionsInTableView, numberOfRowsInSection for return always a number: "return 1" and "return 2", respectively. When I run it, step by step, I can see that values returned for these methods are ok, but when I force to call:


[tableview reloadData]


never call to cellForRowAtIndexPath...


Any idea??


Thanks!




Check



  • add <UITableViewDataSource,UITableViewDelegate> to .h declaration

  • Connect the dataSource and delegate methods



I have a strange problem that ocurrs with simulator of iPhone 4 but not with simulator of iPhone 5...


The situation is: I have a screen composed by one VC that contains a TableViewController. In the class of VC I declared the delegates classes of UITableView (UITableViewDelegate, UITableViewDataSource). Also, I have pointed the delegate and the dataSource to File's Owner.


With this situation, I run the app at iPhone 5 Simulator and all works perfectly, but it I run the app at iPhone 4 Simulator, the TableView is not shown. This ocurrs with all test that I have done.


I hardcoded the return value of methods numberOfSectionsInTableView, numberOfRowsInSection for return always a number: "return 1" and "return 2", respectively. When I run it, step by step, I can see that values returned for these methods are ok, but when I force to call:


[tableview reloadData]


never call to cellForRowAtIndexPath...


Any idea??


Thanks!



Check



  • add <UITableViewDataSource,UITableViewDelegate> to .h declaration

  • Connect the dataSource and delegate methods


0 commentaires:

Enregistrer un commentaire