특정 셀에 대한 제스처가있는 테이블 뷰가 있습니다. 테이블 뷰가로드 된 후, 네 번째 행으로 스크롤하여 왼쪽으로 스 와이프하면 일부 내용이 표시되어 작동합니다. 하지만 그 후 첫 번째 행으로 돌아가서 네 번째 줄에 동일한 내용을 보여줍니다.uitableview 셀은 네 번째 행의 내용을 변경할 때 첫 번째 행의 내용을 변경합니다.
이 코드를 ios8과 함께 실행하면 작동합니다. 문제는 ios7에서 실행할 때만 발생합니다.
내 코드는 다음과 같이 사전에
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
SampleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil)
{
cell = [[SampleViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
NSMutableDictionary *cellData = [self.databaseCall transactionFromDatabase:indexPath.row Id:self.Id andStageId:self.stageId];
[self setSelectedSegmentColor:cell.repeat];
cell.Description.text = self.Name;
cell.actionDescription.text = self.Name;
cell.tipsDescription.text = [cellData objectForKey:@"tipsDescription"];
UIImage *cellImage = [UIImage imageNamed:[cellData objectForKey:@"categoryImage"]];
NSLog(@"%@", [cellData objectForKey:@"cardType"]);
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[cellData objectForKey:@"actionLink"]];
if([[cellData objectForKey:@"cardType"] isEqualToString:@"2"])
{
UISwipeGestureRecognizer *swipeLeftGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftMethod:)];
swipeLeftGesture.direction = UISwipeGestureRecognizerDirectionLeft;
[cell.cardDetails addGestureRecognizer:swipeLeftGesture];
[cell.tryThisButton addTarget:self action:@selector(tryThisButtonPressed:) forControlEvents:UIControlEventTouchDown];
UISwipeGestureRecognizer *swipeRightGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightMethod:)];
swipeRightGesture.direction = UISwipeGestureRecognizerDirectionRight;
[cell.actionCardReminder addGestureRecognizer:swipeRightGesture];
[cell.previousButton addTarget:self action:@selector(previousButtonPressed:) forControlEvents:UIControlEventTouchDown];
}
else
{
for(UIGestureRecognizer *recognizer in cell.cardDetails.gestureRecognizers)
{
[cell.cardDetails removeGestureRecognizer:recognizer];
}
for(UIGestureRecognizer *recognizer in cell.actionCardReminder.gestureRecognizers)
{
[cell.actionCardReminder removeGestureRecognizer:recognizer];
}
cell.cardDetails.layer.shadowColor = [UIColor blackColor].CGColor;
cell.cardDetails.layer.shadowOffset = CGSizeMake(0, 2);
cell.cardDetails.layer.shadowOpacity = 0.5;
}
cell.weburl.attributedText = str;
cell.Name.text = self.Name;
cell.Image.image = cellImage;
NSLog(@"%d", indexPath.row);
// Configure the cell...
return cell;
}
감사합니다.
어떤 특정 콘텐츠가 변경됩니까? –
@LyndseyScott - 네 번째 행을 왼쪽으로 스 와이프하고 첫 번째 행을 왼쪽으로 스 와이프합니다. –