Why isn't my tableview visible? - iphone-sdk-3.0

I'm an sdk newbie, so please forgive the simplicity of this question. Here's the scenario:
I used the Utility Based application template because I like the flip effect of the info button. I changed the info button to a round rect button and made a copy of it that to have two round rect buttons on my first view. I modified the flipside view to display a picture and that functionality works fine. For the second button I wanted it to flip to a tableview underneath the navigation bar. I added a navViewController for the navigation bar and a TableViewController for the tableview. I made a nib for that View, added the tableview, hooked up all the appropriate connections, but when I run it, the flip works fine, but there is no tableview displayed. What I mean by no tableview is it is blank. No lines or anything, just a blank navigation bar at top and blank white space. Please help! Thanks!

With limited information you have given here:
Potential Problem 1 - First Level UIViewController is not linked
If you open NIB file in interface builder where you have drag and dropped NavigationViewController, you will see small disclosure triangle. If you expand that you will see NavigationBar and UIViewController. Select the UIViewController and change it to name of the TableViewController.
The NIB file will change and say View Loaded from YourTableViewController.
Potential Problem 2 - You have to do addSubView or insertSubView and pass in [navigationController view]
If you post some code it may be helpful.
Hope this Helps!

Related

Storyboard - insert a Searchbar and linked it to the containerview (tableviewcontroller)

