I want to change the x position frame of view
inside the cell in cellForRowAtIndexPath
for certain conditions. I have used the following code. But it d
Do not change the Frame in cellForRowAtIndexPath
try Changing it in willDisplayingCell
Method
Because of the iOS layout render process, your custom UITableViewCell's layoutSubviews may called more than once. In your case you can change the items frames in the GoalDetailsTableViewCell class's layoutSubviews method.
@implementation GoalDetailsTableViewCell
-(void)layoutSubviews
{
[super layoutSubviews];
[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);
}
@end