McDonal_11
McDonal_11

Reputation: 4075

Objective-C : Issue faced while editing multiple row simultaneously in table view

I am doing chat application. Some what I did with all major functionalities. Now I am having doubt on multiple selection row and edit it. I am having issue on following two things:

1. If I tried to edit my chat table view, cells are moving towards right. My chat messages are hiding partially.

2. If I select that round button, some color appearing on my cell. That color hiding my view color. I dont know how to clear that color.

Kindly guide me for this following two things.

My Output:

enter image description here

My Code:

- (IBAction)cellLongPress:(UILongPressGestureRecognizer *)sender 
{

    [_tableView setEditing:YES animated:YES];
}

In WhatsApp, one side cell is moving towards right, and another remains constant. How to do that?

How to clear that deletion dim color?

Kindly guide me.

Upvotes: 1

Views: 96

Answers (1)

McDonal_11
McDonal_11

Reputation: 4075

Answer

1. Which cell we dont want to indent, add below code on our tableviewcell subclass

- (void)layoutSubviews
{
    [super layoutSubviews];

    float indentPoints = self.indentationLevel * self.indentationWidth;

    self.contentView.frame = CGRectMake(indentPoints,
                                        self.contentView.frame.origin.y,
                                        self.contentView.frame.size.width - indentPoints,
                                        self.contentView.frame.size.height);
} 

2.Color hiding my view color

In Cell for Row Index Path

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UIView *bgColorView = [[UIView alloc] init];
        bgColorView.backgroundColor = [UIColor whiteColor];
        [_myChatCell setSelectedBackgroundView:bgColorView];
return _myChatCell;
    }

Set Selected

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    if(selected) {
_message.backgroundColor = [UIColor colorWithRed:230.0/255.0 green:230.0/255.0 blue:230.0/255.0 alpha:1.0];
} else {
_message.backgroundColor = [UIColor colorWithRed:230.0/255.0 green:230.0/255.0 blue:230.0/255.0 alpha:1.0];
}
}

Upvotes: 1

Related Questions