How to add View Controller with Tab Bar interfaced View Controller

Posted by TechFusion on Stack Overflow See other posts from Stack Overflow or by TechFusion
Published on 2010-03-31T19:36:10Z Indexed on 2010/04/01 4:43 UTC
Read the original article Hit count: 348

I have created Window based Tab Bar controller app, One Tab Bar of viewController has been interfaced with WebVIew ..I am looking to create another view once touch event happened in that WebView..

//TabBarViewController.m
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
   TabMainView *mainView = [[TabMainView alloc] init];
   mainView.hidesBottomBarWhenPushed = YES;

   [self.navigationController pushViewController: mainView animated:YES];
   [mainView release];
}

I have created MainView, which is UIViewController Subclass.

//TabMainView.m
- (void)loadView {

 CGRect frame = CGRectMake(0.0, 0.0, 480, 320);
 WebView = [[[UIWebView alloc] initWithFrame:frame] autorelease];
 WebView.backgroundColor = [UIColor whiteColor];
 WebView.scalesPageToFit = YES;
 WebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin);
 WebView.autoresizesSubviews = YES; 
 WebView.exclusiveTouch = YES;
 //self.WebView.UserInteractionEnabled = NO;
 WebView.clearsContextBeforeDrawing = YES;

 self.view = WebView;
        [WebView release]; 
}

- (void)viewWillAppear:(BOOL)animated {

 [self.WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]]];

}

Here when touch event happened then it is not passing control to TabMainView.m 's Viewload function although I am pushing it's view? TabBarView is also UIViewController subclass not a UINavigationController.

© Stack Overflow or respective owner

Related posts about uitabbarcontroller

Related posts about viewcontroller