objective-c

how to release uiview added as subview in scrollview?

i have added a UIViewController's view and a button to scrollview as subview...now how do i release all instance of UIViewController's...here is an attached image in the view every uiview has a button over it for further navigation.... now i want to release uiview's and remove buttons from the scrollview ...here is my method to add su...

IBOutlet in Python

Hi all! Is there a way to use a Cocoa IBOutlet in Python? Or do I need to do this in ObjC? Thanks in advance. ...

iphone why is he using valueForKeyPath

Hi, I found some mapkit code on the internet that looks like this: - (void)recenterMap { NSArray *coordinates = [self.mapView valueForKeyPath:@"annotations.coordinate"]; CLLocationCoordinate2D maxCoord = {-90.0f, -180.0f}; CLLocationCoordinate2D minCoord = {90.0f, 180.0f}; for(NSValue *value in coordinates) { CLLocationCo...

How to kill a Thread with Objective C?

Hi there, I have a call to a third-party C++ library which I have put into its own thread (currently using NSThread). I would like to give the user the ability to stop the execution of that thread. (I am well aware of all the problems this might cause, but I still wish to do so.) According to Apple's Thread Programming Guide, there ar...

Error when trying to hide a button from a sound callback function when using AudioServicesAddSystemSoundCompletion

I'm trying to use a sound callback function to show a button once my sound file completes playing. //defining the callback AudioServicesAddSystemSoundCompletion (soundID, NULL, NULL, AudioPlaybackComplete, self.nextButton); Here's the callback function: static void AudioPlaybackComplete(SystemSoundID ssID, void *clientData) { NSL...

Wrapping a C Library with Objective-C - Function Pointers

Hey guys, I'm writing a wrapper around a C library in Objective-C. The library allows me to register callback functions when certain events occur. The register_callback_handler() function takes a function pointer as one of the parameters. My question to you gurus of programming is this: How can I represent an Objective-C method call /...

How to escape double quotes in string?

I'd like double quotes to appear within the following string so it looks like: "hi there == " Here's the code I'm using: NSMutableString *s = [[NSMutableString alloc] init]; [s appendString:@""""]; [s appendString:@"hi there == ""\n\r"]; Instead I only get: hi there == Any ideas? ...

Obj-C determing integer values with isKindOfClass

I need to check the type of each element in an array... for(id obj in items) { if([obj isKindOfClass:[NSString class]]) { //handle string case } else if([obj isKindOfClass:[NSInteger class]]) { //THIS LINE GIVES ERROR //handle int case } } Of course NSInteger is just an alias for int, so how can I check for ...

How to figure out at which position a string contains another string?

Is there a method that could tell for a string like "foo bar Foo Bar one two three" at which position the string "Foo" is contained, case sensitive? ...

How do I run a subset of OCUnit tests in XCode

I have a suite of unit tests that I use before checking in my project. However, very often it's the case that only one of them finds some regression in the code. In these cases I'd like to only run that particular unit test while debugging the failure. I haven't found any way to do this in XCode. Is it possible? ...

Play music using Objective C?

Hey all, I want to play music in my Objective-C program. How would I do that? I'm a noob, so please go easy. It's my 2nd program in Objective-C. Thanks, Kevin ...

Where can I find sample iPhone code?

Sample code is one of the most useful tools for learning about programming. There seem to be many sources on the web for iPhone sample code, but some are harder to find than others. Here's a collection of links I've found so far. Does anyone know of some other sources for iPhone sample code? Apple Sample Code: http://developer.apple.co...

How to increase/decrease an Unsigned Char?

I am trying to modify pixel values (8 bits per channel RGBA) by numerically increasing/decreasing the values by a certain amount. How can I do this in Objective-C or C? The following code generates a "Error: EXC_BAD_ACCESS" everytime. // Try to Increase RED by 50 for(int i = 0; i < myLength; i += 4) { //NSLog prints the values...

inheritance in objective C

i am new to objective C.is it possible multiple ,multilevel,hybrid,hierarchical,all types of inheritance in objective C? ...

Playing audio files on the iPhone

I've made a simple app, where I have a list of songs. The user taps a list entry and the song begins playing. I've lifted the SoundEffect class from Apple's sample projects (e.g. Metronome, BubbleLevel). It seems to work fine with the following code: // declare in the .h file SoundEffect *audio; // setup - when controller loads audi...

Cell not updating value as UISlider value changed

Hello all. I have a question that is driving me crazy. It is all about updating, in realtime, an UITableViewCell with the value of an UISlider that is inside another UITableViewCell. The problem The cell is updated but It seems that the size of the Label in the cell does not addapt to the size of the value represented. I will try to ...

Share NSArray Contents between multiple methods in a single class

What am I doing wrong? My code crashes when I try to log the array. Here is my class: @interface ArrayTestAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; NSArray *array; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) NSArray *array; -(IBAction)buttonPressed; @end @...

Presenting ViewController behind another one

I have image picker which collects data for another view controller (TTMessageController from three20) and I want this message composer to appear behind image picker, so when image piker slides out there will be already appeared message controller with pre-filled data. Code like this [self.navigationController presentModalViewControlle...

Trying to Write NSString sha1 function, but it's returning null

I have the following Objective-C function: +(NSString *)stringToSha1:(NSString *)str{ NSMutableData *dataToHash = [[NSMutableData alloc] init]; [dataToHash appendData:[str dataUsingEncoding:NSUTF8StringEncoding]]; unsigned char hashBytes[CC_SHA1_DIGEST_LENGTH]; CC_SHA1([dataToHash bytes], [dataToHash length], hashBytes)...

How can I make an image in a grouped tableview cell the width of the screen?

I have large images displayed in a grouped tableview. I would like the images to fill the entire width of the screen. I have been able to make this work using a tableViewCell interface builder, but in an attempt to improve performance I am now trying to do this programmatically. However, I have not been able to get the image to be flush...