Switch back from view to tab bar view - xcode4

I am trying to learn how to work with Xcode 4.5.
I have created a tab bar and would like to switch from one of the tab bar views (profile) to another view (settings -not within the tab bar menu), and back. I use below code to go to the:
- (IBAction)goToProfile:(id)sender {
ProfileViewController * profile = [[ProfileViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:profile animated:YES completion:nil];
It works fine to go to settings, but when I go back from settings view to Profile, the tab bar menu is gone. How can i go back to profile view and see the tab bar again?

I had the same problem. You can either fix it with some code or you can just make some changes in your storyboard.
If you Put a Navigation Controller between your Tab Bar Controller and the View of your selected Tab (Profile in your case). If you use a push segue to go to the next View it will take the Tabbar to the next view and also a "Back" Button. (Settings in your case)
Here's an example of my App my jubla3ForthViewController would be your ProfileViewController and one of my jubla3PDFOnlineViewControllers would be your SettingsViewController.
http://www.abload.de/image.php?img=bildschirmfoto2013-01x2kti.png
(im not allowed to post direct images because of my low reputation points)
I hope this was usefull. If it was don't forget to push the up Arrow.

Related

SlideOutMenu remove Navigation Bar

I use SWRevealViewController for my project. Currently, the problem is that when the project starts, Navigation bar show with title of "MyApp". But, navigation bar disappears when I click on Home
If I add a Navigation Bar in view controller, there will be 2 navigation bars at first run. One navigation will automatically disappear when I click on Home link.
How to do to get the first image appearance when I click on Home link? I'm using Swift 3.
You could try set the navigation bar to not hidden in the viewWillAppear.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: false)
// ...
}
However I presume the reason the navigation bar is hidden is because the controller is being presented modally and not being pushed onto the main navigation controller. If this is the case, then you will need to probably do something with the SWRevealViewController and push the controller onto the main navigation controller.
Check out the Basic API usage for SWRevealViewController here and here is an alternative that has codeless storyboard implementation and is very easy to configure.
(Posted on behalf of the OP).
I'm not sure the way I solved is right or wrong. But, it works for me.
I remove default Navigation Bar by disabling the bar visibility. Then, I add new Navigation Bar in Home page. After I run the app, my new Navigation Bar appears when I press on the Home button.

How to navigate to a new Screen when using SideBarController in Xamarin.iOS

I have an application with a lot of screens, let say HomePage, Section Screen and Detail Page, Category Screen.
I use a NavigationController to Navigate from HomePage to Section Screen.
In the SectionScreen I have used a SideBarController component (https://components.xamarin.com/view/sidebarnavigation) to implement a navigation drawer or a flyout menu.
The problem is how to navigate from Section Screen to Detail Page or to Category Screen. I need to make this kind of navigation from MenuController or ContentController.
I don't want to just change the contentView. I want to push another UIViewController.
I have used the usual one:
this.NavigationController.PushViewController( new UIViewControllerExample(), true);
but there are some problems:
In the details page I can't access the NavigationBar
When I press back, the app crashes with an error:
Cant add self to subview
This is how to it should look like.
This is the problem. The first image display what happen when i use the above code,
Any idea how to solve this.
as you can find in that page of component you should use SidebarController as your navigationcontroller
SidebarController.ChangeContentView(new OtherContentController());

Storyboard UINavigation Controller Back Button Text

In XCode 4.5.1 creating a storyboard app with a Navigation controller, I am having a hard time trying to set the BACK button for any view controllers that are pushed. I'm using segue's and the view controller shows as expected. However I want to change the name of the navigation bar and back button dynamically and placed this in my ViewWillAppear:
self.title = #"Select Songs";
[self.backButton setTitle:#"Add"];
changes the title of the navigation bar but the back button still displays the NAME of the pushed window rather than the text "Add".
The Simulated Metrics are all Inferred. I also added a BarButtonItem to the black tray below the view in Xcode and wired up the backButton of the viewcontroller to the backButton, yet the text still does not appear.
Adding the following log messages also yield something interesting: (and yet the titlebar is updating correctly)
-(void) viewDidAppear:(BOOL)animated {
NSLog(#"%s %#", __FUNCTION__, self.navigationItem.backBarButtonItem);
NSLog(#"%s %#", __FUNCTION__, self.navigationController.navigationItem.backBarButtonItem);
}
2012-10-14 15:18:41.835 xxxx[2690:907] -[ViewController viewDidAppear:] (null)
2012-10-14 15:18:41.838 xxxx[2690:907] -[ViewController viewDidAppear:] (null)
The accepted answer is a hack, this is the way to do it...
Open StoryBoard
In Document Outline window find ViewController to which you want to
return to
Click on Navigation Item of that ViewController
In Attributes explorer change Back Button value to your custom tile
That is it, enjoy...
The back button will show the title of the previous view and if no title is set it'll show 'Back'.
So in your prepareForSegue method, you can change the title of the current view before the next view is pushed. The back button will then show whatever you set the title to.

How to identify the viewcontroller is clicked from More Tab or Separate tab in UITabBarController?

I have the navigationcontroller based viewcontroller and I overriding the root view controller navigation bar back button in to my custom segment control with different purpose. This navigation controller is placed one of the separate tab in the uitabbarcontroller. If this is used as the separate tab bar then no problem.
But if i use this navigationcontroller inside the more option in tabbarcontroller i am not able to come back to the more option list because of backbutton is overridden in my navigationcontroller.
My idea is add one back button only if my navigationcontroller is used more option tab otherwise i need to hidden the back button.
Please help me in this issue?
You can check if a view controller is in the 'more' section as follows:
BOOL isOnMoreNavigationController = [tabBarController.moreNavigationController.viewControllers containsObject:myViewController.navigationController];
From a UI consistency perspective it might be better to always show the back button in its standard position and move your custom buttons to some other place.

Custom Back Navigation operation

i need a help
my app is Tab & navigation based.
in the navigation model i have a section to get input from user and store it to SQLLite thats working fine when i clicking the "save" button
prob here is once its saved i need to navigate user to the preveios level of the navigation controller (same operation like Navigation Back button).
Any ideas?
Thanks in advance
Try calling popViewControllerAnimated:
[self.navigationController popViewControllerAnimated:YES];

Resources