0

Hi i want to add a line in my UITableView just like the reminder apps red line. I tried adding it to my custom cell but then it only display in the cell which are used and not in all cell. I want a red image like below

enter image description here

Thanks in advance

2 Answers 2

1

You could use a UIView that has the size of the red stripe and place it over your UITableView where you want the red line to appear. Set it's backgroundColor to the color of the red line and make sure that userInteractionEnabled is set to NO to avoid interfering with the scolling of the UITableView.

0
0

Try To add UIView on tableView and set it`s Background Color with pattern Image whatever you want,then add such view on tableview. like below.

 lineView = [[UIView alloc] initWithFrame:CGRectMake(100, 0, 1,
 tblView.frame.size.height)];
 [lineView setBackgroundColor:[UIColor blackColor]]; //Change as per your req.
 lineView.userInteractionEnabled = NO;
 [tblView addSubview:lineView];

But you face problem with this when you scroll up then at vertical bounce you have to manage height of this UIView. So you can implement this by ScrollViewDidScroll Delegate method, This method call cause UITableView is extends from UIScrollView.

-(void)scrollViewDidScroll:(UIScrollView *)scrollView 
{
    lineView.frame = CGRectMake(100, 0, 1,    tblView.frame.size.height+scrollView.contentOffset.y); 
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.