Edit Button in UITableViewController when in Popover - objective-c

I'm displaying a UITableViewController inside a popover. Everything works fine. Now I want that little "Edit" Button on the top right to reorder the cells. But unfortunately I can't achieve this.
I have implemented the 2 delegete methods for reordering, and in my tableviewcontroller I call this on viewdidloead
[self setEditing:YES];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
but for some reason I can't see the navigation bar on top that should display the edit button.
what am I doing wrong?
thx in advance

you can create your UITableViewController in the same way you did it now, embed it in an UINavigationController using – initWithRootViewController: and show the navigation controller in the popover

Related

Cannot have the father uiViewController with the back item?

I have seen this topic (iOS Storyboard Back Button) and more about this subject, but I still cannot have my back button appear on screen :
I have got 2 viewControllers, the two of them have a navigationController, the "father" controller has the button bar item set to "back" as a plain text, the second viewController appear well with a modal segue, or with "show detail (replace)" segue, but nothing appear on the navigation bar to come back... Would you know why?
Here is a capture :
Thanks
EDIT :
with a custom transition, and when presenting the controller via the navigator in the code, the back button is not here anymore... would someone know why?
When I comment out presentViewController:secondViewController, the back button is here, but the custom animation is not triggered anymore, there is the normal transition set in the storyboard.
Here is my method :
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSLog(#"segue descr %# : ", [[sender class] description] );
if ( [[segue identifier] isEqualToString:#"second"] ){
//SecondViewController *secondViewController = [[UIStoryboard storyboardWithName:#"Main" bundle:nil] instantiateViewControllerWithIdentifier:#"SecondViewController"];
SecondViewController *secondViewController = [segue destinationViewController];
secondViewController.transitioningDelegate = self;
[self.navigationController presentViewController:secondViewController
animated:YES
completion:nil];
Modal and show detail segues don't use a back button, because they are like independent views.
The idea is that those those views are only showing extra information or details about something and you can close them programmatically when you need to go back to the previous view.
A show or push segue will give you the back button in your navigation controller, because that segue is meant to be more like a sequence of views.
When you push a View Controller, you get the back button for "free" without having to write extra code. When you present a modal View Controller, you need to add your own way of dismissing the modal view. Since you have a Navigation Controller, your easiest route is probably to add a UIBarButtonItem to the navigation bar, and have that bar button call dismissViewControllerAnimated:completion: in your UIViewController subclass.

How to hide the NavigationBar when i use SWRevealViewController embed in UINavigationController?

When i use SWRevealViewController as initial view or not embedded in UINavigationController the result is as i expected:
but when the SWRevealViewController comes from UINavigationController tee result is:
How can i avoid the NavigationBar presented in the Rear view?
Please add the following code to the viewWillAppear: method of the viewcontroller whose navigation bar you need to hide.
[super viewWillAppear:YES];
[self.navigationController.navigationBar setHidden:YES];
[self.navigationController.navigationBar.backItem setHidesBackButton:YES];
Try, this code for rear view controller
- (void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBar.hidden = YES;
}
If you really need Navigation Controller on top of SWRevealViewController:
You got to hide navigation bar from navigation controller of your SWRevealViewController.
U can do this in IB (assuming you are using Storyboards):
Select Navigation Controller in your Storyboard
Open Attributes inspector
Find section "Navigation Controller", uncheck "Shows Navigation Bar"
Next, If you want navigation bard in front view controller, then attach it to separate Navigation Controller. You will have two Navigation Controllers, think on which one you want to push - it will have different effect.

UITabbar disappears when clicked on a button

I use UITabBar in my application. In one of my tabbars, i have a UITableView in a UIViewController whose root view controller is a Navigation Controller. When i click on a cell, i go to my custom edit mode which is a UIViewController.
In my edit mode I have a backButton that shows me UIViewController with the TableView.
My problem is when i click backButton, my TabBar disappears.
Do you have any ideas why my TabBar disappears?
Thanks.
In back button click, add the following code.
[self.navigationController popViewControllerAnimated:YES];

How to TabBarController display differents Items?

On my firstViewController I have a tabbar that contains my firstViewController and a helpViewController.
When I click on a button from the FirstViewController, I push a NewViewController. But, when this view is pushed, I want to change the content from the TabBarController to display other ViewControllers, like infoViewController, optionViewController and NewViewController. Is that possible?
The First Image represents my application. The FirstViewController has a button that will push the NewViewController. When the user clicks this button, I want that my app shows what is in the second image. Is possible?
Yes, this is possible (I just did a proof of concept in Xcode). Assuming that you are using storyboarding, you need to make your initial view controller a UINavigationController otherwise you won't be able to use the push segues. Then, make the first UITabBarViewController the root view controller of the navigation controller. Put an entirely new UITabBarController into the storyboard, and then put a UIButton into the firstViewController and link it via a push segue to the new (second) UITabBarController.
When you tap the button the old tab bar will slide off, and the new one will slide on.
Here's an example of how it all looks:
!!This app uses navigationController and TabBarController!!
Using the storyboard I saw each piece of the app, then I had the Idea: Insted of pushing the NewViewController, how about push a tabBarController? When the user clicks the button, the app will push the tabBarController with 2 TabController`s.
Just add New File to your project, sub classed UITabBarController. Then add this code to the init method of your tabBarController: self.hidesBottonBarWhenPushed = YES;
On ViewDidLoad just alloc and init what views you want to display on the tabBar and
self setViewControllers:[NSArray arrayWithObjects: vc1, vc2, vc3, nil]];
Working fine here :D
You can nest TabBarControllers. But that would look strange. And the first TabBar wouldn't be changed. Pushing a TabBarController into a TabBarController is not possible because TabBarController does not support pushViewController. Thats only possible with a NavigationController.
Anyhow you can change the content of the TabBar completely programatically.

keyboard not appearing when uitextfield is pressed

I have presented a navigation controller (Nav1) as modal view controller from rootViewController
Then from Nav1 i created another navigation controller (Nav2) and presented it as modal view controller.
In nav2 when i click a table cell it pushes a view controller containing UITextField
Now the problem is when I click on UITextField it does not show iphone keyboard
Actually I am trying to make something like alarm label as in iphone clock app.
Just be sure for you have set the delegate the textfield...
[textField setDelegate:self];
why did you choose two nav controllers?
you can use tabbarcontroller by the way there is much more simpler way to achieve this.Search on google
check if
"reloadData"
is not executing before the UITextField becomes active