특정 조건에 대해 cellForRowAtIndexPath
에있는 셀 내의 view
의 x 위치 프레임을 변경하려고합니다. 다음 코드를 사용했습니다. 그러나 뷰의 x position
프레임은 변경되지 않습니다.cellForRowAtIndexPath에서 프레임이 변경되지 않습니다.
- (void)viewDidLoad {
[super viewDidLoad];
UINib *nib = [UINib nibWithNibName:@"GoalDetailsCustomCardCell" bundle:nil];
[goalDetailsTableView registerNib:nib forCellReuseIdentifier:@"CardCell"];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
GoalDetailsTableViewCell *cell = [goalDetailsTableView dequeueReusableCellWithIdentifier:@"CardCell"];
if(cell == nil)
{
cell = [goalDetailsTableView dequeueReusableCellWithIdentifier:@"CardCell"];
}
NSLog(@"%f", cell.cardDetails.frame.origin.x);
[UIView animateWithDuration: 0.5 animations:^{
cell.cardDetails.frame = CGRectOffset(cell.cardDetails.frame, -322.0, 0.0);
// CGRectOffset(cell.cardView.frame, -320.0, 0.0);
cell.actionCardReminder.frame = CGRectOffset(cell.actionCardReminder.frame, -322.0, 0.0);
}];
NSLog(@"%f", cell.cardDetails.frame.origin.x);
return cell;
}
예상대로 셀의보기가 이동하지만 음수가 아닌보기. 여전히 cardCheckReminder 뷰가 아닌 cardDetails 뷰를 보여줍니다.
참고 : NSLog는보기 프레임을 x 위치 변경으로 표시하지만보기는 -322.0 위치로 이동하지 않습니다.
autolayout을 사용하고 있습니까? 'cellForRowAtIndexPath'에 nib를 등록하지 마십시오. 'viewDidLoad'에 등록하십시오. –
cardDetails보기에서 xposition이 -322.0이므로 어떻게 작동하지 않는지 결정 했습니까? 화면의 너비가 화면의 너비보다 큰 경우 –
@ ChintaN-Maddy-Ramani : 내 질문을 업데이트했습니다. pls보세요. 제 질문을 이해하고 올바른 길을 가고 있다고 생각합니다. –