objective-c

How to use fopen from a C library while Using iPhone SDK...

Hello, I apologize in advance if this has been addressed, but I have not found a specific answer as of yet. First, I am trying to use a C library in an iPhone/Cocoa touch app. It compiles fine as a plain C project and as a plain Foundation project (using X-code). My problems is this: The library uses a dictionary file which is called d...

Python, Ruby or Objective-C for newbies

I'm a Web designer who want to start learning a new language, I'm familiar with C#, Asp.net and C and decided to choose between Python Ruby Objective-C I need to learn this because of academic reason and I'll use this to implement some small project at university , I'm really free to choose and I have no idea about these. Here are 2...

NSOperation synchronization problem

Hi All, I am struggling to find a way to synchronize operation on IPhone app. I have three main NSOperation. NSInvocationOperation *showSpinner = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(spinnerOn:) object:YES]; NSInvocationOperation *reloadDatasource = [[NSInvocationOperation alloc] initWithTarget:...

re-playing 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. I thought I had solved it with the following code: -(void)viewWillDis...

Multiple Tags on a UIImageView ?

Hi all, Is it possible to have more than one tag associated with a UIImageView ? Cheers, Martin ...

Release a listener / observer in Objective-C?

Hi guys! I'm not sure when it's the right moment to RELEASE a listener object. I have a object A that uses NSURLConnection's initWithRequest method to retrieve some URL. initWithRequest requires a delegate to listen after the events of dataReceived... So object A creates an object B and passes it as a delegate for initWithRequest metho...

Cocoa: Obtaining an image that's displayed in another application

One Google Chrome extension displays a window with an image once in a while, how can I get the image from it with Cocoa? Basically there is a window and image inside it, and I need that image for my program. Thanks for reading! ...

How to save and retry reporting GKAchievement's after network failure?

Apple states that if you want to report a GKAchievement but you get a network error, the best way to handle this is to save the GKAchievement (possibly adding it to an array), then periodically attempt to report the achievement. What is the best place to save the achievements? Would NSUserDefaults suffice, or would a property list be a ...

Issuing updates to iOS Beta testers

Hi I am wondering how i go about issuing updates to my app for Beta testers? My app relies on a plist stored in the app's Documents directory, which stores their data. If i change my version number to 1.1 for example and choose Share Application in Xcode, it will send the latest build and provisioning profile to my beta testers. My a...

Three20 : how to pass a class of objects between 2 views

Hi, I have a TTableView. The items in this table a mapped to an url, so that when I click on an item, another view appear with informations about this item. All these informations are attributes of a class. So, how can I build my TTableTextItem URL in order to transmit the class containing informations to the view responsible for the di...

NSSortDescriptor can't count numbers at all..

With this NSSortDescriptor *lessonDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lesson" ascending:YES]; [resultArray sortUsingDescriptors:[NSArray arrayWithObject:lessonDescriptor]]; it's sorting the "lesson"-objects to ( { lesson = 9; subject = bg; }, { lesson = 8; subject = bg; }, { lesso...

NSBundle pathForResource is NULL

Hi, I'm creating a simple application with xcode and objc and I need to load an NSDictionary from a file, but I can't get the path to the file using NSBundle: NSString *l = [[NSBundle mainBundle] pathForResource:@"LoginStatuses" ofType:@"plist"]; NSLog(@"%@", l); When I run this code I get this: 2010-10-16 10:42:42.42 Sample[5226:a0f...

UITableViewCell backgroundView image resizing?

Hello, I am using an image to display the whole content of a UITableViewCell and it's set using the backgroundView property. My problem is that it is always scaled to fit the cell. Is there a way to disable scaling in this case, so I can provide the 480 pixel version only and it just gets cropped when orientation is portrait? I'm doin...

Convert NSData to NSString and ignore null bytes?

I need to convert a NSData object to an NSString. It is meant to be gibberish but I need it for debbuging. When I use NSString's initWithData, it breaks as the data has NULL bytes. How can I make it ignore the null bytes and get a proper string? ...

How to change title of more tab item?

I searched a lot of web-site about this topic and try some solutions: 1)Changing navigationItem title I changed navigationItem title but More tabItem is not changed. 2)Changing tabbarItem title [tabBarController moreNavigationController].tabBarItem.title = @"Morre"; It didnt work either. 3)Creating a new tabbarItem and assigning t...

Best practice of copying and serializing Quartz references

I have objects containing Quartz-2D references (describing colors, fill patterns, gradients and shadows) in Cocoa. I would like to implement the NSCoding protocol in my objects and thus need to serialize those opaque Quartz-2D structures. Possible solutions might be: Define a set of properties in my objects that allow to setup the dat...

Singleton Integer Issue

Hi I have a singleton which I hold a single integer in, my score. However when I load it form the singleton in a another view it doesn't show what I want but instead sticks at a wired 6592960. Any ideas why? Something to do with how I am using @property Im thinking, what the correct way to @property an int? Thanks. EDIT: Code: Singlet...

jQuery offset() issue in UIWebView

I’m working on an app that uses a UIWebView to render content. This webview is in a UIScrollView which, when the user scrolls near the top (or bottom), will append another webview above(/below) the visible one in the scrollview (i.e. pseudo-infinite scrolling). I’m computing the offset of various elements in the WebView with jQuery’s .o...

Open a PDF document on iPhone

is UIWebView the only way to open a pdf document on the iphone? how can i interact with the document? eg: getting the current page number? ...

Cannot add category to AVAudioPlayer

I'm trying to add a category to AVAudioPlayer but I keep getting the error "Cannot find interface declaration for 'AVAudioPlayer'". AVAudioPlayer+Fade.h #import <AVFoundation/AVFoundation.h> @interface AVAudioPlayer (Fade) - (void)fadeToVolume:(CGFloat)volume; @end AVAudioPlayer+Fade.m @implementation AVAudioPlayer (Fade) - (voi...