First I want to say you that I’m totally new in Xcode so I’m a Newbie.
Then I also want to say you that I’m not able to speak English perfect…I’m learning it.
So, my problem is that I get the following error:
No visible @interface for ‘UIWebView’ declares the selector ‘initWithNibName:bundle:’
I don’t know why, I’ve already searched in many other forums (and this, too) for this, but the solutions there didn’t help me.
I want to create a Table View that loads an UIWebView if I push a row.
That’s my Code:
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.mehrWebView == nil)
{
UIWebView *temp = [[UIWebView alloc] initWithNibName:@"MyWebView" bundle:[NSBundle mainBundle]];
self.mehrWebView = temp;
}
[self.navigationController pushViewController:mehrWebView animated:YES];
}
I’m frustrated, I don’t know how to continue.
I hope you can help me with my problem.
Thanks & Best Regards
The
initWithNibName:bundle:method is an initializer ofUIViewControllerclasses, notUIViewclasses. On the other hand,UIWebViewis aUIViewclass, so Xcode correctly tells you thatUIWebViewlacks theinitWithNibName:bundle:method.Moreover, you cannot push views onto the navigation controller’s stack. You need to replace
UIWebViewwith the type of the controller of the@"MyWebView"nib to make it work.