I had a tableviewcontroller with a SearchController I managed programmatically. For some reasons, I need to have a storyboard to display things a bit differently not anymore a tabéeview in full screen.
Everything is going fine with a container view inside my storyboard. The container view is linked to my custom tableviewcontroller which was managing my searchbar. When I instantiate an object, I can see my custom tableView (with a searchbar lying at the top) in the same way it was before.
I would like to remove the search bar embeded to my tableview (i.e in my tableviewcontroller) and add it directly in the storyboard (to have more at the top of my screen with free space between the search bar and the table view. I tried to insert a searchbar and displaycontroller but I am stuck in the sense I cannot link the searchBar to my tableViewController.
How can I do to link the searchbar in the UIViewController to the tableviewcontroller in the containerview? My tableviewcontroller conforms to the protocol necessary to have a searchbar working still there was no problem when they were not gathered inside a storyboard.
Here is an image if it can help.
If anyone could help me to link the searchbar and the tableviewcontroller...
Thanks!

ios7 custom VC Transition: Overlap a Modal Form Sheet View

i want to use the new UIVC Custom Transition API in my iPad App Project. And i despair of it -.-. what i want to do, sounds very simple at first. My "FirstViewController" (simply the names) is a normal FullScreenVC. From that VC i open a "SecondViewController"modally with the default Presentation style Form Sheet. Everything allright. The SecondViewController is a normal UiTableViewController. So from inside the SecondViewController I want to open a "ThirdViewController" modally as well with a custom transition. This ThridViewController have to overlap the SecondVC with the Form Sheet Presentation and the content of the second view controller have to be dimmed as well. But i get many problems inside the animateTransition-method in the the Transition Delegate. My best idea by now is, making a UIView Snapshot of the from View. Create a new UIView with black background and alpha 0.5 and put it as a subview inside UIView Snapshot. Then transfer the frame and the center of the fromView to the toView and add the UIViewSnappshot as a subview to the toView and send it to the back. finally adding the toView to the containerView.
But when i do this, I get two s*** problems. The First is, that the Transition don't recognize that i am using a Retina display, because i put the center of the fromView to the the toView. But the toView dont overlap the fromView, better its nit at the same postion. Its almost at the left down of the screen and not in the middle of the screen. The second problem is, that the toView content seems to be transculent. In Storyboard and in code i write "be opaque and white bgcolor". But at runtime the see the controls of the view but the bgcolor is the bgcolor of the dimmed View behind it. Why?
At the moment i think i'm a dump guy :( What in hell im doing wrong?
Thanks
Avarlon

Showing Toolbar on 2nd ViewController

I have two view controllers on the same storyboard. What I want to do is send an array of string values to the table view control on another view controller.
ViewController2 *second=[self.storyboard instantiateViewControllerWithIdentifier:#"View2"];
second.arrayFromVC1=areaArray;
[self presentViewController:second animated:YES completion:nil];
The second view controller has a toolbar control at the top by default. (See below.)
Passing data to another view controller wasn't easy for me, who has been using Xcode for two weeks. I somehow managed it. So an array of strings is sent to the 2nd view controller through an array variable (arrayFromVC1) set on the 2nd implementation file. I suppose experienced Xcode users know what I'm talking about. Anyway, the 2nd view controller does receive a list of values as shown below.
Well, the problems are that the toolbar control on the 2nd view controller will disappear when the user gets to see the list and that the table view control (UITableView) occupies the entire window. I understand that you can control the size of the table view control by specifying values under the viewDidAppear method. But my question is... Is that how things work with iOS and Xcode? So if I want to display that toolbar control at the top, I have to do it programmatically by writing code under the viewDidAppear method as well?
Thank you for your advice.
Tom
Tom, are you using interface builder and storyboards? If so, select the ViewController in IB, go to Editor (in the top menu) --> Embed In --> Navigation Controller.
This will embed the chosen VC and any VC it segues to (and so on) into a Nav Controller.

Can I use a UINavigationController as the detail view of a UISplitViewController?

I'm running into a problem with an iPad app where I would like to have UINavigationControllers in both of the views within a UISplitView. I've looked through other similar questions here, but most link to a tutorial online that doesn't completely solve the problem. Here's a 2-minute walkthrough to re-create the problem I'm having:
Create a New Project in XCode, starting from the Split View-based Application template.
Add the following NSLog statement as the first line within the DetailViewController's willHideViewController method:
NSLog(#"toolbar: %#", toolbar);
If you run the application now, the log will show that the DetailViewController's toolbar is alive and well. Now...
Open MainWindow.xib and expand the SplitViewController.
Drag a Navigation Controller from the library on top of the DetailViewController.
Expand the new Navigation Controller and change the class of the UIViewController within to a DetailViewController.
Ctrl-drag from the SplitViewController to the DetailViewController and assign it as the delegate.
Save MainWindow.xib and run the app again.
At this point, the detail view has a navigation bar and an empty toolbar. If you view the logs, you should find that the toolbar is null. Why is this? Am I missing some sort of connection in Interface Builder? Is the navigation bar the problem for some reason?
Unlike the tutorial at http://www.cimgf.com/2010/05/24/fixing-the-uisplitviewcontroller-template/, I would like to keep both the navigation bar and the toolbar (preferably with the toolbar at the top when in portrait and not visible when in landscape), so that I still have a functional "Back" button when the iPad is in portrait orientation.
Does anyone have any suggestions for fixing this problem? An example project with this sort of set-up would be ideal.
You can certainly use a navigation controller on the detail view of a split view controller. In fact, the iPad Settings app uses this approach. Probably the best way to get this setup is to create a new project in Xcode 4.x and select the "Master-Detail Application" template. It will generate a split view controller with 2 navigation controllers, one for the left view and one for the right view.
To your toolbar question, to keep things simple I would put a toolbar in the bottom. You can still put bar button items on the top navigation bar, although you can only put them in the left, middle, or right. If you need lots of items on the top bar, one way is to add a toolbar to the detail view and hide the navigation bar in the viewWillAppear event of the detail view class.
Here is an example on how to hide the navigation bar and show the toolbar:
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.toolbarHidden = NO;
self.navigationController.navigationBarHidden = YES;
}
I've found the built-in UISplitViewController to behave badly when trying to combine it with most of the other built-in view controller subclasses. Matt Gemmell's MGSplitViewController is a lot more flexible and has worked pretty well for me, despite the odd glitches (though those are at least fixable as the source code is provided).

UISearchBar and UINavigationController

I have an .xib file connected to a ViewController, which is init'ed as the root controller of an instance of UINavigationController in my appDelegate.
In that view, I have a UISearchBar and a UITableView below it.
When the view loads up, there's a navigationBar at the top, followed by a ~20 pixel gap, and then the UISearchBar, and the table beneath it:
My problem is that when I enter the UISearchBar to type something, the navigation bar disappears (which is fine), but the search box is all screwy:
I'm pretty new to this (a couple of weeks), so I'm not quite sure what's going on. Can anyone help me shed some light on this?
Did you pull the search bar into the parent view or into the table view? The search bar should be the header view for the table, and not as a standalone view. If you want it to be standalone anyway, make sure your autoresizing flags are correct (under cmd-3 (size) in the inspector in Interface Builder); the search bar should stick to the top and not be flexible in height.