Is there a tool or trick for displaying all the connections between objects in an Xcode project? I'm thinking of some kind of graphical display, or less desirably, a table. Naturally this would be very useful for troubleshooting or studying sample code. I tried searching in here (SO) but the terms appear in many questions and connections has another meaning. Thanks.
Following Rob Napier's suggestion, something like "ibtool --connections foo.xib" might help. See http://cocoapi.wordpress.com/2009/02/20/how-to-look-for-a-specific-bind/ for some grunt stuff that might help as well.
I am new to this, too, and coming from android side. I wonder if it's better in the long run to define all connections dynamically in the view controller as needed, if that can be done in all scenarios. At least you can see how everything is hooked up there in one place.
In IB, you can simply click on File's Owner instead of on individual elements and it will show all available IBOutlets and IBActions in the right sidebar and what they are connected to.
Related
I already asked this in the Apple Dev Forum but received no replies, so I'll try here.
I'm unsure if this is a bug or whether I've missed something since I'm still very new to programming.
I have multiple view controllers and have made multiple classes. I have set the custom class "bit" of each view controller to the revelent class. When I ctrl-drag anything from the view to the relevent class header, I get the usual pop-up. I fill in the info, press connect, and BAM. It does the same kind of error whether I choose "Outlet" or "Action" It worked in the previous Xcode but I'm not sure if I've forgotten something.
The view controller and class that I added with Xcode 4 is still working beatifully.
I've tried adding the image manually but all that gave me was a SIGBART error just trying to get to the view. Again, I may have missed something, but I don't think there's much to miss is there?
Any help would be appreciated.
Just to eliminate a few things... I've deleted derived data, restarted Xcode and done a "clean". That's all I can remember that I've done.
Problem solved:
When selecting the implementation file. When I looked in the File Inspector, I found that under "Target Membership", the app name wasn't ticked. I ticked it and it now works well.
Since I didn't need to do that in Xcode 4, I suspect in Xcode 5, it doesn't do that automatically. Maybe that's a bug? I don't know if it was deliberate by Apple, but I think I'll file a bug report anyway since It's a bit of a nuisance.
I have an issue with my project storyboard. I have added two localizations more to storyboard, so now I have three storyboards: spanish, english and basque. All of them depending from the main one:
Now I have the issue that I have to update all changes manually to all to storyboards, because if I do changes to MainStoryboard, the others are not updated with this changes.
How can I modify all storyboards at the same time?
Thanks
Here is a really great tutorial for automating changes from one storyboard localization to all the others:
http://danielsaidi.wordpress.com/2012/08/20/localization-in-ios/
http://www.youtube.com/watch?v=cF1Rf02QvZQ
From what I gather, the solution involves adding a python script to the end of the build that syncs the storyboards and generates string files.
Go to the links for a more detailed solution. They said it better than I can.
You could either take out all the strings from Storyboard and put them in localized set of strings. Then you would have to do everything in your code like this:
self.label = NSLocalizedString("LABEL_STRING", nil);
or you could open the Storyboard as an XML file and do it there maybe a little faster. But other than that, no it is not doable, bcs the Storyboard localization serves you for polishing your localization. Say you have a screen called "HOME" and then (using google translate), you have "HASIERA" in basque. The problem here is, that in basque it's longer, so you need to adjust the GUI elements so it fits the screen perfectly. What could happen is that the string would be cut off, which we don't want to happen. That's why you need to do Storyboard localization step by step. If you don't need it, use strings file instead...
I'm struggling to use Chromium Tabs in Cocoa and I really seem to be missing something.
I've subclassed CTBrowserWindowController (ppEditor), CTBrowser (ppDocumentBrowser), CTTabContents (ppDocument) and CTTabContentsController (ppDocumentController)
Editor creates new Documents by : [self addTabContents:(ppDocument*)doc]; (and I've also tried first adding a Document Controller for the specific document first, but this doesn't work either)
I'm connecting my outlets from TabContents.xib (either to File Owner : ppDocumentController or to an instance of ppDocument I'm adding to the XIB), but it doesn't work and the outlet instances show up (intermittently) as NULL pointers.
So, what could be going wrong?
NOTE :
When connecting actions (either to the ppDocument class, or the ppDocumentController), these - weirdly so - do work....
There is some cross-referencing between classes (e.g. there is a pointer to ppDocument from ppDocumentController, as well as one from ppDocument to ppDocumentController)
Problem solved.
Although, I have no idea how - I basically did the whole thing from scratch and ooops, it worked (I must have missed something in the first place...)
How I can create a code in XCode 4.2.1 what will create NSTableView and add just couple of items to it?
All what I wanted to do is:
1) Window where is NSTableView
2) I have an array of strings in NSArray which I like to show in that NSTableView
3) All of this should be done in code. So I don't want to learn how to add this action happen when you press button (I know already how to do actions when user click buttons etc), I just want that application launch -> draws the table where is those items from my array. That's it, nothing more.
And yeah I have understood that I do not add items to NSTableView directly. That is not the point in this question. I just mean that I want to show couple of items in that table but I have no and kind of clue WHERE I should add my data from my array.
I have tried to google for example pages for hours (just too many and have not find help) but I will always be stucked in the part when
a) I must do something in the Interface Builder and the images of the interface builder are from version 2.x or 3.x and I have 4.2.1 and it is totally different (new to XCode...). Surely I have drawn my TableView element to UI but I mean delegations etc. Are those necessary at all? Can those be made from source code?
b) Code just does not work anymore because language (Cocoa or Objective-C, I don't know) has changed and I don't know how and what I have to do to make it work on newest version of XCode.
c) There is too much different ways told: "use binding", "you must create new class what is NSTableViewDataSource" etc. I have no any kind of clue what is preferred way, is another way optional or it is "you should use this because another is going deprecated soon" or something.
So please, can somebody give help in step-by-step what I exactly have to do? Should I create some bindings? If so, how and where? Do I have to create DataSource component myself? Are those ways valid any more? If I have to, how I can create it? Create a new class and implement it as a NSTableViewDataSource and then use it? Is that way valid any more and if it is, can sombody show code what is as simple as possible?
I have also checked Apple Documentation page many many times, checked those example codes but there is just too much totally unrelated stuff that I just don't understand at this point so they are totally useless (I mean, I don't know what is required for this task, what are not etc.
I would be very happy if somebody can help short tutorial step-by-step what to do. I mean "step-by-step" like:
1) Create new project
2) Draw NSTableView in project
3) Create new class with this name
4) Write this code: blah blah blah
5) Create another class with this name
6) Write this code
7) Run and see those items from array in NSTableView using (bindings/datasource/whatever is preferred).
Thanks :)
Your tableview needs a datasource. Your datasource is a custom class, it implements the "NSTableViewDataSource" protocol. This protocol contains a few methods that you can use to tell the tableview what data you got.
this includes the objectValue ( the value of the NSCell that is displaying your data on the specified row, and a method that returns the amount of rows the tableview has ( the amount of items in your array ).
Here a tutorial I found by googling:
CocoaDev.com NSTableView tutorial
You can also implement the NSTableViewDelegate protocol which allows some greater control. Like what rows you can select, or some extra configuring of a custom tableview cell.
I must say that back in the day when I started developing desktop applications ( only had experience with web technologies ) that this design pattern confused me as well. Hope you will get your mind round it soon.
There is a way to simulate the Slide To Unlock in the lockscreen? I've been looked for this in SBAwayController, but without any results :( Have anyone an idea?
I believe (if I understand your question correctly) you want to have the lockbar "unlock itself". For something like that you want to look into SBAwayView, not SBAwayController. In that class there are different methods that interact with the different lockbars. You will want to specifically look at the SBAwayLockBar which is a sublcass of TPBottomLockBar (defined in <TelephonyUI/TPBottomLockBar.h>)
You will have to poke around in the headers and see if there is any way to access the lockbar's Knob position.
Hope that helped at least a bit.