objective-c

In wich way can i debug "accessoryDidDisconnect" notification if unplug the external device?(EAAccesory Framework))

Hi, i'm starting with EAAccessory framework and i don't know in wich way can i debug this method if unplug the external device: - (void)_accessoryDidDisconnect:(NSNotification *)notification Obvisouly xcode gave me an error for the disconnection of the iPhone and i can't enter in the method. Thanks ...

iBooks like PDF reader for iPhone

Does anyone know of an open source project or code samples that works like the PDF reader in iBooks? ...

Mapkit accessory button issue

im trying to get the index of the annotation when the disclosure button is tapped using the (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { i have been pointed to the control.tag property, but whenever i use NSLog(@"tag value from control: %d", control.t...

Cocoa - iTunes track Persistent IDs - Scripting Bridge vs Distributed Notifications

Hello, I'm writing some Cocoa code and having trouble with the iTunes track persistent IDs returned by Scripting Bridge and Distributed Notifications. Taking one track as an example - in a Scripting Bridge call I get the following values: Persistent ID: 2FBA59E028DC5E51 (NSString) - Hexadecimal? ...but from a Distributed Notificatio...

Resetting a view

When the user navigates to a different view and returns back to the original view I would like everything to be reset as though they were coming to the view for the first time. I was able to stop the audio from playing when they leave, but not an animation method. how would I be able to do this? -(void)viewWillDisappear:(BOOL)animated ...

How can I rename my project?

I have a lot of code that I've written, and finally have come up with the correct branding. How can I rename my project and app in XCode? ...

How can I get the object of an Event in objective-c?

I would like to know which element was under the finger, when the touch event was called. Got this event-method: - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {} I know how to get the object with custom events: for example: -(void)onThumbnailClicked:(NSNotification *)notification { //Image-Class has been ins...

"initializer element is not constant" when declaring an array

Hello, This is how I declare my array : NSArray *atouts = [[NSArray alloc] arrayWithObjects:@"1",@"2",nil]; but I'm getting : Initializer element is not constant What would be the best way to declare a static array then ? ...

Objective-C blocks -- EXC_BAD_ACCESS if I call block directly?

Continuing to try to understand blocks in Objective-C. I have the following function: typedef void(^TAnimation)(void); TAnimation makeAnim(UIView *aView, CGFloat angle, CGFloat x, CGFloat y, CGFloat width, CGFloat height, UIInterfaceOrientation uiio) { return Block_copy(^{ aView.transform = CGAffineTrans...

NSDocument get real save path?

Hey guys, I am trying to get the path that an NSDocument is being saved to at save time. I tried overriding writeToURL but that would pass me an obscure temp file URL, which was not where it was getting saved. Also asking the document like this [document fileURL] only works after it has been saved. I can get the path when it is loaded bu...

Is there a View Controller to show thumbnails like the Photos app?

I am looking to replicate the image gallery view that shows thumbnails, like in the photos app on the iPhone. Is there a view controller or any examples that anyone can provide to replicate this? ...

How to unrar/unzip with Objective-C, including single file retrieval

I have a need to handle various rar/zip files, in Objective-C. Ideally I'd like to be as flexible as possible in terms of rar/zip versions. I'd also like to be able to only extract certain files from the rar/zip files, after pulling out a list of the file contents. If that wasn't enough, I'd like to be able to access and modify the zip ...

Correct time to delete persistent store to delete all entries of an entity

Hi, I am using an UITableViewController containing a UITableView and an UISearchTableView. The table lists e.g. 1000 entries. I want to provide the user a button to delete all entries of a specific entity. Because looping over all managed objects and saving the context takes a very long time, I thought of deleting by removing the persi...

Problem parsing following JSON with JSON Framework

I have the following json: { "response": { "status": 200 }, "user": { "flex_meta": { "layout": "[{\"windows\":[{\"type\":\"stream\",\"width\":260,\"x\":268,\"height\":763,\"y\":0,\"relatedDataObject\":{\"name\":\"watch\",\"id\":3190},\"arg\":\"watchlist:3190\"},{\"type\":\"rss\",\"width\":260,\"x...

Breaking a for loop during enumeration (Objective C)

I'm enumerating a dictionary and checking for a known date. If the exact date (both date and time) matches my known date, I want the for loop to stop enumerating. THe issue I'm having is that during the check, I break out of the if statement instead of the for loop. //known date has already been applied to self.knownDate for (id objec...

Basic Objective-C Pointer Question

#import <Foundation/Foundation.h> BOOL areIntsDifferent( int thing1, int thing2 ) { if (thing1 == thing2) { return (NO); } else { return (YES); } } NSString *boolString (BOOL yesNo) { if (yesNo == NO) { return( @"NO" ); } else { return( @"YES" ); } } int main (int argc, const cha...

Basic Objective-C Pointer Question

Possible Duplicate: Basic Objective-C Pointer Question #import <Foundation/Foundation.h> BOOL areIntsDifferent( int thing1, int thing2 ) { if (thing1 == thing2) { return (NO); } else { return (YES); } } NSString *boolString (BOOL yesNo) { if (yesNo == NO) { return( @"NO" ); } else { return( @"YES" ); } } int m...

How to take data from a string and make it into a pointer to an image

Alright, so I am working on a simple card game for Mac OS X. The way I have it set up is with a Card class that holds its own suit and rank, and methods that returns these as NSStrings. What I currently have is a method that pulls random cards out of an array that is the "deck" and puts them into another array that is the player's "hand"...

How to set NSManagedObjectID manually?

I want to sync the Core Data on iPhone with MongoDB on Sinatra server. When the iPhone gets a message from the Node.js chat server, the message contains the sender's BSON ObjectId (a string). For the iPhone to store this message, I find the user with that same Id in Core Data. I want to be able to do something like objectWithID. In othe...

How can I make an NSImage into a button

Is it possible to make it so that the user can click on an NSImage and trigger an action? How can I do this, through Interface Builder or programmatically? ...