我做了两个实例UILabel并将它们添加到我ViewController的视图中。然后我将anchorPoint每个从 0.5 更改为 1.0(x 和 y)。
接下来,我将框架重置为uiLabel2我创建它的框架:(100,100,100,20)。
当我运行应用程序uiLabel1并uiLabel2显示在不同位置时。为什么?
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];



