[_gooleImageView setContentScaleFactor:[[UIScreen mainScreen] scale]];
_gooleImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_gooleImageView.contentMode = UIViewContentModeScaleAspectFill;
_gooleImageView.clipsToBounds = YES;
for (int i =0; i<3; i++)
{
for (int j =0; j<10; j++)
{
if (i==2&&j>=2)
{
break;
}
UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn.backgroundColor = [UIColorclearColor];
[btn setBackgroundImage:[UIImageimageNamed:@"BetGrayBall"]forState:UIControlStateNormal];
[btn setTitleColor:[UIColorblackColor] forState:UIControlStateNormal];
btn.frame =CGRectMake(j*30,40+i*30, 30, 30);
[btn addTarget:selfaction:@selector(zlfushiAction:)forControlEvents:UIControlEventTouchUpInside];
[btn setTitle:[NSStringstringWithFormat:@"%d",(3+j)+i*10]forState:UIControlStateNormal];
btn.userInteractionEnabled =YES;
btn.tag = 1000+i*10+j;
[zlhezhiVaddSubview:btn];
NSLog(@"我的计算 %D * %D",i*10,j);
}
}
for (int i =0; i<2; i++) {
for (int j =0; j<5; j++) {
if (i == 2&&j ==5) {
break;
}
UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn.backgroundColor = [UIColorclearColor];
[btn setBackgroundImage:[UIImageimageNamed:@"BetGrayBall"]forState:UIControlStateNormal];
btn.tag =1000+i*5+j;
btn.frame =CGRectMake(55+j*46,90+i*41,35, 39);//55+(35+11)*j, 9+(39+2)*i, 35, 39
[btn addTarget:selfaction:@selector(sanGrounDoAction:)forControlEvents:UIControlEventTouchUpInside];
btn.userInteractionEnabled =YES;
[self.viewaddSubview:btn];
NSLog(@"bt.san.width %f",btn.frame.origin.x);
UILabel *upOneLabel = [[UILabelalloc]init ];//]WithFrame:CGRectMake(i, 3, 20, 20)];
upOneLabel.frame = btn.bounds;
upOneLabel.text = [NSStringstringWithFormat:@"%d",i*5+j];
upOneLabel.backgroundColor = [UIColorclearColor];
upOneLabel.textColor = [UIColorcolorWithRed:160.0/255.0green:14.0/255.0blue:54.0/255.0alpha:1];
upOneLabel.font = [UIFontsystemFontOfSize:18];
[upOneLabel setTextAlignment:NSTextAlignmentCenter];
[btnaddSubview:upOneLabel];
}
}
for (NSInteger i =0; i<2; i++) {
for (NSInteger j =0; j<5; j++) {
_redBallImage = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"BetGrayBall"]];
_redBallImage.tag = j+i*5+100;
_redBallImage.frame =CGRectMake(55+(35+11)*j,9+(39+2)*i,35, 39);
_redBallImage.userInteractionEnabled =YES;
[self.contentViewaddSubview:_redBallImage];
[_redBallImagerelease];
UILabel *_lableNumber = [[UILabelalloc] initWithFrame:_redBallImage.bounds];
_lableNumber.userInteractionEnabled =YES;
_lableNumber.tag = (j+i*5)+110;
_lableNumber.backgroundColor = [UIColorclearColor];
_lableNumber.text = [NSStringstringWithFormat:@"%d",j+i*5];
_lableNumber.textColor = [UIColorcolorWithRed:160.0/255.0green:14.0/255.0blue:54.0/255.0alpha:1];
_lableNumber.textAlignment =NSTextAlignmentCenter;
_lableNumber.font = [UIFontsystemFontOfSize:20];
[_redBallImageaddSubview:_lableNumber];
[_lableNumberrelease];
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//[self.delegate tableViewScrll:YES];
UITouch *touch = [touches anyObject];
//点击后取得在 cell上的坐标点
CGPoint locationCel = [touch locationInView:self.contentView];
//点击后取得在window上的坐标点
CGPoint locationWin = [touch locationInView:[UIApplication sharedApplication].delegate.window];
NSLog(@"x1:%f,y1:%f",locationCel.x,locationCel.y);
NSLog(@"x2:%f,y2:%f",locationWin.x,locationWin.y);
}- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
//点击后取得在 cell上的坐标点
CGPoint locationCel = [touch locationInView:self.contentView];
//点击后取得在window上的坐标点
CGPoint locationWin = [touchlocationInView:[UIApplicationsharedApplication].delegate.window];
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:self.contentView];
}