objective-c

UIButton not being clicked in iPhone programming.

Hello, I've created a UIButton on a view and on action of the UIButton[UIButton* button1_obj] one more button[UIButton* button2_obj] is created on same view. i'm facing these 2 issues...please guide me how to proceed. button1_obj is appearing when i run my project, but its not being clicked or highlighted, nor any exception is thrown...

How can we change color of a text programmatically ?

My code is -(UIImage *)addText:(UIImage *)img text:(NSString *)text1 { int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(cont...

Searchbar attached to top of keyboard in Objective-C

Does anyone know how, in Objective-C on the iPhone, to bring up a keyboard with a search bar connected to the top of the keyboard? ...

How to get colliding effect or bouncy when ball hits the track.

** STILL NOT WORKING ** I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius (I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect...

How can I call a method written in class1 to class2 ?

I have class1.m . I declared a method and written in it. Now i need to call it into another class. How can I make it? Can we use extern for it like we use for variables. Thank you. ...

For what programs are Objective C and Ruby ideal on the Mac?

Hi, as a Mac outsider it seems that two popular programming languages on the Mac appear to be Objective C and Ruby. From what I understand the main API Cocoa seems to be written in and optimized for Objective C, but it is also possible to use Ruby for that. Are there different areas where each language is ideal, for example, I could im...

Problems with NSButtonCell action

For some reason the NSButtonCell for my table view is passing the wrong object as a parameter. I am trying to read the tag of the NSButtonCell after it is clicked. Here is a simplified version of my code: - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return 3; } - (void)tableView:(NSTableView *)aTableView willDisplayC...

Access property name (e.g. self.theProperty) in ObjC

I'm trying to read property name but I'm not shore how. Is it possible in ObjC to get string "theProperty" from self.theProperty? I know how to read all properties (with "class_copyPropertyList") and their names (with "property_getName") but couldn't find a way to do something like: NSString *text = [self.theProperty somehowReadTheProp...

EXC_BAD_INSTRUCTION (SIGILL) at random during use of app. Bug in AppKit?

I'm currently testing a new version of an app of mine on OSX 10.5 An user reported some weird crashes during use of the application, sadly not reproducible by me. At first sight it seems to happen randomly, once he had the crash while opening an NSOpenPanel and once during focusing an NSTextField and once during NSView switch in a parent...

What language/API to use for a standalone live-input audio visualizer app?

I develop with Actionscript and was glad to see that AIR 2.0 was going to give access to mic input data. I planned to use this to create a visualizer set to the tempo of the incoming live audio. After doing a few days of google research it seems unlikely that it will be possible to analyze the data of the mic input in Flash/AIR. If anyon...

Where to put text files for iPhone UITextView

I have multiple UITextViews with corresponding .txt files. I'm reading them with NSString's stringWithContentsOfFile but I don't know the path where I should put my files. If I put it to /tmp/ on my Mac, it works in Simulator, but, of course, doesn't work on the actual device. So where should I put the files, so they'll work on both Si...

Nil pointer returned for [exifData tagValue:]

Hello, I'm trying to read EXIF data from pictures taken with the apple camera's application, containning EXIF informations. I use iphone-exif library available at http://code.google.com/p/iphone-exif/. My problem is that I succes getting tag informations with [exifData tagDefinition:] function : EXFTag* tag = [exifData tagDefinition:[N...

Elegant and 'correct' multiton implementation in Objective C?

Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically 'disallowed' use of alloc and allocWithZone: because the decision to allocate or not allocate memory needs to be done based on a key. I know for sure that I need to work with only two instances, so I'm using 'switch-case' instead of a map....

How to efficiently show many Images? (iPhone programming)

In my application I needed something like a particle system so I did the following: While the application initializes I load a UIImage laserImage = [UIImage imageNamed:@"laser.png"]; UIImage *laserImage is declared in the Interface of my Controller. Now every time I need a new particle this code makes one: // add new Laserimage ...

Corrupt iPhone App Name

I've done an adhoc build to test an application, but when I drag it into iTunes to add to my devices it is getting a corrupt name. It comes up with the name "Myapp Name <!DOCTYPE plist PUBLIC "-//APPLE//DTD PLIST 1.0//EN" http://www.apple.com/DTDs/PropertyList-1.0.dtd">" which continues with the whole plist I've tried the obvious, cle...

objective-C : Change a UIImage programatically

hi, i have 2 UIImage and a UISwitch, when the switch is on, image 1 appear and when the switch is off the image 2 appear... any ideas? thanks ...

Get EXEC_BAD_ACCESS when I get the NSFileModificationDate

Hi everyone, I try to get the last modification date of a file: NSFileManager *fm = [[NSFileManager alloc] init]; NSError *err; NSDate *lastModif = [[fm attributesOfItemAtPath:filename error:&err] objectForKey:NSFileModificationDate];//filename is ok ;-) if(err == nil) { [lastModif retain]; //I can put a NSLog of lastModif here...

Different cells in NSTableView together with bindings

Hi, im working on a nstableview that contains information for some properties that are dynamicly created. Each row contains some cells that are common (name for example), but in one column they have different cells. Some properties will have NSSliderCell, other NSButtonCell etc. All of this is binded up to a NSDictionaryController. I've ...

how to make UIAlertView with custom font , height and width?

Hi All, I want to show pop up of question with it's options. Each question have 3 options. Currently the text is not fitting in the UIAlertView. My UIalertView is in landscape mode. my questions are, 1) How to change the font and font size of UIAlertView message and Button? 2) How to increase the height and width of UIAlertView? OR...

How to speed up drawing of scaled image? Audio playback chokes during window resize.

I am writing an audio player for OSX. One view is a custom view that displays a waveform. The waveform is stored as a instance variable of type NSImage with an NSBitmapImageRep. The view also displays a progress indicator (a thick red line). Therefore, it is updated/redrawn every 30 milliseconds. Since it takes a rather long time to rec...