voyager
voyager

Reputation: 3

Change UIView Position in TableView Cell

I have UIView in my tableview custom cell, when it appears i want to change the position of the the UIView based on certain condition.

i put this code in method cellForRowAtIndexPath:

CGRect newFrame = CGRectMake(11, 306, 302, 95);
        [cell.myView setFrame:newFrame];
        [cell setNeedsLayout];

I'm certain that the view already have the new position based on NSLog. But it still in the same position in my screen.
Is there any steps that I missed?

Upvotes: 0

Views: 231

Answers (1)

Saurav
Saurav

Reputation: 538

The frame you are assigning based on certain condition, needs to be assigned inside LayoutSubviews method of UITableViewCell Class.

Upvotes: 1

Related Questions