mercredi 24 juin 2015

When adding subview, the view is in the wrong position

I have a custom class that is a subclass of UITextField. In layoutSubviews, I want to add a UIView at the same position of self.frame. The textField I'm adding this custom class to, is in a cell in a UITableViewController. I did the following:

CGRect rect = self.frame;
UIView *myView = [[UIView alloc] initWithFrame:rect];
[self addSubview:myView];

When I run the app, myView is not at the same position as the textField. What am I doing wrong, and how can I make myView to be at the same position as the textField?

See more ..

Aucun commentaire:

Enregistrer un commentaire