cocoa

How to set indicator image on column with multiple sort descriptors?

NSDisableScreenUpdates(); [self.productsArrayController setFetchPredicate:predicate]; [self.productsArrayController setSortDescriptors:sortDescriptors]; [self.productsArrayController fetchWithRequest:[self.productsArrayController defaultFetchRequest] merge:YES error:nil]; NSSortDescriptor *lastSortDescriptor = [sortDescriptors lastObj...

Change "Controller Key" list for bindings in IB Inspector

Hello. I have next question: I create own Controller ( myController:NSObjectController ) and it has own attributes, for example NSString* title; Now I want to bind this attribute to some text field. Can I made that attribute 'title' display in 'Controller Key' menu of inspector binding window in IB; (There where 'selection', 'canADD'...

Help with Subclass Property

I have a UIView subclass called Card that I move around on my board and drop on hot spots called slots. When I drop the card I use the hitTest to figure out if I am dropping the card on one of my hotspots. I want to get a property of that hot spot but I am having trouble getting that to work properly. My only guess is the hitTest return...

How to retrieve multiple records from table?

I have a table having data. id type 1 max 1 sam 1 rom 2 jak I want to retrieve all the type where id=1; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *aRecord = [NSString stringWithUTF8String:(...

Formatting usb flash drive on Mac OS X

Good Day, How can I format an USB flash drive using cocoa frameworks or carbon? Is there any functions to make it? Thanks, Vlad ...

How do I get Core Data to use my own NSManagedObjectID URI scheme?

I am writing an app that connects to a database to fetch data. Since the fetching is expensive and the data is generally unchanging, I'm using CoreData to cache the results so that I can do fast, local queries. From the database, for each type, there is a string property that is guaranteed to be unique. In fact, there is a URI scheme fo...

WebView not showing in NSWindow

I am developing a C++ app and I need to display a NSWindow with a WebKit WebView inside it. I've coded up the Objective-C class which will manage creating and displaying the window but the WebView contained inside it does not display. Here is my code. Any idea on what is wrong and how I can fix it? I'm compiling the below code with $g++...

Cocoa QTMovie - How can i change the duration of each frame being added to my movie?

I am creating a movie by addoing image frames to my QTMovie, every frame is suppose to show up for about 0.2 seconds. But the closest I have got was 1 second per frame. I tried etering amounts less than 1 into my QTTime but that way my movie length would be 0 seconds, the documentation doesn't describe what the parameters in QTMakeTime a...

Make an Image have rounded corners with Objective-C / pure C

Hi, How do you make an NSImage Image have rounded corners? I'm doing Mac Dev not iPhone dev. Thanks in advance. ...

Im getting an EXE_BAD_ACCESS error with my NSTableView datasource methods. Can anyone tell me why?

Hi all, I decided to get back to Cocoa/Objective-C programming recently and my current project calls for an NSTableView. I thought I had gotten the process down to a Science but it appears I was wrong. I am getting an EXE_BAD_ACCESS error in the datasource method that actually returns the data. When I run the application, all results...

NSTextViews and background layout

Hi, I've got a really weird crash on Leopard (not on Snow Leopard) concerning NSLayoutManager, NSTextView and the background layout feature. My application is 64-bit garbage collected and that seems to be the root of the problem. I've established that the crash happens like this: 1) the system decides to do some background layout on s...

NSTreeNode parentNode method never returns nil

Hello, I am using bindings with a NSOutlineView and NSTreeController. I am trying to determine the parent node of a particular node by using the -parentNode method of NSTreeNode, however the method never returns nil as indicated in the documentation. Instead I have to do this in order to make things work. The introspection is a hack. Any...

Is there a cocoa framework for image scanning?

What options do I have for an image scanning framework on Mac OS X? I'm not looking for an OCR library. Just something that will do the actual scanning and importing to PDF or comparable format. ...

Validate decimal max/min values in a NSTextField

First of all i have to do this without IB and without advanced Objective-C techniques like KVO. My problem comes from the simple fact that i can't find a way to get the whole new string value of the text field. I'm tried using the delegate function: - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCha...

How to properly determine width of an attributed string

What I want to do: layout text using NSLayoutManager and set its NSTextContainer to the width of the widest string (glyph-wise) in an array of strings. What my problem is: The methods for determining the total 'glyph-width' seem to be incorrect because when I render the text it wraps. I did an experiment using a 32 character string wit...

How to set NSFormatter to accept negative integer values

The problem i have is when the formatter gets the string "-" or empty it fails to accept it. This makes entering a negative number a little bit uncomfortable. It also requires me to leave at least one digit in the field, which is also far from comfortable. Is there any way how a formatter would accept this as 0. My formatter works in N...

NSTreeController fetch predicate based on transient isRoot exceptions

My document-based Cocoa application uses a NSOutlineView/NSTreeController combo, bound to the document's Core Data store. My NSTreeController has the fetch predicate isRoot == YES. isRoot is a transient boolean attribute with a default value of NO. My root model's awakeFromInsert calls: [self setIsRoot:[NSNumber numberWithBool:YES]];...

KVC: How do I save UIKit structs in plist?

I am using KVC to set properties of objects from a plist. I know I can save them as strings <string>{{66, 114}, {64, 64}}</string> and manually convert to structs, but how can I save for example a CGPoint or CGRect in a plist in a way that Cocoa KVC would understand? The Key-Value Coding Programming Guide seems to indicate that I need to...

how to keep track of webpage opened

Hi, Just wondering if there's a way to keep track of what website the user is browsing to via Cocoa or Webkit? Sort of like the TrackTime.app? Thanks ...

Setting dylib paths as a XCode build step.

I have a Cocoa application as XCode project that has several supplementary bits of functionality as dylib targets. When XCode builds the project, it places all the build outputs in a single folder: The .app bundle and the dylib files. And when executed from the XCode debugger, the .app launches. I can't however launch the application f...