cocoa

Call a sheet from within an alert causes weird window problems

Hello, I decided to use an alert sheet with 2 buttons. When the user clicks the continue button a sheet made from a window should come down. The sheet comes down and the parent window closes along with the other sheet. The code I'm using is: - (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(int *)contextI...

How can i use Cocoa/CoreText/Quartz for multithreaded drawing

Are there any howtos? What is the best practice here for background thread drawing. Is it okay to store the rectangle data from [NSView drawRect] in a queue and let the background thread take the rectangle and create some bitmap and render the data into the bitmap and then use performSelectorOnMainThread:withObject to draw it? Or can i...

Invoking a method at the end of Cocoa's main event loop

How would it be possible to invoke a method at the end of Cocoa's main event loop after each iteration? I want to do the exact same thing that NSManagedObjectContext's -processPendingChanges does. According to the documentation, "In AppKit-based applications, this method is invoked automatically at least once during the event loop (at ...

Should I release the NSError object of NSFileManager's copyItemAtPath:toPath:error: ?

NSFileManager has a method to do copying. - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error If an error occurs, the third parameter (NSError **) upon return will contain an NSError object describing the problem. Question: do I need to release it? There are some other methods, for example t...

How do i display the modified dot in the red button of an NSWindow

Can't find the Cocoa API call to set the modified marker of a window. ...

Accessing properties of Core Data objects via bindings from non-Core Data objects

I have a set of data created by another app and stored in XML format on disk. Since this data is managed by this other app, I don't want to bother with loading this data into a Core Data store for two reasons: 1) it would be redundant storage of the same data, and 2) I would have to constantly update my own Core Data store to match upda...

How to access dropped files in a droplet style cocoa application

Pretty much all the apps I use on a regular basis implement this 'seemly simple' scenario, yet I can't replicate this in my own Cocoa application. Please consider these steps: The application is not running You drop a file, or a selection of files onto the app's icon. The app runs and performs some actions on the dropped files. Maybe i...

indexes of NSTableView rows

Hello I sink index of first row in tableview is '0' it is Correct? If yes, HOW can I make so index of first row in tableview become '1' ? this is need because my DataSourse start from '1', and I need that: [myTableView selectedRow] = [myData row] but no [myTableView selectedRow] = [myData (row-1)] ...

Audio Queue Services: changing output device

Hi, I've spent the last week on an unplanned excursion into the depths of the Macintosh sound system after NSSound proved to be unequal to the task.. I finally got my file playing with Audio Queue Services and now there's only one little thing left to do: switch output devices. Unfortunately, it seems that I'm either doing something wr...

CAAnimationGroup with different interface elements

Hi, I want to crossfade two NSViews and resize their NSWindow. I know how to do them separately but so far not how to do it simultaneously. I think I need a CAAnimationGroup for it. But because I'm dealing with two different objects, I don't know how to add the two animations in the group and I don't know how to start the animation beca...

Text formatting in NSTextField

I have a graphics app that uses a NSTextField instance for in-place text editing, this feature was added long time ago and I never had a reason to check it, however, I have recently received a report: text filed doesn't allow text formatting. Format -> Text menu subitems are all disabled, so there is no way to set the paragraph of a text...

CoreData on a distant server syncronizing between different clients (apps)

Hi @ All, I'd know if it exists a kind of CoreData server ? The point is to get an "automatic API server" providing data to clients. It can be useful to implement very quickly standalone Forum app, Games or anything on the cloud... ...

Drag and Drop within NSCollectionView

I have an NSCollectionView that is properly configured to display Core Data Entities based on what's found in an NSArrayController. These Core Data entities, named MyManagedType, are defined to include an int32 indexing number "indexNumber" to keep them ordered, and binary NSData *myData. I can also select the items by clicking them, b...

What is the proper way to be notified of a Core Data model object being restored after a deletion?

I've got an elegant system set up using Core Data where any time a property of a model object is changed it is automatically reflected in its associated view using key-value observing but I have ran into a problem using undo. The problem occurs when I have deleted a model object. The associated view is destroyed along with all the key-v...

Is there a library or example for creating Excel (.xlsx) files?

I'm writing a Cocoa application and I'm trying to export to the Excel XML format (ISO/IEC 29500-1) which is basically a zip file with a bunch of xml files in it named with a .xlsx extension. I've tried generating apple script and using NSAppleScript to create the Excel file, which works, but is slow and the user has to have Excel instal...

NSString isEqualToString: does not work. Why?

Hello, I create an NSString using, NSString *myString = [[NSString alloc] initWithBytes:someBuffer length:sizeof(someBuffer) encoding:NSASCIIStringEncoding]; I used NSLog to output myString and it displays "Hello". If this is the case, then why does this fail. NSString *helloString = @"Hello" BOOL check = [myString isEqualToStri...

Extract RSS Feed URL from NSString - iPad

Hey, I'm loading a website's html code using NSString - NSString*webViewText = [NSString stringWithContentsOfURL:[NSURL URLWithString:[self getCurrentURLFromWebview:browser]] encoding:1 error:nil]; and I'd like to extract the RSS feed from them, but I got a few questions. From what I know, most feeds are included in the website as such...

Obtaining admin privileges to delete files using rm from a Cocoa app

I am making a small app that deletes log files. I am using an NSTask instance which runs rm and srm (secure rm) to delete files. I want to be able to delete files in: /Library/Logs ~/Library/Logs The issue is that the user account does not have permissions to access some files in the system library folder, such as the Adobe logs sub...

How can i find the file type after loading NSImage withContentsOfFile

I need to know which image file type was used in the file i loaded with "initWithContentsOfFie" because i don't want to trust the file extension. Unfortunately i can't find anything about the format in NSImage and NSImageRep, ...

How to find beginswith word in a string using NSPredicate?

Hello! I am searching for a solution on how to format NSPredicate to search correct word in a string of text. Currently I am using this code: NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(content CONTAINS[c] %@)", word]; but it returns wrong resuls if the word is short, for example: if the wo...