First I would create a UIView subclass called PointsView or something.
This will look like this...
Points of [name label]:
+ + + +
1 2 3 P
- - -
It will have properties like NSString *teamName
and set those properties up against the relevant labels.
It may also have properties for NSUInteger score
so you can set the score value of the PointView object.
This is all completely separate from your UIViewController.
Now, in your UIViewController subclass you can do something like...
PointsView *view1 = [[PointsView alloc] initWithFrame:view1Frame];
view1.teamName = @"Team 1";
view1.score1 = 1;
view1.score2 = 2;
view1.score3 = 3;
[self.view addSubView:view1];
PointsView *view2 = [[PointsView alloc] initWithFrame:view2Frame];
view2.teamName = @"Team 2";
view2.score1 = 1;
view2.score2 = 2;
view2.score3 = 3;
[self.view addSubView:view2];
Now there is not copying involved. You just create two instances of an object.
EDIT
Creating your view subclass...
The easiest way to create your view subclass is to do the following...
Create the files... PointsView.m and PointsView.h
The .h file will look something like this...
#import <UIKit/UIKit.h>
@interface PointsView : UIView
@property (nonatomic, strong) UILabel *teamNameLabel;
// other properties go here...
@end
The .m will look like this...
#import "PointsView.h"
@implementation PointsView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.teamNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 21)];
self.teamNameLabel.backgroundColor = [UIColor clearColor];
[self addSubView:self.teamNameLabel];
// set up other UI elements here...
}
return self;
}
@end
Then in your view controller you add the PointsView to it IN CODE (i.e. not with Interface builder) like this...
- (void)viewDidLoad
{
[super viewDidLoad];
PointsView *pointsView1 = [[PointsView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
pointsView1.teamNameLabel.text = @"Team 1";
[self.view addSubView:pointsView1];
// add the second one here...
}
You can also create and add these views in Interface Builder but it's a lot harder to explain on here.
If you set it up this way then you can use IB for setting up the rest of your UIViewController. Just don't use IB to set up the PointsViews. It won't work with the way I've shown here.