Game Development Reference
In-Depth Information
float sixtyPercent = size.width * .6;
float twentyPercent = size.width * .2;
float twentFivePercent = size.height/4;
float thirtyThreePercent = size.height/3;
rockButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[rockButton setFrame:CGRectMake(twentyPercent, twentFivePercent, sixtyPercent, 40)];
[rockButton setTitle:@"Rock" forState:UIControlStateNormal];
[rockButton addTarget:self action:@selector(userSelected:)
forControlEvents:UIControlEventTouchUpInside];
paperButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[paperButton setFrame:CGRectMake(twentyPercent, twentFivePercent*2, sixtyPercent, 40)];
[paperButton setTitle:@"Paper" forState:UIControlStateNormal];
[paperButton addTarget:self action:@selector(userSelected:)
scissersButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[scissersButton setFrame:CGRectMake(twentyPercent, twentFivePercent*3, sixtyPercent, 40)];
[scissersButton setTitle:@"Scissers" forState:UIControlStateNormal];
[scissersButton addTarget:self action:@selector(userSelected:)
[buttonView addSubview:rockButton];
[buttonView addSubview:paperButton];
[buttonView addSubview:scissersButton];
resultView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
[resultView setBackgroundColor:[UIColor lightGrayColor]];
resultLabel = [[UILabel new] initWithFrame:CGRectMake(twentyPercent, thirtyThreePercent,
sixtyPercent, 40)];
[resultLabel setAdjustsFontSizeToFitWidth:YES];
[resultView addSubview:resultLabel];
continueButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[continueButton setFrame:CGRectMake(twentyPercent, thirtyThreePercent*2, sixtyPercent, 40)];
[continueButton setTitle:@"Continue" forState:UIControlStateNormal];
[continueButton addTarget:self action:@selector(continueGame:)
forControlEvents:UIControlEventTouchUpInside];
[resultView addSubview:continueButton];
}
}
Search WWH ::




Custom Search