objective-c

How to pass a variable through a selector?

I have a method -(void)myMethod:(MyObject*)obj And I am detaching a new thread [NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil]; How can I pass a MyObject* through @selector(myMethod)? ...

p4 cmd line client on OSX always throughs error when I try to get it to do something... p4v works fine

link-mbp:~ benb$ p4 Perforce client error: Connect to server failed; check $P4PORT. TCP connect to 1666 failed. connect: 1666: Connection refused link-mbp:~ benb$ though when I check p4 set it shows all the right data for those environment variables. thoughts? ...

Array of pointers in objective-c

I'm getting confused by pointers in objective-c. Basically I have a bunch of static data in my code. static int dataSet0[2][2] = {{0, 1}, {2, 3}}; static int dataSet1[2][2] = {{4, 5}, {6, 7}}; And I want to have an array to index it all. dataSets[0]; //Would give me dataSet0... What should the type of dataSets be, and how would I...

Problem with playing a sound when a button is clicked.

in my code: #import "MyViewController.h" #import "AVFoundation/AVAudioPlayer.h" - (IBAction)playSound{ AVAudioPlayer *myExampleSound; NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"]; myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExampl...

Loading data from a dictionary of dictionaries into an array in Objective C for an iphone app

I have a UINavigationController consisting of a tableview I want to load some data into. I have a dictionary plist containing Dictionaries for each Train Line which in turn have dictionaries for each station with the relevant information along with one string lineName. I need to collect the station Names keys and add them to an array to...

how to get the popup keyboard to move along with the orientation of the iphone device.

hi im new i have a UITextView field on a view and when i orientate the iphone to the right side the keyboard doestn move it stays horizontal. how do i make it move along? ...

Delay in playing sounds using AVAudioPlayer

-(IBAction)playSound{ AVAudioPlayer *myExampleSound; NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"]; myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL]; myExampleSound.delegate = self; [myExampleSound play]; } I want to play...

iphone orientation to the left rotates the background as the device rotates how to stop it?

ive set the shouldAutorotateToInterfaceOrientation to return to YES for orientation then i noticed as the iphone rotates the background rotates as well which is a UIImageView. how do i have the background fixed so it doesnt rotate? ...

Creating Custom Twitter Application.

Hi guys, I am trying to create a custom twitter application.But, I am not getting how to create. Any one help me to solve this. Thanks in advance. ...

Finding source of over release

Hi, I'm consistently seeing the same message sent in as a crash report from users of an app. It's clear that an object is being over-released but I'm unable to replicate it and I'm looking for tips on tracing the source of it. The relevant section from the crash report shows this: Application Specific Information: objc_msgSend() selec...

how to create a custom application in twitter?

Hi guys, I’m trying to register a custom application in twitter can any one give some suggestions how to register a custom application in twitter? As I am new to twitter I didn’t found any controls to create to register for creating a custom application. Anyone's help will be much appreciated. Thank you, Monish. ...

How to "eval" Objective-C code in iPhone

Hi, does a method such as "eval" in Javascript exist in Objective-C (iPhone SDK) ? I use PhoneGap and I want to create a window which is specific for each of my project and I can't use the html file... so I want from JS call a method and give in argument OC code to ben interpreted ... Any idea? Thank you for your help ...

Is single float assignment an atomic operation on the iPhone?

I assume that on a 32-bit device like the iPhone, assigning a short float is an atomic, thread-safe operation. I want to make sure it is. I have a C function that I want to call from an Objective-C thread, and I don't want to acquire a lock before calling it: void setFloatValue(float value) { globalFloat = value; } ...

delete last character UITextField

Hi ! I have an UITextField and I just would like that every tap on a character, the first character is deleted. So just have one character in my textField every time. Moreover I would to to display every tap in the console log. Have you got an idea? Thanks! ...

Cocoa: AVAudioRecorder Fails to Record

AVAudioSession *audioSession = [AVAudioSession sharedInstance]; NSError *err = nil; [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&err]; if(err){ NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]); return; } [audioSession setActive:YES error:&err]; err = nil; if(err){ ...

To add UIImage directly to file.

Hi, I want to add my UIImage directly into the file instead of converting into UIImagePNGRepresentation or UIImageJPGRepresentation(as it takes time) like:- UIImage *im = [UIImage imageWithCGImage:ref]; [array addObject:im]; NSData *data = [array objectAtIndex:i]; [data writeToFile:path atomically:YES]; But it is showing error. So the...

Setting ivar in objective-c from child view in the iPhone

Hi there! Maybe a FAQ at this website. I have a TableViewController that holds a form. In that form I have two fields (each in it's own cell): one to select who paid (single selection), and another to select people expense is paid for (multiple selection). Both fields open a new TableViewController included in an UINavigationControlle...

set label border in iphone

How can I set label's border which is dynamically generated (Not from Interface Builder)? ...

UIImageView Centering Problem.

To understand my problem let's follow this steps. Open - XCode -> New Project -> View based application. Open View Controller.xib file. Drag an image-view into viewController's view. Place that image view on center of viewController's view. Apply size of 125x125 to image-view. Take any image with dimension of 320 width & 460 height. Dr...

Indesign scripting - Save Copy

Hello, I'm using a Objective-C Scripting Bridge to communicate with InDesign CS3/CS4. Unfortunately I'm stuck on Save command which appears to be existing only as a part of the standard suite and not defined again in InDesign. Because of that it looks like I can Save, Save as but not Save Copy a document. Does anyone have any idea how to...