I have created SimpleView based application, in which i want to add new file with .xib interface but when i add new file then Objective-C class and then subclass of UITableViewCell there option of with xib for user interface is disabled i also want to add xib..
How to add new files with .xib interface ?
Here are screenshots..
Thanks for reading..
Only certain classes such as UIViewController will have the nib option enabled. UITableViewCell is not one of these classes.
I don't know why this is disabled. And I couldn't remembered that was it enable in previous versions of xcode.
But you can add xib for custom cell as described in this tutorial.
Here is the quick steps
Create a simple view XIB
Drag a table view cell into the XIB from the object browser in the bottom right corner
Delete the superfluous view
Make sure also that "iOS" is selected, and not "OSX" when choosing a template for your new file. When "OSX" is selected, the option was disabled in my project.
for UITableViewCell you will not have xib for that we have add an empty view by selecting userinterface while adding new file. Then drag and drop uitableview cell.
Related
I have a TableViewObject on my storyboard which has a corresponding UITableView class.
Within that TableViewObject I also have the 'cell' which manages the layout of a given prototype cell - the class associated with this is of type UITableViewCell.
The issue is that no matter where on the storyboard I click, when I show assistant editor it opens the UITableView class - not the one corresponding to the UITableViewCell.
I think it hasn't always been this way because I managed to drag/drop controls to make outlets in the past but now it refuses to comply - what can I try to fix this?
I've confirmed that the UITableViewCell class is the one shown in the Identity Inspector for the cell and also tried deleting the Derived Data folder that someone recommended - but this hasn't solved it.
To give some further detail, for other TableViewController/Cell combos I have the option by clicking 'automatic' of selecting one of two files, but for the problematic one there is only one file (see screenshots).[![enter image description here][2]][2]
Don't use assistant editors at all. They are a dead letter. If you want to display the code for the table view cell subclass at the same time as the storyboard, just Option-click on the code file for the table view cell subclass in the project navigator — or select the prototype cell, switch to the Identity inspector on the right, and Option-click the little arrow next to the class name.
I was trying to add a new view controller on Xcode 4.5.2, i made the xib file to be compatible to 5.1, started playing around with it and suddenly noticed that this custom table view cell is not getting loaded at all, it was always creating a crash on load.
[self.cellNib instantiateWithOwner:self options:nil];
I started checking the .app file which is getting created, i am able to see that except for this new custom table view cell nib files all the other xibs are in "nib" extension. what setting can make this xib file to be converted to nib like others.
Go to file inspector then select identity inspector as following:
In class select your particular class for that you want to add nib file.
You need to provide your custom class name in the field of Custom class 'Class' field.
All my view controllers and their xibs are in another project which is reference in the main project, the problem was with my methodology of reference to the main target. i was just pulling the xib file from the referenced project to the main target. the actual way of doing it is like this
touch the main target's xcodeprojfile, choose the target, build phases, in copy resource bundle press '+' and then add the xib file. Thanks to #vishal for his guess on the problem.
Hello there fellow programmers,
I am wondering how to add the SDNestedTable into a project of mine.
Here is the source code for the SDNestedTable:
https://github.com/serverdensity/ios-SDNestedTable
I would like to add this table to a subview of one of my XIB's in my project.
Thanks, hopefully someone can help me out! :)
If you add a UITableView to your XIB file, then click on the second tab (right side panel) and in that make the class the SDNestedTable rather than your UITableView so it makes it that class instead, assuming also that SDNestedTable is a subclass of UITableViewController.
You should be able to then add your property to your .h file and attach it in your XIB:
#property(nonatomic, weak)IBOutlet SDNestedTable *nestedTable;
and in your .m file will go all the delegate methods you need that are also listed at the bottom of the github link you've provided, similarly to a UITableView and the dataSource and delegate methods they have I would imagine.
There are three problems (based upon the review of your actual source code that you posted in your other question):
You need to make sure you include the NIBs and PNG files in your "Copy Bundle Resources";
If you are going to support iOS 6, there is a bug in SDNestedTable and you have to change the cellIndexPath of SDGroupCell from assign to retain;
If you're adding the SDNestedTable (with its own controller) as a subview of SDNestedTableController as a subview, then you should use view controller containment.
All of this is explained in greater detail in my other answer to this question:
Works on iOS Simulator but not on iPhone
I have problem with creating a second UITableView in a new tab of a UITabBarController.
My App:
1st tab has a UITableView shows feeds from a website. It works fine!
2nd tab, I want to create a NEW UITableView showing different information. I am able to create an empty UITableView in the main XIB file, also created a new class files for the new UITableView, but I cannot figure out how to connect the new UITableView in 2nd tab to the new class files I created.
Thanks for reading.. Hope you understand my question.. Thank you!!!!
select main XIB file, it will open interface builder view. Open utilities view->go to identity inspector->select you tableview controller->add class name to identity inspector for your tableview.
It'a s simple app, window based.
The window has a UINavigation Controller, and the Controller has a UITableView built from
New File-UIViewController subclass- UITableViewController option check.
I set the style for the UITableView to Grouped in the Interface Builder, but the table stayed Plain in the Simulator.
I wonder if I missed any options?
XCode 3.2.6
iOS SDK 4.3
Any help is appreci
Project download: Zip File#Google Docs 692k
tViewController is a subclass of UITableViewController so it's creating a tableView for you and ignoring yours. Change the superclass of tViewController to UIViewController and it will use the tableView you have defined in IB.
Make sure you've properly specified the nib file (remember: iOS is case sensitive) for the controller and connected the table in the nib to File's Owner. Otherwise, the controller will create its own table, which is probably what's happening.