我在主视图中添加视图。如何找到最后插入的视图宽度?
NSArray *noPotions = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
int list = [noPotions count];
int lastPosition = 10;
int widthValue = 100;
for (int i = 0; i < list ; i++) {
UIView *newView = [[UIView alloc]initWithFrame:CGRectMake(lastPosition, 10, widthValue, 60)];
[newView.layer setBorderColor:[[UIColor blueColor] CGColor]];
[self.view addSubview:newView];
lastPosition = newView.bounds.size.width + 20;
newView.layer.borderWidth = 4;
[newView release];
在这段代码的最后一个位置总是得到 120。有人请帮帮我吗?