objective-c

Draw part of a circle

For an iPhone application I want to draw a circle, that is only for an x percentage filled. Something like this: I have no problems calculating the radius, the degrees or the radians, that is no problem. Also drawing the circle is already done. But how do I get the iPhone SDK to draw the part that is filled. I can draw a rectangle t...

NSDictionary into a NSInputStream

Hi there Is it possible to put in my NSDictionary into a NSInputStream? This would be my NSDictionary NSArray *keys = [NSArray arrayWithObjects:@"name", @"device_token", @"identifier", nil]; NSArray *values = [NSArray arrayWithObjects:@"Test iPhone", initDeviceToken, [UIDevice currentDevice].uniqueIdentifier, nil]; NSDictionary *parame...

Is NSMutableString's -appendString: method an efficient way to build up a large string?

I'm planning on building up a potentially large string by iterating over a collection and generating chunks at a time. If I were to simply start with an NSMutableString and repeatedly append chunks to it, does that work reasonably efficiently or is it a Schlemiel the Painter situation? It seems plausible to me that NSMutableString is imp...

cast textfield value to double

i want to sum to values which i get from a textfiel. how can i cast a textfield value in double value ? Regards Caglar ...

App Quits, No Stacktrace and Intermittent: How to debug? (iOS)

Yesterday I ran into a situation (which I resolved by studying my code a lot) where the app would start and then blow up at some point in the start sequence. This would be a breeze to troubleshoot except that there was no stacktrace whatsoever. Debugging and stepping through line-by-line caused the problem to go away, and it was intermit...

Proper way to start/continue runloop

While I usually make use of NSOperation for having a thread do a short task/operation, I'd like to have a long-living dedicated thread that is always available to process certain operations. For this, I allocate a new NSThread and use the initWithTarget method: - (id)initWithTarget:(id)target selector:(SEL)selector object:(id)argument...

switching between silent mode and ringmode in iphone

hi all is it possible to switch from silentmode to ring mode (vice versa) in iphone programatically? Thanks in advance Regards appleDE ...

Include a '%' in an NSString?

How can I include a percent symbol (%) in my NSString? [NSString stringWithFormat:@"Downloading (%1.0%)", percentage] The above code does not include the last percent in the string. ...

Converting NSImage to CIImage without degraded quality

Hello, I am trying to convert an NSImage to a CIImage. When I do this, there seems to be a huge loss in image quality. I think it is because of the "TIFFRepresentation". Does anyone have a better method? Thanks a lot. NSImage *image = [[NSImage alloc] initWithData:[someSource dataRepresentation]]; NSData * tiffData = [image TIFFRepres...

can anyone work out why my app is crashing when i move the slider

When i move the slider it crashes the app. i know it is something to do with the argument i am passing to maxProcess method. it works fine if i take this out. but i need it to update the newEvent objects instance variable. Any ideas. This is what i have been told in another forum but i don;t know how to do this "this code declares a new...

How frequently touch events fired on iPhone?

How frequently touch events are supplied to the top-most application? For instance, touch, drag finger around screen (for 1 second), release <- how many discrete samples do i get? edit: What's the maximum? And will it be different for different generations of iPhone and different OS versions? ...

Writing a Snow Leopard Service for Finder.app

I am currently looking into solving the problem with the inability to quickly create new files in the Finder. I will open source what I write because I think the Mac community needs this solved. On Windows, you can right-click, create new text file. OS X, you should be able to do this with a service which would work like this: Right-...

How to find out which file gets run first in XCode

In an XCode project that has a lot of h and m files, how do you find out which file gets executed first? ...

How can I programmatically launch Contacts.app on the iPhone

I would like to launch the Contacts.app when the user needs to add a contact. My app already reads from the contact API. I would rather not re-implement functionality if I can avoid it. I am targeting iOS 4.0 and above. ...

What is a good name for an instance method that adds a linked-list node after the target?

I'm creating a doubly-linked list in Objective-C. I would like my node class to include an instance method that allows me to add another node after the target node, like so: // start <-> nodeA <-> nodeB <-> nodeC <-> end Node * newNode = [Node node]; [NodeB thisMethodNeedsAGoodName:newNode]; // start <-> nodeA <-> nodeB <-> newNode <-...

Duplicate symbol between two libraries

Hello, I have the following problem: I'm linking against the Admob library which contains some part of the GData API. But I also want to link with the GData static library to use it directly in my own application. Of course, I get duplicate symbols at link time. How can I avoid that? ...

how to get elements having particular name from a NSMutableArray ?

I have a NSMutableArray consisting of several elements. From this array I want to pick out only those elements that contains the word "example" in any form (words such as exampleId, putexample or getexampleId). How can this be done? ...

IPhone image with clickable hotspots.

Hi, I'd like to know how to implement a clickable image for an iPhone application using objective C. I want this image to be clickable at specific areas even when it is rotated. If for instance the top of an image goes to page A, and this gets rotated clockwise by 90 degrees I want this clickable area to change accordingly. Is this pos...

i found an error in this invalid operand to binary +(have id * char *)

NSString *queryString = [NSString stringWithFormat:@"http://202.164.43.57:82/iphoneWebservice/Service1.asmx/" + "GetData?InsertData=%@", imageView.image]; ...

How to access a member object

I have made a custom object called students that has two nsstring object. One is for the name and the other for the student id. If I try to pass the custom object to something that takes nsstring, it doesn't work. I want to pass the name. How can I do this? ...