objective-c

how to count tap in simulator ?

how do i count double tap in simulator? ...

Pinch Media - Core Location Optional

Will using PinchMedia and including Core Location frameworks make it unusable on the iPod Touch which doesn't have GPS? If so, is there a way to minimize this dependency since my actual application doesn't care? It would be nice to see, but basically I'm trying to use it to provide feedback from users on things they'd like to see improve...

Determining Which Instance Self Is

I have a gameboard with 25 tiles of NSView subclass myGameTile. In mouseDown: I want to figure out what tile I clicked on and set an ivar to that value. i.e. If I clicked on tile 12, set myTile to 12. My problem is figuring out in mouseDown: whether it belongs to instance 12 or instance 25. What ways are there to do this? ...

How does a delegate work in objective-C?

Does anyone know where I can find a good explanation/tutorial of what and how an application delegate works in objective-C? The two books I have don't dwell on delegates enough and do not explain them very well for me to truly understand their power and function. ...

iPhone - How to build a list of unique items

I want an array which contains only unique items. I know I could do this with an NSDictionary adding items with keys and then get allKeys. This would ensure that the NSArray contains only unique items, but I feel that this would be overkill and believe that there should be an easier way to do this, but cannot find one. ...

Control flow in Objective-C

I am working through Beginning iPhone Development. In the book is this method: -(void)playWinSound { NSString *path = [[NSBundle mainBundle] pathForResource:@"win" ofType:@"wav"]; SystemSoundID soundID; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID); AudioServicesPlaySystemSound (soun...

Getting a view to respond to a sibling's touch event / message

I'm sure there is a correct way to do this, I'm new to objective-c and cocoa touch so I don't know what it is. I have an application that has a (simplified) view hierarchy of Window --Button --Button --Subview --Sub-Subview What I'm trying to do is get the subview to do something in response to a touch event on one of the b...

iPhone NSArray from Dictionary of Dictionary values

I have a Dictionary of Dictionaries which is being returned to me in JSON format { "neverstart": { "color": 0, "count": 0, "uid": 32387, "id": 73129, "name": "neverstart" }, "dev": { "color": 0, "count": 1, "uid": 32387, "id": 72778, "name": "dev" }, "iphone...

localizing currencies in iphone app

I am testing my app. All is working fine except when I change locales to Germany. Basically you input 2 values in your local currency, a calculation happens and the user gets info back. Users numeric inputs are handled well. That is, on "Editing Did End" a method executes that converts the number to its local currency equivalent. So i...

Getting the POSIX path of the Finder's front window

Hi, How can I get the POSIX path of the Finder window that is currently at the top of its window list? Preferably with some kind of Cocoa framework but I am open for anything. Background: I would need this because I want to make a selection of files matching a regex pattern, starting recursively from this path. The idea is to use [[...

iPhone network performance

Hi all, I have a question and I am very open to suggestions (even very odd ones!) I am writing an iPhone app, which does a request (URL with parameters) to a server. As a response, the iPhone receives XML. All is well. Right now, I am looking to improve my application's speed by measuring the time it takes to perform certain tasks. I'...

Correct Structure to check for Errors using NSError

I'm coding up various routines and I'm trying my best to keep it neat and refactored. Methods I'm creating are starting to look similar to this code: -(IBAction)buttonPress:(id)sender { // Create Document Shopping List with this document [self doSomething:&error]; if(error) { [NSApp presentError:&error]; re...

Assigning a protocol to an NSMutableDIctionary?

Hi all, I am using a singleton backbone in my application to handle accuring errors. They will be handled inside the singleton and broadcast a notification throughout the app when the error has been fixed. Anyways this is not what my question is about but when I pass a new error to the singleton object like this [[SingletonErrors share...

How to intercept touches events on a MKMapView or UIWebView objects?

Hello, I'm not sure what i'm doing wrong but I try to catch touches on a MKMapView object. I subclassed it by creating the following class : #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewWithTouches : MKMapView { } - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event; @end And the implementa...

error: expected specifier-qualifier-list before 'GKPeerPickerController

I keep getting this message (in the title). Just take a quick look at my code if you want to see what I'm doing. I've just started implementing the Peer Picker, so I'm not completely done yet. I just need some advice/help in the first part. The error shows up in the .m file between the two #import statements, which means it has to be som...

How does one design the datasource for a UITableView in order to sort with a UISegmentedControl?

I am in the process of designing and coding an iPhone application to display movie times. I currently have a Movie Class which contains: NSString title NSSDate releaseDate NSSDate score My UI is a simple UINavigationController which has a segmented control as it's title and UITableView to display the Movies setup in Interface Builder...

Two finger swipe gesture

Apple has some sample code here under "detecting swipe gestures". I'd like to detect a two swipe gesture for my application but have no idea where to start. Surprisingly enough I wasn't able to find any samples/examples of similar code. Is there something inherently difficult about the code? Any links or tips you are willing to share wo...

Should I Use self Keyword (Properties) In The Implementation?

Hey guys. I believe I understand properties for the most part. My question is, if I have a property for an instance variable, and I am setting or retrieving it from within a method in my implementation file, should I use self.myProperty or just myProperty? I know either one works, but I have seen mixed conventions, sometimes code accesse...

How can you search in a UIWebView

I have a UIWebView with html data loaded in it Is it possible to use javascript to search for text in this view? Thanks for any answers ...

Simple Delegate Example?

Ok, I'm programming in objective-C and using Xcode. I have read through the documentation on Apple's website and understand what delegate's are but when I come to the part where it talks about how to actually implement delegate methods into code, I just become confused, especially when they say something like "now implement the delegate'...