objective-c

reading binary data (rtf) to string

Hello, I've been working on a core data program for a while now. I'm trying to combine attributes of an entity in a text view for saving to PDF and Printing. One of the attributes of the entity uses binary data. When I execute this: NSData *myData = [object valueForKey:@"cueNotes"]; ...it returns this: typedstreamè@ NSMutabl...

How can I retrieve the contents of a .key file?

I have a .key file that contains my consumer key and secret for the spotify API. The code is available for objective C but not for Actionscript 3 , where I need a hex string version of the key and secret. Most other APIs provide this (flickr, evernote, soundcloud, googlemaps, etc.) however spotify chose to put it into a fairly inaccessib...

Transform device orientation to world frame in objective c

Hi I'd like to transform the yaw, pitch and roll of the iPhone from the body frame to the world frame, i.e. azimuth, pitch and roll. On Android this is easily done with the SensorManager.remapCoordinateSystem(), SensorManager.getOrientation methods as detailed here: http://blog.mysticlakesoftware.com/2009/07/sensor-accelerometer-magnet...

Objective C - How do I use initWithCoder method?

I have the following method for my class which suppose to load the nib file and instantiate the object. - (id)initWithCoder:(NSCoder*)aDecoder { if(self = [super initWithCoder:aDecoder]) { // Do something } return self; } so based on this init method how do u instantiate an object of this class? The init method...

How to Loop my searches in iPhone dev?

My goals is search bar on top my table that searches the track_tiles in Dictionary. This table was built by Parsed data into an NSDictionary. My Dictionary for the table looks like... tracksDict: { "Cold Calling" = ( "<Track: 0x5f39bc0>", "<Track: 0x5f3a3e0>", "<Track: 0x5f3a990>", "<Track: 0x5f3...

iPhone - How should I write an init method ?

How should I write an init method for a class which is sub-classing an NSObject Let's say i have a class named : CustomButton subclassing UIButton I have an empty nib file named CustomButton.nib which has a single UIButton in it. IN interface builder the classname for the button is set to "CustomButton" How would you write an init me...

What's the best way to reverse communicate between view controllers?

I've been thinking about this and have read through another stackoverflow question regarding the best recommended way to communicate between view controllers. However, the question/answer for that doesn't seem to address the best approach for the reverse behavior. i.e. to pass data from ParentController to its ModalController, we could ...

Private interface vs. private method - objective c

Hi, What is the difference between a private method and a private interface? For example, I know that if you define a method in an implementation and its interface does not mention it, it is considered a private method. I have also seen things such as: @interface Collector() @property (readonly) NSMutableDictionary *count; @end Insid...

Objective-C : Call a method from another class in addTarget:action:forControlEvents

Hi everyone, Here is my problem : I want to assign an Event on an UIButton. I use this method : - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents like this : [newsButton addTarget:self action:@selector(myEvent2) forControlEvents:UIControlEventTouchUpInside]; newsButton is my UIButton...

myButton.frame not available why ?

hello all, i have a button when i try to write myButton. then if I click esc button there is not options or any intelligent result. thanks ...

CGPoint didn't get the coordination of my button

hello this is my code is it wrong - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Inside touchesBegan"); UITouch *touch = [[event touchesForView:self.view] anyObject]; CGPoint location = [touch locationInView:touch.view]; NSLog(@"pointx: %f pointy:%f", location.x, location.y); NSLog(@"a...

iPhone app crash when converting formatted NSString to UTF8 char *

I want to convert a NSString into a const char * in order to access a sqlite DB. This works: NSString *queryStatementNS = @"select title from article limit 10"; const char *queryStatement = [queryStatementNS UTF8String]; This causes a crash in the simulator (without any stacktrace): NSString *queryStatementNS = [NSString stringWithF...

Optical character recognition on the iPhone

Is it possible on an iPhone app to take a picture and extract an string from the picture? We'd like to make our app to look for a serial number on a database (very long number) without the user having to type it. Is there any Cocoa/Objective-C API for this or any C/C++ library that can be used in an iPhone app? Thanks in advance! ...

Evaluating every conditional statement on an if... else if... block

Does Objective-C evaluate every statement on an if... else if... block or does it evaluate each as it comes to them and then skip the remaining evaluations if a true condition has been found? This is more of a pragmatic question related to performance than anything else. And yes I do know that the content of the if block itself isn't e...

MPMoviePlayer load and play movie saved in app documents

I am writing an application that stores the movies in the photo roll into the local documents folder for the app. I can play remote movies using the MPMoviePlayer, however trying to play a movie stored in the documents folder for the app always returns MPMovieLoadStateUnknown. The notifications are all getting sent and received from th...

How do you tell whether you need to release an object?

Can you describe the naming convention difference between a method that returns an object it has allocated for the caller (and that the caller should release), and a method that returns an autorelease object? If you declare a property with a retain attribute, do you need to release the property before you set it to nil? What does the ...

Can I change name displayed in Spotlight search results?

I am writing a Spotlight importer for an application that stores content in files with meaningless names. There is benefit from allowing the user to search for these files, however. It's easy enough to write an importer that extracts and returns useful metadata but when the user does a search in Spotlight they are presented with the m...

2 touches problem

hello all recently i used this codes to handle drag touches : - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event but my problem when the user touches 2 buttons at the same time only one cal...

iPhone Core data entity lookup

I have a very simple problem that i'm sure has a simple solution, but after searching the internet for 2 days I can't find anything on it =( Here is the situation: I have decided to break my data into 2 sperate entities with a one-to-one relationship. So I have the PERSON entity and FEATURES entity. each PERSON has a related FEATURES en...

resetting audio and animation if the view is changed

I have a view that plays an animation and an audio clip. if the user leaves the view and then returns the audio replays from the point where they left the view. I simply want the audio and the animation to start over as if it was their first time coming to the view. so the audio would stop and the animation would stop. then the viewDid...