To create the UIView and UIImageView programmatically, you can use the following code:
To Create UIView:
UIView *bgView = [[UIView alloc] init];
bgView.frame = CGRectMake(0, 0, 480, 320);
bgView.backgroundColor = [UIColor blueColor];
[[[CCDirector sharedDirector]openGLView] addSubview:bgView];
To create UIImageView:
UIImageView *bgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)];
bgImg.image = [UIImage imageNamed:@"certificate.png"];
bgImg.center = CGPointMake(240, 160);
[bgView addSubview:bgImg];
For removing UIViews:
[bgView removeFromSuperview];
[bgView release];
[bgImg removeFromSuperview];
[bgImg release];
No comments:
Post a Comment