I developed a 3d cube consist of 6 layer side by side to form a cube type structure. I am getting the layer info on click using touch event.

 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
  {
    if ([touches count] == 1) {
        for (UITouch *touch in touches) {
        CALayer *layer = [(CALayer *)self.layer.presentationLayer hitTest:point];            
        layer = layer.modelLayer;
        if([[layer valueForKey: @"isClicked"] isEqualToString:@"btnClicked"])
        {
            if([[layer valueForKey: @"diceFace"] isEqualToString:@"face1"])
            {
                // i want to open new view.....
            }
        }
}

What i want is to open a new view controller on clicking any side of the cube in a layer. How can i do this ?

Once your click is being recognised all you need to do is create the new view in code.

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x,y,w,h)];

[parentView addSubview: view];

Thats the standard way of creating a view and adding it so maybe there is somethng about your particular situation I'm missing. Anyway, if that doesn't work we'll try something else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.