我用 Nib 创建了一个视图。我想添加这个子视图的多个实例,但只显示我添加的最后一个。
NSArray * nibArray = [[NSBundle mainBundle] loadNibNamed:@"SBFiveBarCountView"
owner:self
options:nil];
SBFiveBarCountView * fiveBarCount1 = (SBFiveBarCountView *)[nibArray objectAtIndex:0];
fiveBarCount1.frame = CGRectMake(22, 15, 16, 57);
SBFiveBarCountView * fiveBarCount2 = (SBFiveBarCountView *)[nibArray objectAtIndex:0];
fiveBarCount2.frame = CGRectMake(45, 15, 16, 57);
[self.view addSubview:fiveBarCount1];
[self.view addSubview:fiveBarCount2];
在我这样做之后,只有fiveBarCount2
实际添加到视图中
我究竟做错了什么?
谢谢