Hi all
I am creating an application which uses gyroscope on a 3D model. Currently I am able to display my 3D model and using the gyroscope. But I want to enable user when on click certain function of the model, it will link to a new UIViewController. My 3D model and gyroscope is in a UIView mode called EAGL View. Is it possible for me to link the EAGL View to UIViewController?
Here are the codes that i had done, in EAGL View but it doesn't work.
I am creating an application which uses gyroscope on a 3D model. Currently I am able to display my 3D model and using the gyroscope. But I want to enable user when on click certain function of the model, it will link to a new UIViewController. My 3D model and gyroscope is in a UIView mode called EAGL View. Is it possible for me to link the EAGL View to UIViewController?
Here are the codes that i had done, in EAGL View but it doesn't work.
Code:
- (void)scrollViewDoubleTapped:(UITapGestureRecognizer*)recognizer {
CGPoint pointInView = [recognizer locationInView:self];
NSLog(@"%f , %f",pointInView.x,pointInView.y);
// get the coordinates
if ((pointInView.x >= (231.0) && pointInView.x <=(293) && pointInView.y >= (162) && pointInView.y <=(218)) )
{
// is this how we push to next viewcontroller here?
UIView *a = [recognizer view];
UIViewController *viewController = [self getViewControllerFromView:a];
TestViewViewController *newViewController = [[ TestViewViewController alloc]initWithNibName:nil bundle:nil];
[viewController.navigationController pushViewController:newViewController animated:YES];
[self viewController];
}
}
-(UIViewController*)getViewControllerFromView:(UIView*) a
{
if([[a nextResponder] isKindOfClass:[UIViewController class]])
{
return (UIViewController*)[a nextResponder];
}
else {
for (UIView *next = [a superview]; next; next = next.superview)
{
UIResponder *nextResponder = [next nextResponder];
if([nextResponder isKindOfClass:[UIViewController class]])
{
return (UIViewController*)nextResponder;
}
}
}
return nil;
}
Last edited by a moderator: