I have a tableviewcontroller and on the respective rowclick of the tableviewcontroller i want to show the details of that respective rows detail content.
The row details view will have a fixed content as follows:
- Header
- Title below header
- Image related to title
- Here I want to show the respective views of the uitabbarcontroller tab button
In the above points the content from point 1-3 will cover half of page of viewcontroller which will be fixed & bottom half of the viewcontroller will have the 4th point i.e. views of the respective tabbarbuttons which will change according to the views created for respective tabs.
I am not able to find any solution for keeping the top half of the view fixed. And how to keep the views of the tabbar restricted to the bottom half of the screen.
I am doing this application without using storyboard .
Searched a lot but didn't got any solution.
Please provide some example code or tutorial if any.
Following is the image of what i exactly want as i have created same in android.
sorry need to blurr contents of image.
In the above image following are the things i want fixed:
- the blue bar at top is header which will stay fixed.
- the brownbar below the header and the whitish image below the header are also fixed.
- The four buttons below the image are the tabbar buttons which in IOS will appear at bottom of the screen.
- below the tabbar button is the view containing the content of the 1st tabbar button.
My question is i want the first 2 of above points be fixed and the viewcontroller containing the views for respective tabbarbuttons should be seen on the rest half of the screen with the 4 tabbar buttons.
So if i click on any of the tab buttons only its view which is occupied by bottom half of the screen will change & the top half will remain static(fixed).
Hope my explaination make clear some doubts about the question.
----EDITED SOLUTION based on what @Simon McLoughlin suggested, following is the code:
I have implemented a function in which i have written code for implementing my scenario.
-(void)loadShowDetailsTabBarController
{
ConceptViewController *conceptViewController;
CastViewController *castViewController;
ShowDetailsFeedbackViewController *showDetailsFeedbackViewController;
PromosViewController *promoViewController;
UIImage *conceptBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
UIImage *conceptBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];
UIImage *castBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
UIImage *castBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];
UIImage *feedbackBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
UIImage *feedbackBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];
UIImage *promoBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
UIImage *promoBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];
conceptBtn = [conceptBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
conceptBtnSelected = [conceptBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
castBtn = [castBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
castBtnSelected = [castBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
feedbackBtn = [feedbackBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
feedbackBtnSelected = [feedbackBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
promoBtn = [promoBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
promoBtnSelected = [promoBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
conceptViewController = [[ConceptViewController alloc] initWithNibName:@"ConceptViewController_iPad" bundle:nil];
castViewController = [[CastViewController alloc] initWithNibName:@"CastViewController_iPad" bundle:nil];
showDetailsFeedbackViewController = [[ShowDetailsFeedbackViewController alloc] initWithNibName:@"ShowDetailsFeedbackViewController_iPad" bundle:nil];
promoViewController = [[PromosViewController alloc] initWithNibName:@"PromosViewController_iPad" bundle:nil];
}
else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
conceptViewController = [[ConceptViewController alloc] initWithNibName:@"ConceptViewController" bundle:nil];
castViewController = [[CastViewController alloc] initWithNibName:@"CastViewController" bundle:nil];
showDetailsFeedbackViewController = [[ShowDetailsFeedbackViewController alloc] initWithNibName:@"ShowDetailsFeedbackViewController" bundle:nil];
promoViewController = [[PromosViewController alloc] initWithNibName:@"PromosViewController" bundle:nil];
}
conceptViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"CONCEPT" image:conceptBtn selectedImage:conceptBtn];
castViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"CAST" image:castBtn selectedImage:castBtnSelected];
showDetailsFeedbackViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"FEEDBACK" image:feedbackBtn selectedImage:feedbackBtnSelected];
promoViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"PROMO" image:promoBtn selectedImage:promoBtnSelected];/**/
UITabBarController *showDetailstabVC = [[UITabBarController alloc] init];
showDetailstabVC.viewControllers = [NSArray arrayWithObjects:conceptViewController,castViewController,showDetailsFeedbackViewController,promoViewController, nil];
showDetailstabVC.view.frame = CGRectMake(0, 250, screenSize.width, screenSize.height-250);
self.view.window.rootViewController = showDetailstabVC;
[self.view addSubview:showDetailstabVC.view];
}
Please let me know if my code is correct?
I am able to view what i wanted.
But now the problem is when i click on the tabbar buttons i get the following error:
exc_bad_access (code=exc_i386_gpflt)
The error is not given in debug screen, The app stops at the following line in main.m :
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));