使用 Objective C 设置 UITableViewCell 之间的边距
Set margin between UITableViewCell using Objective C
有没有最好的方法来设置 UITableViewCell 之间的边距,我在 table 单元格中有一个图像和一个标签,我知道这个问题可以标记为可能重复但我搜索了很多,几乎到处都找到的解决方案是;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return yourArry.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
但问题是,当我尝试上面的代码时,函数 cellForRowAtIndexPath 每次都返回 0 并且最终整个 table 在每个单元格中显示相同的值。由于我是 IOS 开发的新手,我无法解决这个问题,任何建议将不胜感激。
解决,我只是在imageView和cell container之间设置了margin bottom(重置了AutoLayout中的约束),比如10.5,现在imageView没有附加到下一个细胞.
有没有最好的方法来设置 UITableViewCell 之间的边距,我在 table 单元格中有一个图像和一个标签,我知道这个问题可以标记为可能重复但我搜索了很多,几乎到处都找到的解决方案是;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return yourArry.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
但问题是,当我尝试上面的代码时,函数 cellForRowAtIndexPath 每次都返回 0 并且最终整个 table 在每个单元格中显示相同的值。由于我是 IOS 开发的新手,我无法解决这个问题,任何建议将不胜感激。
解决,我只是在imageView和cell container之间设置了margin bottom(重置了AutoLayout中的约束),比如10.5,现在imageView没有附加到下一个细胞.