objective-c

Objective-C Categories

If I add a category method to a class, such as NSXMLNode: @interface NXSMLNode (mycat) - (void)myFunc; @end Will this category method also be available in subclasses of NSXMLNode, such as NSXMLElement and NSXMLDocument? Or do I have to define and implement the method as a category in each class, leading to code duplication? ...

EXC_BAD_ACCESS when debugging

I'm getting this error when trying to see the contents of a NSMutableArray: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000021 0x94d5a688 in objc_msgSend () ViewController.h: @interface PeopleViewController : UITableViewController { NSMutableArray *people; } @p...

unwanted (transparent) "border" around UITableView when (programatically) placed in UINavigationControl

Hi there. On selecting a cell in a UITableView (which itself is placed on the rootView of a UINavigationController) I push a new SubviewController (which has another TableView as its view) onto the NavigationController. It all works fine, but when it gets displayed it has a transparent Border around it (the same width on all the sides)....

Define __MyCompanyName__ in XCode per project?

I've seen how to define the __MyCompanyName__ macro value that displays in all header comments in XCode by defining it globally via a terminal command: defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{"ORGANIZATIONNAME" = "My Company";}' However, I do work under multiple company names and would like an easy way to sw...

Best practices when importing class files in xcode

I'm working with xcode and I have classes associated with other projects that I want to be included in new projects. I realize that the #import will do the job technically (although what should i do if it's out of the project root folder). But what do I do if I want to include the class "properly" --basically so i can double click and ed...

Reusing objects in loop when adding to an NSMutableArray

When adding objects to an NSMutableArray in a loop, what are some best practices as to reuse memory allocated for objects that are to be added to the array? For example: for (int i = 0; i < 5; i++) { SampleObject *sampleObject = [[SampleObject alloc] init]; sampleObject.someProperty = ... [sampleObjectArray addObject:sampl...

iPhone app, Singletons, passing messages between ViewControllers & application design

Hi, I'm working on my first app now and it's going quite well, but I'm wondering if i'm using the correct app design. I'm building an app which makes use of a navigationController to display a couple viewcontrollers. In the first viewController a CustomObject is created and in the consecutive viewControllers properties for this custom...

Loading Preferences in to a Mac Kernel Extension

Greetings! I am working on a kernel extension driver for OSX. It is a simple keyboard filter. I have preferences that are set through a preference pane regarding how this filter will act. I need to take the preferences from this preference pane and load them in to the kernel extension. I have googled all over and haven't found anything...

Check if a BOOL is set (can't be done with ==nil)

how do i check if a BOOL is set in objective-c (iphone)? i know that it can be done with an int or float this way: NSNumber *Num = [prefs floatForKey:@"key"]; for example ...

TextField text to float (Objective-C)

How do I convert the text inside of a TextField to a float in Objective-C? ...

Detecting touches on a NSOpenGLView

I have added an NSOpenGLView to my MainMenu.xib file, and have implemented drawRect to draw to it, this works great, so far so good. How do I detect touches on the screen? I imagine I could perhaps dump some transparent buttons or something over the NSOpenGLView area in Interface Builder? The application is simple, i just need to know ...

Parsing XML for iPhone (aMule downloads/ search results)

I am currently working on a software to control aMule status of my server through the iPhone, i created a socket that spits out xml which should be parsed out, but because NSXMLParser is event-drive, i'm having problems in understanding how this could work... I thought of this type of XML structure, if you have ideas of a better way to s...

Creating autorelease objects in iPhone Development

I have a requirement to create some NSDecimalNumber objects objects as part of my application (as I require the precision of calculation they offer) but I note that in calculations they return NSDecimalNumber objects which are, presumably, autoreleased. My question is really whether this is potentially problematic in an iPhone applicat...

make mac package/bundle programmatically.

through terminal you can make it with a command - "SetFile -a B filename" programmatically i think i should set one of the attributes through [[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:NO attributes:attributes error:nil]; but i can't find witch one. thanks) ...

Informal Protocol In objective-C?

I was wondering if someone can explain what is informal protocols in Objective C? I try to understand it on apple documentation and some other books but my head is still spinning so i will really appreciate that if someone can explain with example. Thanks. ...

iPhone Facebook Connect logout crash after changing views

I've implemented Facebook Connect in my app just like the sample app that Facebook provides and it works well. After a user chooses to share data via Facebook they are taken to a new view and presented with the FB login dialog. When the user is done they exit the FB sharing view and return to my app's previous view. The user stays logged...

How to save state of UIScrollView?

This has me stumped. I'm trying to figure out how to save the state of a UIScrollView. For example, I have several images in a UIScrollView that are loaded like so: NSUInteger i; for (i = 1; i <= kNumImages; i++) { NSString *imageName = [NSString stringWithFormat:@"image%d.jpg", i]; UIImage *image = [UIImage imageNamed:image...

Hide Shutter in UIImagePickerController

I have designed an iris shutter animation for a camera view in an iPhone app. Unfortunately, it seems impossible to hide Apple's shutter when the view appears, even if I hide the camera controls and create a custom cameraOverlayView. I have gotten around this by animating my shutter on top of the normal shutter when the view appears, u...

Youtube API for iphone?

Hello folks, I was looking for some YouTube API implementation on iPhone but couldnt find and good resources. I just want to know how to initialize the connection and call the function to display the list of youtube videos. Can anyone help me out... Any code will be very helpful... Thanx in advance... ...

Objective-C: testing for an unassigned (undefined) variable?

If I've created these two variables: NSDecimalNumber *myNum; NSString *myString; how do I later test whether an object has been assigned to them yet or not? Thanks ...