Кадр не изменяется в cellForRowAtIndexPath
Я хочу изменить х позицию кадраview
внутри клетки вcellForRowAtIndexPath
для определенных условий. Я использовал следующий код. Но это не меняет видx position
Рамка.
- (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;
}
Вид в ячейке движется, как и ожидалось, но не в отрицательную сторону. Он по-прежнему показывает представление cardDetails, а не представление actionCardReminder.
Примечание: NSLog показывает рамку вида как положение изменения x, но вид не перемещается в положение -322.0.