How to add navigation bar in uitableview - uitableview

App based on Navigation base application.How to add Navigation bar in UItableview controller. Symptoms as a tableview controller(xib). I need to add in Navigation bar to symptoms.

you dont add a navigationController to a tableViewController. its the other way around.
First add anavigationController and set its rootViewController as the tableViewControler.

U can add it as you add the sub view to super view
-loadview:
navBar2=[[UINavigationBar alloc]init];
[navBar2 sizeToFit];
[self.view addSubview:navBar2];
//add button on the bar.
[navBar2 addSubview:button];

maybe u can change in the xib, add a UIView below the TableView and then add the navigation bar as a subview of UIView

Related

iOS:How to add a view on searchBar in UISearchDisplayController and I want the view on top of _UISearchDisplayControllerDimmingView

How to add a view on searchBar in UISearchDisplayController and I want the view on top of _UISearchDisplayControllerDimmingView?
I add the view by [self.searchDisplayController.searchBar insertSubview:view3 atIndex:0];. But it was under _UISearchDisplayControllerDimmingView.
I show U the pic:
If someway to dismiss the _UISearchDisplayControllerDimmingView will help me also!
If you really want it on the top of dimView put your view on the window of Application.
UIView *view = [[[UIApplication sharedApplication]windows]objectAtIndex:0];
and add your view as subview.

Show View on the top of navigation bar

I have a custom navigation and Home view in my app. On the click of button I want to show a View just like a left side view ( width is not equal to screen width) , on the top of navigation.
I have tried this:
LeftView.Layer.ZPosition = 1;
It is not working. If I set the Z index of navigation to -1, this hides complete navigation bar.
Try this :
[self.navigationController.view addSubview:yourSubView];
Try to add that view to UIWindow. This will add your view above navigation bar.
[[[[UIApplication sharedApplication] delegate] window] addSubview:yourView];
Add your custom navigation bar to the main view manually instead of using navigation controller's standard navigation bar. Then add your leftview as subview, in your main view. It will overlap navigation bar in this hierarchy.
This is a correct answer:
[self.navigationController.view addSubview:yourSubView];
Though it will not set the correct frame for the view, To set the correct frame for your view on the navigation bar, you have to set it in the viewDidAppear.
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.navigationController.view addSubview:mTitleView];
}

UIButton above UITableView

I have a tableView in a UIViewController. My tableView is NOT an IBOutlet.
The UIViewController has a navigation bar due to being pushed from another view.
I want to add a UIButton above the tableview, but buttons/views do not appear above the tableview even if I add them in storyboard or use the "bringSubviewToFront" method.
I noticed that buttons/vews do appear behind the navigation bar when translucent, but that of course is not where I want them.
None of these codes have worked:
[self.view addSubview:btnSend];// add Send btn
[self.view bringSubviewToFront:btnSend];// bring Send btn to Front
[self.navigationController.view addSubview:btnSend];
[self.navigationController.view bringSubviewToFront:btnSend];
Thanks in advance.
you will need to set the edgesForExtendedLayout so that the top is not included
self.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight;

How to remove UINavigationBar label.text from second UIView Controller which is coming in first View controller?

I have one label which I am showing on UINavigationBar using addSubView Property and I am getting like:
But when I am going to secondView Controller, it is looking like:
It appears on Back Button of Second Controller. So how to remove "Status" Label from second UI.
Thank You.
Don't add subviews to the navigation bar. It's not made for that.
I recommend you to read the iOS human interface guidelines and to use a UIBarButtonItem to properly add controls to the navigation bar.
In first View controller -
-(void)viewWillAppear:(BOOL)animated
{
//Add Label on UINavigationBar
[super viewWillAppear:animated];
[self.navigationController.navigationBar addSubview:navLabel];
}
-(void)viewWillDisappear:(BOOL)animated
{
// Remove label from UINavigationBar
[super viewWillDisappear:animated];
[navLabel removeFromSuperview];
}
You should tag your subview and search for it among subviews of navigation bar in your second view controller and then [subview removeFromSuperview].
You shouldn't add subviews to your navigation bar, you can use navigation items to achieve that kind of stuff. You can init a UIBarButtonItem with initWithCustomView: which has that label in it.

UITabBarController and custom control acting as a tabbar

I have a custom tab bar controller subclass and instead of a tab bar, I use a custom UIView.
The problem is that I cannot get my view controllers to appear. I see a white screen and the "tab" if I call
[super setViewControllers:]
I get really odd artefacts as far as appearance goes.
So instead I tried setting the selectedViewController directly. I've kind of drawn a blank. Any help would be greatly appreciated.
Can you tell me how you are having a custom view for tabs..
Have u removed tabBar & added ur custom tabView.? and keep in mind if remove your tabBar the whole tabBarController will be removed..
So you need to just hide the tabBar from tabBarController and add ur custom UIView in place of tabBar and everything works fine. You have to select the tab index programatically as per the button selection in your custom view.
You can use view Controller containment concept in order to implement custom tabbar.
[self addChildViewController:content]; // 1
content.view.frame = [self frameForContentController]; // 2
[self.view addSubview:self.currentClientView];
[content didMoveToParentViewController:self]; // 3
You can also use my custom control
Custom Tabbar Control

Resources