objective-c

Time between touch began and touch ended

Is there any function in cocos2d or objective c to find the time between touch began and touch ended?? ...

Core Data NSFetchRequest problem

Hi, I am trying to develop a test Core Data app so i can use it in my main app. But im having problems fetching stored data. I have 1 Entity "User" with 2 attributes: name (String) & email (String) I can successfully populate my store file with data... here is the code im using below. Any help would be greatly appreciated. NSManagedOb...

Adding item to NSPasteboard using "setData" ?

Hi, Im learning how to do drag and drop to allow ordering of items in an NSOutlineView. (Its my first time using NSPasteboard). From the slightly related examples I found online, it seems you use: [pasteboard setData: data forType: @"myapptype"]; What should be put into the NSData when you are doing a move. The samples put an archiv...

Add/remove rows to/from NSTableView in Objective-C

Hi all! I'm making a simple Todo application in Cocoa. I have added a class (and an NSObject to the XIB) MATodoController: MATodoController.h #import <Cocoa/Cocoa.h> @interface MATodoController : NSObject { IBOutlet NSTableView *table; } - (IBAction)addItem:(id)sender; - (IBAction)removeItem:(id)sender; @end MATodoController...

interface builder custom nsview sending action to parent

i'm having problems working out how to get a custom nsview to communicate that something has happened to my main controller class. the controller class has an instance of mapView like this: IBOutlet MapView *mapView; which is instantiated through interface builder, and in my mapView class, i'm getting mouse clicks like this: - (void...

How to play sound automatically when scrolling to the next page?

I'm using Page Control example from Apple. I want to be able to scroll horizontally to certain page and get the sound automatically play when viewing that page? And then sound stop when viewing the other page? So, for example. On page 1, i have some texts. When i go to the next page which is on page 2, i want sound to be automatically p...

Calling Python from Objective-C

I'm developing a Python/ObjC application and I need to call some methods in my Python classes from ObjC. I've tried several stuffs with no success. How can I call a Python method from Objective-C? My Python classes are being instantiated in Interface Builder. How can I call a method from that instance? ...

Writing data as XML in an app

What's a good way to archive the data from a class into XML and write it out to a file? (in Objective-C for iPhone SDK) I see lots about using NSXMLParser to parse the data but not much on creating the files. ...

NSBitmapImageRep and multi-page TIFFs

I've got a program that can open TIFF documents and display them. I'm using setFlipped:YES. If I'm just dealing with single page image files, I can do [image setFlipped: YES]; and that, in addition to the view being flipped, seems to draw the image correctly. However, for some reason, setting the flipped of the image doesn't seem ...

tableView frame.origin problem after textField resignFirstResponder in custom tableViewCell

I'm using an tableView with custom cells. When I want to display another view using the pushViewController function of the navigationController I loop through the textfields and call resignFirstResponder on them. But resignFirstResponder does only work when the textfields are being displayed so I scroll first to the top of the page. This...

Type id <Protocol1> does not conform to id <Protocol2> -- but it does!

Alright, I have two protocols in the same header file, let's call them Protocol1 and Protocol2. I have a main app controller that conforms to both protocols, and an NSWindowController subclass that has the following member: id <Protocol1, Protocol2> delegate; I'm getting a warning at the end of my NSWindowController subclass implemen...

[Cocoa/ObjC] Find parent directory of a path

Is there any way to find the parent directory of a path using NSFileManager or something? e.g. Take this: /path/to/something And turn it into /path/to/ Thanks ...

Why does NSArray arrayWithObjects require a terminating nil?

I understand that it marks the end of a set of varargs, but why can't it be implemented in such a way that doesn't require the nil? ...

How do you add context senstive menu to NSOutlineView (ie right click menu)

How do you add the ability to right click on a row in an NSOutlineView so you can say delete an object or some other activity. (ie Like when you right click on a folder in the Apple Mail app) I think I am half way there, I have a subclass of NSOutlineView that allows me to catch the right click and display a context menu based on the se...

Status bar on bottom of window that looks like interface builder

In interface builder and finder, there are windows with a status bar on the bottom of the window that has a neat greyscale effect. What is the correct/proper way to achieve this affect? Is it a built in interface element or is it done by embedding an image? ...

iPhone dev - How far down should I cast?

If I have a method that passes an argument of type void * (UIView animation did stop method, has to be a void pointer), or of type id, and I know that the argument is a UIBarButton item, and I need to disable it, [barbuttonitem setEnabled:NO];, should I cast the argument to a UIControl, which is as far as I need to be able to use setEnab...

Timing? - cocoa

Hi guys, How would I be able to use timers? For example I want to show a certain text for 10 seconds and then I want to show a different text for the rest of the duration. Thanks, Kevin ...

iPhone dev - delegates, notifications, unsubscribe before deallocated?

In my question about using a delegate or a UIControl Event, this was in Kendall Helmstetter Geln's answer: Both are about an equal load to work with - with a delegate you have to set yourself and then remember to unset yourself before you are deallocated. You have to do the same thing with notifications, remember to start listening a...

how to remove subviews from scrollview?

how do i remove all subviews from my scrollview... i have a uiview and a button above it in the scrollview something like this.... here is my code to add subview in scroll view -(void)AddOneButton:(NSInteger)myButtonTag { lastButtonNumber = lastButtonNumber + 1; if ((lastButtonNumber == 1) || ((lastButtonNumber%2) == 1)) { btnLeft = ...

How implement a UIActivityIndicatorView when the UIWebView is Loading? (iPhone ObjC)

I want to know how to implement an activityIndicator in a WebView based app, I wrote the following code but the indicator does not appear. The webview load file locally, so it load very fast, but when it load an external page it load slow and I need the indicator... FirstViewController.h #import <UIKit/UIKit.h> @interface FirstView...