Unable to display view when I call it from a separate ViewController in iOS
I have a view controller in my application where on my screen I have a
UIView that the user is required to tap on. When they do that, I want to
call another viewController's view, and display it on the screen for the
user. Unfortunately, I am having trouble displaying the view.
The name of my viewController that I am making the call from is called
"MainViewController", and the ViewController whose view I wish to display
is called, "NextViewController"
Here is my code from where I make the call:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"I was touched.");
_nextView = [[NextViewController alloc] init]; //this code is not
being called
[self.view addSubview:_nextView.view]; //neither is this being
called
}
Where _nextView is a property that I declare in the .h file of
MainViewController.
This method is being called, but for some reason because I am able to see
the log statements print to the output, but for some reason I am unable to
call the lines after that. Can anyone see what I'm doing wrong?
Thanks in advance to all who reply.
No comments:
Post a Comment