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 ?

4 Years
Discussion Span
Last Post by hericles

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.