objective-c

UITabBarController and UINavigationController Interaction

I have an app with a tab bar with two tabs. One tab displays a UINavigationController, the other a UIViewController that I have customized. What I have noticed is that if switch tabs to the UINavigationController tab then navigate a few levels deep in UITableViews, if I click on the current tab on the UITabBar the UINavigationControlle...

Array is empty after calling method

Hi, everytime I call the method -(void)setArrayCheckOut:(int)num in another class the array arrayCheckout is empty. Calling -(IBAction)reloadTable:(id)sender after -(void)setArrayCheckOut:(int)num "results in reload table - (null), 0". Any idea what goes wrong? so long @implementation CheckOut -(id)init { [super init]; tableCheckOu...

stringWithFormat: with unknown datatype

I am making a framework and I have this code (conditions is an NSDictionary): for (NSString *key in conditions) { id value = [[conditions valueForKey:key] retain]; // Check if number or string if ([value class] == [NSString class]) { conditionsString = [NSString stringWithFormat:@"%@='%@' ", key, value]; } else {...

When I use a .xib file to layout my viewController IBOutlets aren't being released when the view controller is released

I use a .xib to layout my viewController and have 10 IBOutlet objects that IB uses, none of them have @properties assigned to them (no @property(retain) IBOutlet...). When I release the viewController none of those objects are being released, I have to manually release them in the dealloc of the viewController. This doesn't seem like n...

Dismissing the keyboard using firstResponder

To dismiss the keyboard I use either one of the following: [sender dismissFirstResponder] [self dismissFirstResponder] The problem is, I have a situation where the user selects a text field, and some other text field is the first responder with the keyboard showing. I want to dismiss the keyboard when this particular text field is sel...

How to share an object between two class methods

I created an object in the method viewDidLoad:. In another method that I create, I want to access this object. One way to do it is to declare the object in the h file. Another way to do it is to pass it as a parameter. Are there any other ways? ...

CGImageCreateWithMask works great but the masked out area is black in my resulting image, how can I set it to be white?

I've masked out my image thusly: CGImageRef maskRef = [[UIImage imageNamed:@"testMask2.png"] CGImage]; CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef), CGImageGetHeight(maskRef), CGImageGetBitsPerComponent(maskRef), ...

How do I view the progress for converting a Movie with QTKit?

How do I view the progress for converting a Movie with the following QTKit code? NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], QTMovieExport, [NSNumber numberWithLong:kQTFileType3GPP], QTMovieExportType, nil]; [[movieView movie] writeToFile:@"/tmp/sample.3gp" ...

alloc and init what do they actually do

Can someone explain to me what init and alloc do in Obj-C. I am reading this obj-c book that gives an example of creating object but it does not really go into details of what it does. What does alloc return? what does init return? Animal * k = [Animal alloc]; k = [k init]; ...

Disabling user interaction on CCSprite or CCScene in cocos2d for Iphone

Hello, I am developing a game on Iphone using cocos2d. I have a CClayer containing 20 CCSprite. I am playing a sound and I would like to disable the touch events on all the CCSprite or on the entire layer while the sound is playing. I looked at the property of CCLayer called isTouchEnabled but the behavior doesn't propagate to the chil...

IphoneOS sockets example

Hello, I am trying to get a simple sockets program working on the Ipad. To do this I am using the CFStreamCreatePairWithSocketToHost command. It works fine on the simulator. The problem is that it does not work on the iPad (I checked connectivity issues using the iPad's safari, and everything seems fine). What I want to do is have the ...

Is there a version of GNU indent which supports Objective C?

If so where can I get it? ...

Objective C - How to access NSNotification inner objects?

I want to access a inner object from a notification. I need to get the key AVSystemController_AudioVolumeChangeReasonNotificationParameter. If I call [sender object] I get this output. But if I call [[sender object] userInfo] I only get "unrecognized selector sent to instance". Why is that? NSLog(@"%@", [sender object]) output: NS...

UIKeyboard extra keys.

I am looking for a way to add extra keys to a UITextView's keyboard or add a UIToolbar above it. How might I go about this? EDIT This is for an iPad app and if I was to add extra keys I would need a new row for them in the UIKeyboard. ...

How to write a Finder Plugin in Snow Leopard

Everywhere I look I see that writing a Finder Plugin in Snow Leopard is much easier than it was in Leopard. Can someone point me to some tutorial or simple code example I can download? I am trying to write a customer right-click menu item for Finder. TIA, Oren ...

How do I get a date or datetime out of an SQLite3 row?

There is no function as sqlite3_column_date which I need: int i = 0; for (NSString *key in [self valuesWithTypes]) { id value; if ([[[self valuesWithTypes] objectForKey:key] isKindOfClass:[NSString class]]) { value = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] autorelease]; } else if ([[[self v...

Show contextual menu on ctrl-click/right-click on header of NSTableView

Hi, I'm searching for an elegant way to detect a right-click/ctrl-click on the header of an NSTableView. When the right click occurs, I want to display an contextual menu. - (NSMenu *)menuForEvent:(NSEvent *) detects only right clicks in the table - not in the header of the table. thanks for your help. ...

Parsing multiple attributes in TouchXML

I'm in the making of an application where I'm using TouchXML to parse an XML containing airport flight information. The XML looks like this: <?xml version="1.0" encoding="iso-8859-1"?> <airport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://flydata.avinor.no/XmlFeed.xsd" name="OSL"> <fli...

Problems understanding authorization

Hi everybody, I'm having problems in understanding how to authorize my program to perform privileged tasks. I read the apple documentation and wrote this piece of code: AuthorizationRef myAuthorizationRef; OSStatus myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef); Au...

warning: incompatible Objective-C types assigning superClass to subClass

Assume a valid super class, and a valid subclass ie the classes work. the following line in a constructor of the subclass self = [super init] ; throws the following warning // warning: incompatible Objective-C types assigning 'struct Animal *', expected 'struct Cat *' Any ideas on how to fix this and remove the warning ? Cheers ...