cocoa

HTML in textview

Hi All I am using textview in cocoa How we show a HTML data in textview Thanks Deepika ...

Delegation in a NSThreaded Design? (iPhone)

Hi Im using a large amount of very small web services in my app and I have been down a couple of roads that does not scale or work as desired. The Design approach Im thinking about: The task for the viewController is to ask for a set of data from a general webServicesClass, this task is started in a new NSThread -> this will instantiat...

How to implement an NSTextView that performs on-the-fly markup to RTF conversions

I'm trying to build an NSTextView that can take "marked up" input that is automatically translated into beautiful RTF-style text while the user types. The idea is to let the user enter text in "plain text" format, but to "beautify" it on the spot, e.g. H1 A quick list: * first item * second item would be translated into a first line ...

NSArrayController initialization

I am having trouble getting an core-data backed NSArrayController to work properly in my code. Below is my code: pageArrayController = [[NSArrayController alloc] initWithContent:nil]; [pageArrayController setManagedObjectContext:[self managedObjectContext]]; [pageArrayController setEntityName:@"Page"]; [pageArrayController s...

Cocoa class launched from JNI

I currently have code that makes a call from java into my cocoa app using JNI, in the JNI function on the cocoa side I create a new thread and assign my NSApp delegate like the main function would do. Here is the code I am using in a dummy class that creates my real class: @implementation MenuLauncher - (void)run { NSAutoreleasePo...

Pragmatic way of handling mouse in Core Animation layers

Hello, I'm starting working with Core Animation and I started wondering how to handle various kinds of mouse events like mouse entered a CALayer mouse exited a CALayer mouse click on a CALayer For now I'm concentrating just on mouseDown message sent to my custom view. According to the documentation I should use -hitTest:(CGPoint)poin...

Can a NSDictionary take in NSSet as key?

I know you can use any object as key for NSDictionary but the problem is will it be able to retrieve the correct value? Support I have an entry where the key = {1,3,5} and value = { @"hello" }. Will I be able to retrieve from this dictionary entry by passing in the set {3,5,1}? In order words, is the key matched based on the pointer or...

nstableview + cannot show partial file names

Hi there, I am using Table View Control. In the control, I show File/Folders details, if I reduce the size of file/folder name column, it does not show partial file/folder name (whatever characters can be shown in the Column). If a file name has multiple words in it, if enough space is not there to show a word then that word does not g...

How do I deal with typing nested message calls in ObjC source from only the keyboard?

I think over the last year and a half, while experimenting with Cocoa and Cocoa Touch development, I've been struggling with getting Xcode to support a kind of key macro to handle this specific coding scenario... I frequently find myself not knowing ahead of time how many message dispatches to chain together while typing a new line of c...

Cocoa: Any downside to using NSSet as key in NSMutableDictionary?

Is there any downside to using NSSet as key in NSMutableDictionary, any gotchas to be aware of, any huge performance hits? I think keys are copied in Cocoa containers, does it mean NSSet is copied to dictionary? Or is there some optimization that retains the NSSet in this case? Related to http://stackoverflow.com/questions/1863061/can-...

How come my Core Animation transformation always returns to it's start-state?

Hello experts! I am trying to perform some kind of animation of a layer in my iPhone application. It does not matter what I do I always get the same results: after the animation is done it jerks back into it's original position. Even though I set removedOnCompletion to false there is no difference. What am I missing here? Thanks in adv...

Storing AudioBufferLists from the ExtAudioFile API for later use

Using Xcode/Cocoa and the ExtAudioFile API, I'm trying to store away AudioBufferList* objects away for later use, but I'm running into trouble with re-accessing the data. These objects are coming from repeated ExtAudioFileRead calls. I realize that I can't just stuff these AudioBufferList* objects into an NSArray, but I was under the i...

Concatenating two NSStrings separated by a CRLF

Sorry for the dumb question. I have two NSStrings and I want to create a third that is the first string plus a new line plus the second string. I know this must be easy but I am banging my head looking for it. Ultimately I want the resulting string to display correctly in a table view cell. Regards Dave ...

"Private methods" or static functions in Objective-C. Which one should I use?

When reading Best way to define private methods for a class in Objective-C I end up with a programming style doubt. Which is the better solution (in terms of style) to this problem? To use a category and declare it in the @interface directive in the .m file or go with the static function that receives an object. Thanks ...

What is the best way to define string constants in an objective-c protocol?

I have defined a protocol that all my plug-ins must implement. I would also like the plug-ins to all use certain strings, like MyPluginErrorDomain. With integers this is quite easily achieved in an enum, but I can't figure out how to do the same with strings. Normally, in classes I would define extern NSString * const MyPluginErrorDoma...

memory management guidelines on foundation functions

While memory management for the foundation classes are consistent and documented, i was surprised to find (via the friendly EXC_BAD_ACCESS) that Foundation functions like e.g NSStringFromSelector() seem to return pointers to constant storage - which is at least not mentioned in the documentation for the function. Is that behaviour docum...

Play m4p with AudioQueue

Is it possible to play protected m4p files with AudioQueue? I tried NSSound (it can play m4p) and the AudioQueue sample afplay (does not work otb). Is there any way to play m4p with AudioQueue? ...

How to center NSSegmentedControl

Hi, I've added an NSSegmentedControl to a pane on an horizontal split view on a normal window. I thought that adjusting the springs would make the segmented control centre itself automatically, but it doesn't. How can keep it centred? I was told to add an observer for when the parent view's frame changes, and manually adjust the positi...

DivX Decoder libraries?

I saw, in an application from a major software vendor a dll called "DivXDecoder.dll" - which intrigued me as (a) it implies the existence of an easy to use divx library, and (b) I'd rather like to play divx compressed movies in a product I work on. The DivX project itself seems to concentrate on making Codecs and tools for end users. Ar...

NSThread object retained twice?

I have a class derived from NSThread: @interface FSEventMonitorThread : NSThread { FSEventStreamRef m_fseStreamRef; CFRunLoopRef m_runLoop; } - (id) initWithStream: (FSEventStreamRef)fseStreamRef; - (void) dealloc; - (void) main; @end @implementation FSEventMonitorThread - (id) initWithStream: (FSEventStreamRef)fse...