objective-c

Can I separate the delegate logic to one class file only?

I have many textfield, that only support using type "A"/"B"/"C" only, I wrote a textfield delegate to check the user input, including the length and the content that they inputed. But I want to separate the delegate from the class file. How can I do so? Thank you. ...

Using function pointer member variables within an Objective-C Class

Hi, (New to Objective-C, but well versed in C/C++). Presently I have an Objective-C class and a number of its member variables will be function pointers. These function pointers will only be modified by the class itself, but may be used by other classes. I'm not sure how to set up access to said function pointers. The solution I cur...

When not to alloc and init an NSString

Whenever I need to create a new NSString variable I always alloc and init it. It seems that there are times when you don't want to do this. How do you know when to alloc and init an NSString and when not to? ...

problem regarding inheritance concept in objective c

hi all i am new in objective c and want to get know about inheritance ... I am aware of all concepts but confused withe the methods that programmer used to inherit a class.... Let i explain my problem.... suppose i have two classes class A and class B... and i want to make B child of A.... for that sometimes programmer used #import "c...

Matching Strings in Objective C

I have a for loop which loops through an array and want to match a search field's text to an object in the array. I have the following code for (int i = 0; i < [data2 count]; i++) { if ([data2 objectAtIndex:i] == searchField.text) { NSLog(@"MATCH"); break; } } I know in Java it can be done by e.g. if(searchFi...

Duplicated project executable give "Data Formatters temporarily unavailable" error

I made a duplicate of my (working) executable without changing anything. Unfortunately, I am receiving the following error immediately and the emulator window doesn't appear: Data formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.) ...

Audio Broadcasting Live to internet

I am trying to develop an application related to Live Audio Broadcasting on internet.I already seen application like Ustream and ipadio.My query is How they are creating a web address to each users..?Is it a server side coading..?any information please ...? I Implemented AQRecorder.mm class to my application for recording and taking as a...

How to convert CFDataRef into NSData ?

How to convert CFDataRef into NSData ? I have CFDataRef and I want to convert it into NSData. I am not getting how to do this. anyone help me.. CGDataProviderRef dataProvider = CGImageGetDataProvider(screenShot); CFDataRef data = CGDataProviderCopyData(dataProvider); CGDataProviderRelease(dataProvider); NSString *imagePath...

objective c audio toolbox volume setting and balance problem

Hi guys, I'm trying to use kAudioHardwareServiceDeviceProperty_VirtualMasterVolume; to set the volume of the device. The docs says that "If the device has individual channel volume controls, this property applies to those identified by the device's preferred multichannel layout, or the preferred stereo pair if the device is stereo only...

Native Google Reader iPhone Application

I am currently in the process of building a native Google Reader iPhone application similar to the successful application "Reeder for iPhone", however, with a full Twitter client inbuilt as well. I have finished the Twitter client and am now struggling to start the Google Reader client. I've browsed through multiple documents and have t...

Possible to leak memory even when you code doesnt contrain an alloc/copy/retain ?

Possible Duplicate: Memory Leak according to Instruments I ran instruments on my code and it says I am leaking memory from one of my methods where I use substringWithRange. I checked my method and I use a couple of calls like the one below. NSInteger theValue = [[data substringWithRange:NSMakeRange(i-rangeCount,rangeCount)] ...

'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithFormat:locale:arguments:]: nil argument'

va_list arglist; if (!formatstring) return; va_start(arglist, formatstring); id outstring = [[[NSString alloc] initWithFormat:formatstring arguments:arglist] autorelease]; va_end(arglist); UIAlertView *av = [[[UIAlertView alloc] initWithTitle:outstring message:nil delegate:nil cancelButtonTitle:@"OK"otherButtonTitles:nil] autorelease];...

Is there any way to find out whether objective-c class is derived from another perticuliar class.

Hi, I want to create a plug-in system using objective-c. I am getting list of all classes in the main bundle and checking for classes derived from plug-in base. int count = objc_getClassList(NULL, 0); Class * buffer = (Class *)malloc(sizeof(Class) * count); objc_getClassList(buf, count); NSMutableArray * classNameArray = [NSM...

Objective-C synthesize property name overriding

Hi there, I am trying to understand the purpose of the synthesize directive with property name overriding. Say that I have an interface defined as follow: @interface Dummy ... { UILabel *_dummyLabel; } @property (retain, nonatomic) UILabel *dummyLabel; And in the implementation file, I have: @synthesize dummyLabel = _dummyLabel...

CCMenu animating

Hi, I'm trying to animate my CCMenu. CCSpriteFrameCache * cache = [CCSpriteFrameCache sharedSpriteFrameCache]; [cache addSpriteFramesWithFile:@"PlayButton.plist"]; CCAnimation * animation = [[CCAnimation alloc] initWithName:@"idle" delay:1/20.0]; for ( int i=1; i < 6; ++i ) { NSString * fname = [NSString strin...

Is it possible to stop a libxml parser while the process is running?

Hi all, I am using a libxml parser for quick downloading and display. My problem is in some cases I need to stop the parser while it is processing. Is it possible to do? Can you guys please suggest me on this. Thanks in advance, Sekhar Bethalam. ...

How to create a custom UIView that shows 5 stars

I have a requirement for a UIView that displays stars similar to the way one can rate albums in iTunes on the Mac and iPhone. Does anyone know what it would involve to create this or whether one is available online? ...

How to get unique values based on dictionary key, which is an element of an array in objective C ?

How to get unique values based on dictionary key, which is an element of an array in objective C ? for example: i am having an array of an Items aryItem aryItem[0] = Dictionary{ ItemCategory ItemName ItemPrice } aryItem[1] = Dictionary{ ItemCategory ...

Is it possible to extend an protocol like this?

I need to add some methods to the delegate protocol of my custom UITextField subclass. So I put this in the header: @protocol MyTextFieldDelegate (UITextFieldDelegate) - (void)textfieldDidSomething:(UITextField*)textField; @end Is this fine? ...

iphone memory management strange issue

This is a piece of code I had written in xcode Foo * myFoo = [[Foo alloc] init] ; [myFoo release] ; [myFoo printMessage] ; If I am right, it should give a runtime error when printmessage function is called as myFoo gets deallocated by that time. But in xcode , the code is working and print message is getting called, is it a problem d...