I have a UITableView which contains x amount of cells. However, I want to have 20 px distance between each cell. My tableview only contains one section.
I have googled around and searched the forum, but I couldn't find anything that works for my purpose.
Is it possible to set content offset to the cell, or the imageview inside the cell?
Can someone please help me?
one alternate solution of this problem is just implement the method tableview:heightForFooterInSection like
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 5;
}
And then implement the tableView:ViewForFooterInSection like below //Returns a transparent footer actually.
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *view = [[UIView alloc]init];
[view setAlpha:0.0F];
return view;
}
Based on the follow-up in comments above, it sounds like you should use the UITableView backgroundView property to set your custom background image, then use a grouped table view with one cell per section. To me, this sounds like the quickest and easiest way to implement the type of UI you're describing.
Relevant portions of UITableView API documentation:
@property(nonatomic, readwrite, retain) UIView *backgroundView
...
- (NSInteger)numberOfRowsInSection:(NSInteger)section
And UITableViewDataSource protocol:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With