I'm using XCode 3.1.4, I'd like to browse the iOS framework classes visually, eg. the UIKit.framework classes.
I believe this is possible with Class Model facility, the documents here http://developer.apple.com/tools/xcode/xcodefuture.html suggest so:
The Xcode class modeler works with Objective-C, C++, and Java source code files and can give you a look at just a few classes, every class in your project, or even all of the classes in a framework.
I made a Class Model and selected Add All to include everything including the framework's .framework files. However on the generated diagram where I see UITableViewCell, it has no arrows pointing up from it, even though I know this class inherits from UIView. I've played with clicking various ways, the menus and Info but can't see how to see the full inheritance tree of UITableViewCell.
Can anyone advise?
This is what I did to make it work:
Select the project:
Then choose Quick Model:
Then you get a ridiculously large model with all the classes in it.
If you wanted the classes from just one framework, you could select just that framework in the files list, instead of the whole project.
I see the same thing in the Xcode Class Modeler, so it may be an issue with the tool or a choice made by its authors.
The method you used should give you a correct model, however you may need to move classes around to be able to see the arrows as there are way too many lines present if you model everything at once. The quick model will give the same results using the selection (i.e. if you select your project itself you get everything, and if you select a group of classes you will just get them.
Related
When editing a .xib in Xcode, I can select a view or other object, navigate to the "Bindings" tab in the Inspector, and bind its properties to properties of other objects. This is all well and good, but if I create my own subclass and add new properties, those properties won't appear in the list, and I'm having trouble finding an up-to-date solution for adding them.
I'm aware that I can create the binding at runtime using bind:toObject:withKeyPath:options:, but that doesn't seem like a very elegant solution, as it's clunkier than setting up a binding normally is, and adding glue code kind of defeats the purpose of using bindings. The only method I've seen is to create something called an IBPlugin, but I'm hearing Xcode stopped supporting IBPlugins ages ago when it and Interface Builder were merged into a single program.
So how can I do this? I tried #IBInspectable, which makes properties settable in the inspector, but it doesn't look like that makes them bindable.
I have created a small selection of custom controls that are tagged #IBDesignable to enable visual configuration within IB. They work perfectly in their parent project/workspace and, as I wanted them to be reusable, I've created a framework.
After importing the framework into another project, I can access the classes programmatically but there is no visual representation in IB and none of the #IBInspectable properties are displayed in the attributes inspector. There are no errors reported during build or run phases. I guess I'm missing something somewhere but does anyone have any pointers?
It would appear that this is not currently possible (using Carthage as a dependency manager at any rate) without considerable effort with workarounds. This kind of defeats the object IMO!
For now it seems that you need to import the framework project into the product project. Explanation here but, for now, this seems dead in the water.
After a quite long struggle with the known and unfortunately one of the few help articles about controlling properties, tabbed properties etc. (links below), I have decided to ask for your help.
What I need to do seems not that hard, but, well, I just couldn't bring the pieces together. So the problem is:
I want to extend the existing properties view of Eclipse (PropertySheet) with some further tabs, which will be later on filled with certain information from EMF objects, which in the end implement IAdaptable. So they can be queried for PropertySources and there are already a few tabs, sections extended in the corresponding project in its manifest, which are being successfully gathered from the Selection Listener of the PropertiesView.
Here comes the tricky part: I don't need to extend this project further, by defining further tabbed properties in its manifest. I need to implement a seperate plug-in project, which does this extension job for the other main project. I don't need extra views or so. This existing project provides the property sources and like sad has its own designed tabbed property view via its extensions.
I have actually become quite familiar with the concept of the views and properties, I can build some Property Sources and let the Properties View gather/show/manipulate the properties.
But this idea, letting an external plug-in extend the Properties View with tabs of an another EMF-based plug-in project, just can't get to me. I am really confused and don't know with what to begin with.
I would be unbelievably glad, if you could point me to the right direction.
Thanks a lot!
*Links:
http://www.eclipse.org/articles/Article-Properties-View/properties-view.html
http://www.eclipse.org/articles/Article-Tabbed-Properties/tabbed_properties_view.html
I created a new project of type Static Linked Library.
I have moved the code (previously working in the app) to the library leaving all the xib files in the app.
I have changed the export directory and added the library file from the derived data folder so it gets the compiled version and links to it.
I have added the library to the bundle and have verified it is in the app using iPhone Explorer
I have verified that the xib file recognized the new view type by removing and selecting the custom view type in the custom class field of the identity inspector.
I have changed all of the #import commands to reflect the <> VS "" change and have gotten the app to compile.
however none of the methods of my custom class can be executed. and an NSLog reports that the class is its base counterpart as opposed to the custom derived class.
I am at a loss and have spend a long time converting all the code I have to work in a library. I am hoping someone can help with this.
On this issue, it turns out that Objective C's compiler does not load the categories and custom classes in the libraries by default. There are 2 ways to overcome this.
And here are your options.
Create an Activation type method on the category that will be called to "Activate" that Class or Category. This will need to be done before the application loads any nib files. And seems like a bit of a pain in the butt. This was however how I originally overcame this issue.
Add linker flags that will tell objective C to load all libraries and attach any and all Categories and Classes within the libraries before executing the application. (this will need to be done, on top of #import(ing) the correct files from their correct locations. I will provide a graphic below. and provide the flags for search purposes
-ObjC is the first one I added, but -all_load really did the trick.
I hope that others can benefit from this experience.
I have learned that in iOS 5, properties that are marked with UI_APPEARANCE_SELECTOR can be styled using appearance. Eg [[UINavigationBar appearance] setTintColor:....]. However, I seem not to be able to style all elements. UIButton, for instance, has no properties marked UI_APPEARANCE_SELECTOR, hence I am not able to use the above technique to style it.
My question is: How do I best style elements globally (all appearances in the application), when I cannot use appearance?
Right now I have defined some colors, fonts, shadow offsets etc. that I use many different places in my code. This allows me to change the look and behaviour of a lot of elements, but it still doesn't allow me to style all instances of a certain object with only one line of code.
Edit
In lack of better solutions I have created a number of categories with simple methods as the following:
+ (UIButton *)customLabelWithFrame:(CGRect)frame andText:(NSString *)text;
Also I have found that - in combination with the described categories - stretchable images are nice and useful.
With the above I am able to style in a global-ish manner, however I am not satisfied with the result and I still hope to find a better solution
What about standard subclassing or factory classes, as you mentioned yourself!?
For buttons I'm using factory classes myself.
I think a really nice solution could be the Android way of designing interfaces. Android relies on XML files to define the user interface. As a matter of fact, I'm working on a library that aims to give the projects I'm working on much the same capabilities. It's still a work in progress / experiment and as such really messy code (you have been warned!), but it might give you some ideas.
An example project can be downloaded here: http://dl.dropbox.com/u/6487838/WSLayoutManager.zip
Experiment a bit with the XML files by adding controls. Create custom control classes and instantiate them from the XML file, etc... It's fun stuff :)