- (Unit*) init
{
if (self = [super init])
{
location = CGPointMake(100.0, 100.0);
self.text = @"Test Text";
self.backgroundColor = [UIColor redColor];
self.font = [UIFont fontWithName:@"Georgia" size:40.0];
self.bounds = CGRectMake(0,
0,
[self.text sizeWithFont:self.font].width,
[self.text sizeWithFont:self.font].height);
}
It works good for the sizing, but if I change the values for the first two parameters in CGRectMake, the UILabel doesn’t move to that position. What am I doing wrong?
Also, is there a way I could move the UILabel‘s (X,Y) a way in which I don’t have to make a new CGRectMake() every time?
You should use the CGRectMake on
self.frame, notboundsif I remember correctly.