Hi Guys,
newbie in ipad apps here n stucked on a very strange condition.
I have one view based application. In view of Viewcontroller I have added two buttons to draw to shapes. One is cube and one is piramid. Shapes are drawn with openGL code. Both shapes have different view classes.
Now on clicking on the buttons of cube and pyramid respectively, shapes should be drawn into the view of viewController. I am successfully drawing cube shape but cannot draw pyramid shape..!!!
after trying different methods i came to conclusion that "self.view addSubView:tempView" is the problem. This code works fine with cube button , but not with pyramid. Cant fine the exact problem.
here is sample of code
buttons :
cubeButton = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(600, -5, 50, 50)];
[cubeButton addTarget:self action:@selector(cubeClicked:) forControlEvents:UIControlEventTouchUpInside];
[cubeButton setBackgroundImage:[UIImage imageNamed:@"square_3D.png"] forState:UIControlStateNormal];
pyramidButton = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(700, -5, 50, 50)];
[pyramidButton addTarget:self action:@selector(piramidClicked:) forControlEvents:UIControlEventTouchUpInside];
[pyramidButton setBackgroundImage:[UIImage imageNamed:@"triangle_3D.png"] forState:UIControlStateNormal];
methods sample code:
-(IBAction) cubeClicked:(id)sender {
UIView *cubeView = [[CubeView alloc] initWithFrame:CGRectMake(250, 60, 500, 600)];
[self.view addSubview:cubeView];
}
-(IBAction) piramidClicked:(id)sender {
UIView *pyramidView = [[pyramidView alloc] initWithFrame:CGRectMake(250, 60, 500, 600)];
[self.view pyramidView];
}
Thanks in advance. I appreciate your help guys.