cocoa

NSArray sort with custom objects

I have the following class: typedef enum eItems { kItem1, kItem2, kItem3 } MyItem; @interface MyClass: CCSprite<CCTargetedTouchDelegate>{ ... MyItem mClIt; ... } ... - (NSComparisonResult)MyCompareFunc:(MyClass*)inObject - (MyItem)GetSomeItem; ... And function for sorting: - (NSComparisonResult)MyCompareFunc:(MyClass*)inObject {...

Handeling single uitextfield within UITableView

Hi All, Here is the scenario I am working on, I have a single textField in the cell allocation section and after this section I try to provide give the text field various arguments. Works fine no problem till here, the problem lies how to handle which textField is returning in the delegate method. My Earlier approach was to simply ...

How to catch multi-touch event in NSView

Dear all, Is there any way to handle multi-touch in a class which extend NSView? currently 1 touch with drag event is working now. ...

The release of Xcode 4

I'm a paid up iPhone developer. I've really enjoyed the WWDC iTunesU videos and am eagerly awaiting Xcode 4. My question is simple. When do you think Xcode 4 beta will be released to non-WWDC attending developers? I've been scouring the 'net for days and can't find any decent suggestions at all. ...

What will be the best way for creating custom container for adding components in cocoa.

I am creating custom view to add child controller like radio button,text field etc. I am sub classing NSView and overriding drawRect method to get custom drawing via NSBezierPath. but when I am clicking or focus changes for text field ,radio button. I am getting artifacts until I call setNeedsDisplay. Is there any better way to manage t...

Turning a command line app into a Cocoa GUI app on Mac OS X?

Is there any tutorials or references, if such thing is possible, to make GUI applications out of command line apps? What I mean is, having a command line app, wrap it into an app bundle and create a Cocoa GUI app that would have a simple interface to execute the command line app with its flags and parameters. ...

Mouse tracking daemon

Hi gang, I need to write something using Cocoa to surface raw mouse movement data. Optimally, the app would just be a little daemon that would run, passing the data to a socket server which another application could tap into to gain access to the events. Can anyone point me in the right direction with regard to approach and tools? I ...

[iPhone] MotionEvents reduce sensibility

Hey guys, since my question was answered really fast and with a high quality the last time I decided to post here again. After hours of trying I finally was able to implement motionEvents in my application (oddly enough I first had to create a new view where I put all my stuff in - somehow it didn't work in a modified window-controller...

Destructor in Objective-C++

I have an objective-C++ class which contain some honest C++ object pointers. When the Obj-C++ class is destroyed does it call dealloc immediately? If so, then is the best way to destroy the C++ class by putting delete obj in the dealloc method? ...

A way to implement a sideways NSTextFieldCell?

I have an NSTableView in my application with data being drawn in for both the X and Y axes (ie, every row is matched with every column.) I've got the data populating the cells the way I'd like, but it looks terrible with the columns stretched out horizontally. I would like to turn the NSTextFieldCell on its side, so that the text is wri...

Sparkle framework delegation question

I have a wrapper application which launches a bundled application and then immediately quits (using [NSApp terminate:nil]). I would like to include Sparkle in this wrapper (it's not going to be possible to include if for the bundled app itself), and I've implemented it without any issues: so long as I comment out the NSApp terminate line...

NSComboBox not returning correct data

I'm adding strings to a NSComboBox using -addItemObjectWithValue, and the items are appearing when the application is run. However, right after adding the items, if I check the -numberOfItems, I get 1, even though there are more than that. From there, any data I try I pull back out is wrong. I'm adding the items as part of -awakeFromN...

Custom getter side-effects

Are there side-effects to calling a custom getter with dot notation? I had been using a synthesized getter in Objective-C via the dot notation, i.e. tree.fruitnumber returned the number of fruits in tree. I had to customize the getter (for reasons not pertinent to this question). I wrote it as -(int) fruitnumber { //climb into tr...

Checking for valid email address on the IPhone

I am developing an iPhone application where I need the user to give his email address at login. What is the best way to check if an email address is a valid email address? ...

Passing integers when floats are called for

If the arguments of a method call for floats to be passed, can one simply pass 10 as opposed to 10.0? I have been doing this, but often see code which specify .0 and have been wondering if there are any reasons to do so. Thank you. ...

Is there a guide to converting a document-based Cocoa application to non-document-based and/or vice versa?

If not, this is about as good a place as any to write one. I'm facing the possibility of just such a conversion in a project and wondered if anyone has been down the road or if the process is documented somewhere. ...

How do i detect keystrokes using objective c?

Hi, just wondering, how I go about detecting different keystrokes, and then detecting what key has been pressed I tried using this, - (void)keyDown:(NSEvent *)event but didnt seem to get any results. I've also had a search around but didn't find anything. I'm guessing I may have to set up something in interface builder to detect keystrok...

Returning NSString, Error Message: Variable is not CFString

Hi all, i shortly started Programming Mac OS X Applications with Cocoa, so its a realy New bee question. Sorry about this. At first my code snippet: - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { Purchaser *actPurchaser = [tableViewDataArray objectAtIndex:row]...

Sorting nil-valued rows always to bottom in nstableview column

Hi there, I have an nstableview in my application containing several columns. When I click on one column header in order to have it sorted ascending, rows with a nil-value in that column are being sorted on top followed by non-nil-valued rows in ascending order. If I reclick on the same column, first the non-nil-valued rows are being sh...

Relaunching a cocoa app

I have an application that checks its command line parameters and stores values in persistent stores. One of those is a password that I don't want sticking around for people to see with 'ps' and friends. The approach I'm currently looking at is to, after I've stored the values I need, relaunch the process without the command line param...