KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I made two instances of UILabel and added them to my ViewController 's view. And then I changed the anchorPoint of each from 0.5 to 1.0 (x and y). Next, I reset the frame of uiLabel2 to its frame I created it with: (100,100,100,20). When I run the app, uiLabel1 and uiLabel2 show at different positions. Why? UILabel *uiLabel1 = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 20)] autorelease]; uiLabel1.text = @"UILabel1"; uiLabel1.layer.anchorPoint = CGPointMake(1, 1); UILabel *uiLabel2 = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 20)] autorelease]; uiLabel2.text = @"UILabel2"; uiLabel2.layer.anchorPoint = CGPointMake(1, 1); uiLabel2.frame = CGRectMake(100, 100, 100, 20); [self.view addSubview:uiLabel1]; [self.view addSubview:uiLabel2];
Tags (comma-separated)
Save Edits
Cancel