开发者

UITableView - Adding additional rows

开发者 https://www.devze.com 2023-04-01 03:05 出处:网络
I have created a UITableView in an app, using the basis of a tutorial from the following link; http://www.theappcodeblog.com/?p=353

I have created a UITableView in an app, using the basis of a tutorial from the following link;

http://www.theappcodeblog.com/?p=353

I have customised the style to my needs and it works perfectly. However, if i wanted to add additional rows to the table I come across a problem. I have my three NSMutableArrays which contain category, subCategory and categoryDetails. I have added an additional entry to each of the existing 6 to form a new row.

I assumed that would be ok, as the numberOfRowsInSection code is set to return [category count];

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return [category count];
}

I assumed that by adding an entry for each array, adding an image it would check the categ开发者_JAVA技巧ory count and auto add a new row. However, what it actually does it repeat the first array and then stack the new one on top of it overlapping.

Any ideas?


It would seem that its something to do with the cellForRowAtIndexPath. Without actually seeing the code i'd say that you are adding new labels pertaining to the 7th row to the already created 6th row. And hence the overlapping.


Are you calling the reload data method of the table view when your data changes?

[tableView reloadData];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号