I created a UITableViewController in my storyboard. Added all the table cells, etc. and set it up with a Custom UITableViewController. But now, when I open my Storyboard, the image of the ViewController no longer draws. There is a segue drawn from the calling controller, but it just points to empty space.
The original controller entry can be found on the left in the "document outline" with all of its subviews and constraints intact, and I can run the app on my iPad without a problem.
Has anyone seen this behavior before and is there a recovery action I can take to get the controller to draw in the storyboard?
Related
I'm trying to create outlets using the Interface Builder, however when drag the UILabel from the IB to my controller's .h file the big lock symbol flashes for a few seconds and it doesn't actually create the bind between the UILabel and the outlet (although the code is generated). I also noticed an empty circle is created by this new definition. When it worked, a filled in circle was created on the side).
I've checked the UILabel and all parent views and have checked that their "Lock" property is set to "Inherit (Nothing)" (and have even set them all to "Nothing").
In the IB the UILabel doesn't show the "x" that appear when a UILabel is locked either.
So I have no idea if I'm missing to unlock something, or what I'm doing wrong to be able to create this outlet.
I don't know if this is relevant, but I'm using a custom view controller, and I'm using this same view controller subclass for 2 different view controllers in the same storyboard. I had no problems creating outlets this way for the first view controller.
Tryed reopening XCode (using 4.4.1) with no luck.
Any help is appreciated!
So are you dragging both UILabels from each View Controller into the same file? I don't think that this is possible, on the second view controller, try to Ctrl drag to the file owner within the IB view, that is, assuming that both views are connected to the same instance.
Also, in your identity tab in storyboard, under Localization Locked, make sure your storyboard locked setting is set to default as mentioned in https://stackoverflow.com/a/11169636/720175
I tried adding a totally new scene and would also get the lock symbol. So it wasn't only the scenes, but the whole storyboard. So a quick search on SO lead me to the answer:
https://stackoverflow.com/a/11169636/720175
In xcode 4.2, if you set up a new project for both iPhone and iPad and choose to create a new iOS "Master-Detail Application" Xcode will set up a lot of template code for you. The iOS "version" of the application has a different simpler storyboard. I want the detail view of my application to also be a Table View controlled by a table controller and I want the cells of this table view to automatically resize with an orientation change. The problem is that while this works for the iPhone version of the application, it doesn't work for the iPad version.
Pre-conditions:
If you edit the detail view on the iPhone storyboard so that it contains a Table View Controller and define the table view to contain a single prototype cell - set the prototype cell to be of a custom type and add some subviews to it then define those subviews with auto resize properties (for example two buttons - one fixed to the left side of the view, the other to the right margin of the view). Do the same for detail view of the iPad storyboard (which of course is contained in a more complex split view controller arrangement).
Double check all the view controllers have resize view from NIB selected (which they do by default) and all the views have Autoresize Subviews selected.
Expected:
When the application is compiled for either iPhone or iPad, in both cases the table cell and it's subviews should resize on orientation change.
Actual Result:
On the iPad version of the app the table cell does not re-layout to match the changed size of the UITable view. The table cell on the iPhone version of the app behaves as expected.
It's clear the chain of subview layout for nested views is broken such that re-layout subviews is not occurring or getting called all the way down to the table view cell when an orientation change occurs. Anyone know if this can be fixed in Interface Builder or if not what code is required to re-establish the chain? I know how I can fix this using willRotateToInterfaceOrientation:duration: , in my own custom subclass of UITableViewController but I'm not sure doing it this way is clean and I would prefer not to have partial automation of orientation changes with scraps of code providing workarounds for stuff I think it should be possible to automate.
How does one in XCode XIB builder add a UIImageView to an existing MasterViewController that has a TableView and is based on NavigationController?
Scenario
For example if you create a new project based on MasterDetail in XCode 4
Then look at the MasterViewController.xib file - so want to add a UIImageView to this that could be used to overtake the screen up until a point after which the image view is made hidden to disappear.
I'm trying to drag a UIImageView onto the page, and putting it just able TableView in the Objects column, however this doesn't work. Doesn't even show the image.
So even just knowing how to drag-drop an image onto the MastViewController.xib such that it takes over the screen at startup would be a step forward (not sure if I need a view to encapsulate both the UIImageView and the TableView?)
Background
Want to have an intermediate image that the iPhone app shows as it starts up
Idea would be start up (static) image is show, then straight away go to MasterViewController which would show this same static image with an activity indicator on it
Then when (is a background thread) the data preparation is down, the UIImageView could be made non-visible
PS. Some additional notes:
Initially there is just a table view you see in MasterViewController.xib.
If I drag an imageview in at the same level as the TableView it doesn't appear.
If I create a new view in the XIB and put the tableview and uiimageview under this, I get an error when running "'-[UITableViewController loadView] loaded the "MasterViewController" nib but didn't get a UITableView.'"
Is there a view or just a table view in your xib? If you want both a image view and a table view in the same view controller, you should have an ordinary UIViewController and let in implement UITableViewDelegate and UITableViewDataSource protocols and add a table view and a image view to its view.
so solved by:
creating a top level "view" in the XIB
put the UITableView & the new UIImageView under this new view
but, had to change the interface line to inherit from UIViewController NOT UITableViewController
Just add Default.png in resource.
I have a UITableView has a subview of a UIView and I've added a toolbar on top of the UITableView so it should look like this:
However when I actually run it, it looks like this:
So for some reason the UIToolBar isn't showing up. I really don't know why, is anybody able to figure this one out? Thanks in advance.
EDIT: I've changed the simulated metrics like suggested and it still does not show up:
EDIT2: Here is a list of objects as requested by Raixer.
Alright. I have a similar setup in my app so I will show you what I did.
I setup a tab bar controller with navigation controllers in each tab (this gives me the navigation bar automatically that is why I use it). If you notice the View on the first tab is being loaded from another nib (that is what I am assuming you are doing). I did this by changing the view's class to my own view controller and then setting the name of the NIB file to load in the Inspector like this:
(source: minus.com)
Then in my other nib file I only have this:
I hope this helps.
That's because you configured your nib file without counting with the height of the Tab bar.
The toolbar's height is 49 pixels. So when the view appears all your elements are moved 49 pixels up.
You should got to IB, open your View, go to Attributes Inspector, and in simulated metrics select Tab bar for Bottom Bar.
I doubt you will succeed with this approch. UITableViewController is very picky about adding subviews to its UITableView. However, you can have your UITableView handled by a standard UIViewController (just let IB point to a custom class inheritng from UIViewController). Add the table view to the controller's view as a subview and add the toolbar to the outer view.
Then you should be able to add subviews. UITableViewController gives you some convinience and functionality. If you can live without, UIViewController is no disadvantage. If you can't, you'll have to implement it yourself.
Another alternative to get the toolbar: put your table into a UINavigationController. That one comes with a toolbar (on top).
I am new to UITableView, so please don't mind me asking the following silly question(s).
In the attached screenshot, the IB's geometry does not match the geometry on the simulator - notice the white bar at the bottom of the screen in the simulator. What did I miss? The outlets for the TopLevelView, TableView and the DatePickerView are defined in the rootViewController.h file.
In the IB, I had set the background color of the TopLevelView to lightBlue; the background color of the tableView is set to ClearColor in the rootViewController.m file. But, the lightBlue color of the TopLevelView is not shown around the edges of the TableView.
[ivTableView setBackgroundColor:[UIColor clearColor]];
See the screenshot here
Regards, Sam
The "white bar at the bottom" problem suggests that you've got a view controller that doesn't seem to know that it's inside a navigation interface. You should show the code or otherwise describe how you're assembling this interface, because there's something wrong in how you're doing it.
The root view controller of your entire interface, the one whose view appears as the sole immediate subview of the window, should be a UINavigationController. Its rootViewController should be the view controller that fetches this view from the nib. Beyond that it's hard to help without knowing more about what you're doing.
I suggest that you start with the Navigation template. Unfortunately its RootViewController is a UITableViewController, which isn't going to work here because that's only for the case where the table view occupies the entire interface. So turn the RootViewController into an ordinary UIViewController. Now in the RootViewController.xib design the interface you've drawn above. It should load properly, convincing you that you're on the right track.