cocoa

NSWindow NSResizableWindowMask resize corner wrong place

Hello, if i use NSResizableWindowMask flag in my NSWindow the "resize corner glyph" is on the top right. I can resize when pointing on the lower right corner. I use a own created NSView with it, and set it as content view with setContentView method. I ' dont use a bottom bar. Any idea of what i'm doing wrong ? Thanks. ...

Document Based Application, preinitialize window (enter serial, buy, trial)

I need to create several windows before NSDocument is loaded, or create a window that blocks NSDocument window and top menu. I tried several solutions - but they didn't work right. modal window, one after another. there were some problems with Async URLConnection, and some other problems with my NSDocument content. I created custom M...

How to integrate KVC in MVC?

So I have an MVC-application in Cocoa. There are some custom views, a controller and a model. Of course, the views need to know some stuff, so they get their data from the controller. However, they do not use accessors in the controller, they use KVC with a keypath that calls right through to the model: // In view.m time = [timeSource v...

Is it possible to filter an NSArray by class?

Is there a way construct a predicate to filter by class type? I currently loop through the array and check to the class of each object. Maybe there is a cleaner way? ...

How do those bitmasks actually work?

For example, this method from NSCalendar takes a bitmask: - (NSDate *)dateByAddingComponents:(NSDateComponents *)comps toDate:(NSDate *)date options:(NSUInteger)opts So options can be like: NSUInteger options = kCFCalendarUnitYear; or like: NSUInteger options = kCFCalendarUnitYear | kCFCalendarUnitMonth | kCFCalendarUnitDay; Wha...

Parsing Json Array of Arrays

Hi everyone, This is my first post on stackoverflow so please be patient :-) I have an Json Array of Arrays: { "response_type": "ok", "total_results": 1, "page": 1, "total_pages": 1, "sets": [ { "id": 2075184, "created": 1269989599, "term_count": 5, "has_images": false, "terms": [ ...

Core Data: Inverse relationship only mirrors when I edit the mutableset. Not sure why.

My model is setup so Business has many clients, Client has one business. Inverse relationship is setup in the mom file. I have a unit test like this: - (void)testNewClientFromBusiness { PTBusiness *business = [modelController newBusiness]; STAssertTrue([[business clients] count] == 0, @"is actually %d", [[business clients] coun...

Objective-C Framework PSMTabBarControl does not work - NSTabView Tabs with Style

Hello everybody In my App I'm trying to get PSMTabBarControl working, but all I do - nothing... I have copied the framework File in my Frameworks folder of my App, then included it. In my InterfaceBuilder (3.2.1) I was able to drag and drop the PSMTabBarControl to my Window and link it with the NSTabView (PSM -> tabView -> NSTabView &&...

How can I escape unicode characters in a NSString?

When I store a NSString inside some NSDictionary and log that dictionary to the console like this: NSString *someString = @"Münster"; NSDictionary *someDict = [ NSDictionary dictionaryWithObjectsAndKeys: someString, @"thestring" ]; NSLog ( @"someDict: %@", [ someDict description ] ); The console output looks like this: unico...

EASY: How does one release memory correctly in the attached C array?

Hi, I'm just trying to work out why the following code is leaking memory and I have a funny feeling that i'm not releasing the array memory correctly. This is a C function in a wider objective-c app and I'm not native to C... i've tried just using free() on the array, but have a feeling this isn't the whole story... Could someone have a...

Can't delete a file created by mkstemp() on Mac OS X

Apparently, NSFileManager is unable to delete files created by mkstemp(). Here's some test code to demonstrate this: char pathCString[] = "/tmp/temp.XXXXXX"; int fileDescriptor = mkstemp(pathCString); if (fileDescriptor == -1) { NSLog(@"mkstemp failed"); } else { close(fileDescriptor); NSURL *url = [NSURL URLWithString:[NSSt...

Editable CATextLayer?

I have several CATextLayers. When I doubleclick one of them, I want to be able to edit it's string. Think of text as it's handled in Keynote or many other apps. Any ideas? I thought of putting an editable textfield right in front of the layer and then dismiss it on enter, but I didn't get far. :-( I target Mac OS X 10.5 with Objective-...

NSUInteger vs NSInteger, int vs unsigned, and similar cases

Anyone have the expertise to explain when to use NSUInteger and when to use NSInteger? I had seen Cocoa methods returning NSInteger even in cases where the returned value will always be unsigned. What is the fundamental reason? Is NSInteger or int strictly limited to if we want to represent negative value? From NSObjCRuntime.h: #if _...

UITextfield check if its a number

Hi, How can I check if a user enters a number in my UITextField. Basically its a mark im accepting between 0-100 and it can be a decimal....I heard i can try to convert it to a NSNumber type and see if it returns null. Not suree Any help would be appreciated. I have tried if(grade.text doubleValue] == 0){ //Not a number ...

Using Apple autorelease pools without Objective-C

I am developing an application that needs to work on Linux, Windows and Mac OS X. To that purpose, I am using C++ with Qt. For many reasons, on Mac OS X, I need to use CoreFoundation functions (such as CFBundleCopyBundleURL) that creates core objects that need to be released with CFRelease. But doing so generate a lots of these warnings...

Validate a URL string in my iphone app

Hi, I am getting really frustrated and I cant seem to check if the user has entered a valid url or not. This is what I have tried: NSString *str = [NSString stringWithFormat:@"%@", [myurl.text stringByAddinPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURL *aurl = [NSURL URLWithString:urlStr]; if(aurl == nil){ //Invalid...

Type casting in objective-c

Hi all, Is there any way how can i convert a nstimeinterval type value to a string type in xcode? Thanks in advance Joy ...

What is differences between category and extensions in objective-c i am confused any good articles for that..>?

Hi i am confused with category and extensions in objective-c any good articles for that Thanks in advance. ...

catching setDateValue with an NSDatePickerCell

I could have sworn I was able to make a custom NSDatePickerCell, override the setDateValue method, and catch anytime the date was changed. It doesn't seem to work now. Does anybody know how to catch anytime the date value of a date picker changes? Adding an observer to the keypath doesn't work either... ...

NSTableView, NSArrayController and reload only after key press?

Hi folks, I have the following situation: There is one custom view inside of the first window that contains a NSTableView. There is a second window which acts as a form for the current object behind the selection of the table view inside the first window. Some more details: I’ve implemented the setDoubleAction: behavior in the NST...