I'm new to Xcode and building my first App, I want to incorporate a Twitter feed, my project is done in Storyboard but the Twitter feed code is with .xib, is there a good way to launch the .xib in Storyboard?
There is no real need to launch the window.xib in the storyboard. Just instantiate your view controller that is the file owner of your twitter feed code programmatically and push into your navigation controller. It won't cause any problems. The storyboard is basically an extension to the way screens were managed before. You can have all you "scenes" in storyboard and programmatically push a view controller from outside the storyboard without any problems and navigate back again.
The UINavigationController is the key. It only cares that it got a UIViewController.
Related
I am currently learning iOS development and I began with a simple Tabbed Application. It has the default First and Second View in it. I added a TableView with static cells content. I then added another View Controller. I created a Segue using the storyboard. When I set the transition to modal, it works fine. When I set it to push, the app is crashing (Uncaught exception).
Any idea why?
How can I get more information regarding the exception? Can I make the app stops when it encounters an exception?
Figured it out.. I need to add a Navigation Controller to use push...
I am new to iOS programming and I am working on a project which will use both XIB files and storyboard.
I have two modules in it basically. First module is made from XIB files which also runs independently. I have made another module using storyboard and I had to integrate these two independently running modules. The screen of my first module which I want to connect to my storyboard is a subclass of UIViewController and I was able to do that with the help of stackoverflow (How to load a storyboard from a XIB file?) by creating an object of UIStoryBoard. Now my application is able to go to the storyboard but I can't come back to my first module which is made up of XIB files.
Please let me know how can I connect to the same instance of the last screen of the first module through which storyboard is called so that I can move back and forth through these views easily. Connecting to the same instance of the XIB file is important because it is a chat screen and when I come back to this screen, I would like to get back to the chat where I had left it and also when I come back to the storyboard (by clicking a button on the chat screen) I have a slider on the screen which should display the value which the user must have chosen when they were on this screen last time. I guess creating a new object should give me a new screen which won't work in this situation. This kind of mechanism works well within storyboard with the use of segue where we can define both source and destination view controller.
Please help me achieve the same in my situation.
Please also check the screen shots of the XIB file and the storyboard which I want connected.
Thanks.
Convert the nib files into storyboard, it will help you easier to manage your application.
Well in your case, what i see is from nibs is that there is a navigation controller in storyboard and also there will be a root view controller navigation controller from xib files.
Well the navigation controller stack has all VCs you pushed into and you can get back it in different ways.
I am a newbie to iPhone app development. I want to make a simple app using view-based template which will have a main menu (home screen) linking to different modules of the app. Modules will themselves be made up of either UINavigationController or UITabController.
First I just wanted to create and bug a module, so I took a NavigationController in MainWndows.xib(appDelegate) and stacked(linked) many ViewControllers to it.
Now I need to have main menu at start of app, where I have placed NavigationController. I am now confused what to do? I have got solution in my mind that place this NavigationController in new xib file and a mainMenuViewController in MainWindow.xib file and access navigation module as a modal. So my Question is that if my approach is right? How will I access this modal controller to push viewcontrollers onto it? Or is there other alternate for what I want..?
I hope my Question is clear...
Any suggestion or link is appreciable.
I have got a better idea in my mind. I am going to stick with NavigationController in MainWindows.xib. I will push Main Menu as Root view Controller with both its navigation bar and toolbar hidden. Depending upon the button tapped, I will further push appropriate View Controllers on NavigationController.
I want to use generally the old .xib files in my iPhone application. But when it comes to tableViewController storyboard is a lot more convenient in order to make custom cells etc. Is it possible to make a .xib based application and in the middle of it, to use a storyboard for a UITableViewController and its DetailedViewController only?
You can use a storyboard for any part of a program. Storyboards are not an all or nothing concept. You can have just one view controller in a storyboard, or a small network that just represents a subsection of your app.
To use just one view controller from a storyboard:
Add a new storyboard to your existing project.
Add a single view controller to the storyboard.
Assign an identifier to the view controller in the inspector.
Use the UIStoryboard class to load the storyboard resource
Use -[UIStoryboard instantiateViewControllerWithIdentifier:] to create a new instance of that view controller.
Install the view controller some place in your app by doing something like pushing it on to a navigation controller, or run it modally.
Both can work fine together (Storyboards and Nib files). In the TVC that is part of your storyboard, just instantiate the destination VC in code and use the usual initWithNibName method to load the nib file.
You can add a storyboard to any project, but the point of storyboards is to centralize your XIB files into one location rather than having 10 XIB files you can have 1 .storyboard file that contains 10 scenes representing your views. This shows your connections to other scenes, and you can manage all the seques and transitions of each scene. So is it possible, yes you could add a storyboard to your project, but I would recommend you design you entire application in a storyboard if you want to use them.
Newbie question: is there an easy way to convert a view-based app to a navigation-based app? I have an existing app sample that was created as a view-based app, and need to be able to create additional viewcontrollers that can be nested. The app is currently using presentModalViewController calls and nibs to display windows. Trying to change these to pushViewController calls results in the views not being displayed. So I'm assuming it's because the pushViewController needs to use a Navigation view. Thanks in advance!
Since you're admittedly a newbie, I would take the approach of creating a new navigation-based project and copying over your .xib and .m/.h files.
If you want to do it the hard way :), you'll add a NavigationController object to your MainWindow.xib. Then add a UINavigationController member and outlet and property to your app delegate, and connect it in interface builder to the navigation controller. At the end of your application:didFinishLaunching: method in your app delegate, set the window's view to navigationController.view. Back in MainWindow.xib, set the root navigation item to the view controller that used to be displayed at launch.
In you applicationDidFinishLaunching:, create a UINavigationController and add its view to the view hierarchy, then save it off to an ivar.
This is exactly what the navigation-based template is doing. There is nothing special about a "view-based" or "navigation-based" app,.