Admob- Adding new ViewController - iphone

I'm fairly new to xcode, but I'm having some trouble adding admob to my app.
I followed the instructions for Admob but the ads are not showing up.
I'm thinking I need to add the new view I created AdViewController to appsdelegate. Is there a code I should add for that?
BTW: I'm using a tabbar controller as the rootviewcontroller

You're going to need to create something akin to a singleton GADBannerView. My recommendation would be just to create a GADBannerView object that you pass around through different view controllers but constantly have the UITabBarController as your rootViewController.
There's an example that uses a UITabBar solution at http://code.google.com/p/google-mobile-dev/source/browse/AdCatalog/Classes/AdvancedLayoutUseCases/TabbedViewExample/?repo=adcatalog-ios.

Related

How to Navigate from one view to UISplitViewController?

I am using UISplitViewController inside my app but whole app is not using UISplitViewController only one view using it so how can i navigate from a view to UISplitViewController and is its possible or not?
You can take reference from here & a good example is here too.

How to launch a window.xib file in storyboard?

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.

XCode 4.1 - Multiple view within a XIB

I have created an application successfully and given it a TabBar view controller that is working as i had hoped, but have run into a glitch.
On each xib i load from the tabBar I need to create sub-views that will perform tasks as this interacts with a database (or .. will). I have created my first page and the buttons that will navigate to the views within the XIB, but do not yet nkow how to navigate between views within the XIB itself.
would it be better to have seperate XIB's that load when the buttons are hit?
OR
should i create views within the XIB's for each category and switch between them?
I am still learning and have had some confusion regarding navigation as I already have the TabBar controlling the root of the application. I have been looking for tutorials, but they all seem to start at either navigation controller as the root, TabBar as the root, and nothing like I need for option 1 above.
I can add details of the app if needed, but am looking for guidance for now.
Thank you,
Silver Tiger
To navigate between views the best way is to use a navigation controller pushing/popping separate view controllers, loaded from separate nibs. UINavigationController is a subclass of UIViewController, so you can perfectly put a navigation controller for each tab. You can also use story-boarding in the new xcode 4.2, but I recommend getting comfortable with this before doing so.

How to change the default View Controller that is loaded when app launches?

I have an application, say 'MyApp', which by default loads the view controller 'MyAppViewController' whenever the application launches. Later, I added a new view controller 'NewViewControler' to the project.
I now want the 'NewViewController' to be my default view controller which loads when the app launches.
Please let me know what changes I need to make in my project to achieve this.
Its easy, just:
Open your Storyboard
Click on the View Controller corresponding to the view that you want to be the initial view
Open the Attributes Inspector
Select the "Is Initial View Controller" check box in the View Controller section
Open MainWindow.xib and replace MyAppViewController with NewViewController.
In your app delegate class, replace the property for MyAppViewController with one for NewViewController. Connect NewViewController to its new outlet in Interface Builder.
In application:didFinishLaunchingWithOptions: add NewViewController's view to the window instead of MyAppViewController's view.
Most likely your main NIB file is still set to "MainWindow", check your *-Info.plist file.
If that's the case you can open the MainWindow.xib in Interface Builder. You should see a View Controller item. Bring up the inspector window and change the Class Identity to point to your new class. That should take care of instantiating your class.
As this feels like a "newbie" question (please pardon me if I'm mistaken) I would also highly recommend the following article:
iPhone Programming Fundamentals: Understanding View Controllers
Helped me understand the whole ViewController thing and the IB interaction..
As for me with xcode 4.3.3, all I had to do was simply replace all references of 'MyAppViewController' with 'NewViewController' in the AppDelegate h and m files.
Perhaps all the other steps have been taken out in the newer versions of xcode.
Hope this helps.

Convert Xcode view-based app to navigation-based app?

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,.