cocoa

Scrollable menu using MenuItem's

What I am trying to accomplish with Cocos2d, is to create a horizontal menu, which can be swiped from left to right. I posted an image, to show my idea. The image below has a white bar, where I want to show MenuItem objects, now I want to be able to do a swipe in the white region, so that the next menu item is centered. The problem I...

What's the difference between a View XIB and an Empty XIB?

I know that the View XIB has a view already in place, but are there any other differences? I've read tutorials which say to create a View XIB, change the class and delete the view, then insert a Table View and remake the connections (File's Owner to the Table View, Table View delegate and datasource back to the File's Owner). Is there an...

How do I convert an NSString into something I can use with FSCreateDirectoryUnicode?

I'm new to Mac and Objective-C, so I may be barking up the wrong tree here and quite possibly there are better ways of doing this. I have tried the code below and it doesn't seem right. It seems I don't get the correct length in the call to FSCreateDirectoryUnicode. What is the simplest way to accomplish this? NSString *theString = @"M...

Adding UIScrollView using interface builder

Hi , I am adding a UIScrollView as a subview to the controllers view. After that i am adding 2 views to the scroll view as the content view. When I am printing the subviews of the scroll views using NSLog(@"Scroll View Subviews : %@", [scrollViewObj subviews]); then it is displaying 4 subviews , 2 for the views added to the scroll vie...

Defining and using protocols in objective-c.

Hi, I'm trying to extend NSImageView so I can delegate the drag/drop responsibility to the controller. It all works fine with the one problem that the compiler is now displaying warnings about sending messages to objects with type id. To solve this I assumed I would simply have to suffix the ivar's type with the name of the protocol. Ho...

Passing NSMutableArray into a function

Hi, I have this problem with Cocoa, I am calling a function and passing an Array to it: Some where I call the function: [self processLabels:labels]; And the function is as follow: - (void)processLabels:(NSMutableArray*)labs{ labs = [[NSMutableArray alloc] init]; [labs addObject:@"Random"]; .... } When debugging, I notice...

Method Signature Problem.

I am getting the Error/Warning about a part of my code saying 'Messages Without A Matching Method Signature will be assumed to return 'id' and accept '…' as arguments.)' I do not understand why I am getting this error, so i am looking for some help, below is a link to that part of code in the implementation file. http://fwdr.org/h8xf H...

How do I declare a child class as a property of a parent class to be used in related child classes?

I have a small class hierarchy where I would like to have a child class be a property of it's parent class and all related subclasses. Essentially, I have AbstractClass with a property of GroupClass. GroupClass is a child of AbstractClass. UsableObjectClass is a child of AbstractClass and uses GroupClass. If I do the following... #...

How do I create an FSRef from a NSString containing a path?

I have a file system path in a NSString, but I need an FSRef for the system call I will be making. What is the best way to create the FSRef? ...

What is the name of this Mac OS X control?

Does this control have a name? Or is it just a bunch of simple controls merged together? If so, what controls are they? http://img8.imageshack.us/img8/3002/picture2xrb.png ...

How do I create an import-only document type in Cocoa?

There's a file type my application import but not save. I've added an entry to the document types and set it to read-only, but that doesn't yield the import behaviour that I'm looking for. Instead, my app will just open the file and when I save the original file is overwritten in my own file format. How to set up my document or document...

Hyperlink in Cocoa

I am developing a Mac application in XCode. I need to add a hyperlink which navigates to a particular site. I tried this using a button, but I need to know how to change the cursor to hand cursor when mouse is over that button. ...

Possible core-data bug: attributes named 'updated' don't work correctly?

I have a Core Data entity called Post. One of it's attributes is called updated and it is a date. The stored XML looks like this: <attribute name="updated" type="date">266164481.00000000000000000000</attribute> From this I concluded that the data is being stored correctly. When I read the data back the returned value is a NSCFNumber, ...

Objective-C - Test for object instance being dealloced/freed

There's some way to test for an objective-c instance for being dealloced/freed (retain count == 0)?? By example, object A have a reference (pointer) to object B, but object B can be freed in memory low levels, how i test reference B to be sure it was dealloced?? @interface A : NSObject { B b; } @implementation A { - (void) someAc...

How do I use the return value of a sheet to decide whether or not to close a window?

I want to use windowShouldClose: in my NSWindowController subclass to pop up a sheet asking if the user wants to save changes before closing with Save, Cancel, and Don't Save buttons. The issue I'm running in to is that beginSheetModalForWindow:... uses a delegate instead of a return value. I can return NO in windowShouldClose:, but th...

Can I validate a @property value in Objective-C using @synthesized methods?

What it says on the tin: I'd like to use the @property/@synthesize syntax to define a property on my Objective-C 2.0 class, but I want to place restrictions on the range of values allowed in the property. For example: @interface MyClass : NSObject { int myValue; } @property (nonatomic) int myValue; Implementation: @implementat...

Anyone know why nextEventMatchingMask:untilDate:inMode:dequeue: take many ms to return an event?

In a OS X game calling this was recommended as the way to get keyboard and mouse events. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; for(;;) { NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; if(!event) break; processevent(event); ... } [...

How to get value from NSTextField(in cocoa)?

I'm a beginner,thank u very much. ...

Cocoa Controllers - best practice for notifying on completion, for disposal?

A general question on style and best practices... I have an ObjC controller object. After alloc/init of the object, I get it to do a job asynchronously: [myObject doSomeThingsOverTime]; The method sets things in motion, and then returns immediately. Question: what is the best way to be notified of the result in the future, so that I...

Implementing multiple views in iPhone

I am trying to develop an app which can have multiple views (up to 30). Each view will have have similar navigation but the content will be different. Do I have to create 30 view controllers or can I get around by creating a view controller for the data (content) alone. I am sure creating multiple view controllers is going to be ineffice...