objective-c

Locating the UIView that UITableView scrolls over

Hi all, I'm working on trying to obtain the UIView that UITableView scrolls over, if scrolling is enabled. Typically, the background is white, and if you push the UITableView out of its bounds, you'll see a background. I'm trying to set this background to a UIColor of blackColor. I can't seem to find the appropriate one to tag. I've tri...

Multiple recessed NSButtonCells in a custom control

I'm experimenting with creating a custom scope bar that uses recessed-style NSButtonCell objects. However, I'm having trouble drawing the bezel when the mouse is hovering. I can make it work by creating tracking areas and setting showsBorderOnlyWhileMouseInside to NO while the mouse is inside, and YES when it moves outside, but this fe...

Anonymous delegate implementation in Objective-C?

Is it possible to declare anonymous implementations of things like Delegates in Objective-C. I think I have the terminology right, but here's a java example: myClass.addListener(new FancyInterfaceListener({ void onListenerInterestingAction(Action a){ ....interesting stuff here } }); So for example to handle an UIAction...

iPhone Development: What kind of data structures are available?

This is a very newbie questions, but does the iPhone API provide any data structures to work with (i.e. linked list, hash map, etc.)? ...

IPhone UITableView missing disclosure-button after pressing Delete Button when reusing UITableViewCell

Hi, I've got an iPhone UITableView displaying custom UITableViewCells that display on their right the disclosure-button icon. When I swipe the cell, the disclosure button is automatically replaced by the red "Delete" button. If I press the "Delete" button the row is removed from the table, but then something strange happens. When I scro...

Multiple PickerViews in one View?

Hi PPL. I want to create 2 separate pickers in the same view using the same viewController. But how do I set separate delegates and datasource for them? Can't seem to get it working. They show up with the same data. If you have any sample code on this it will be much appreciated. Thanks. ...

iPhone, slide down help screen

I like the effect used in many iPhone apps where a semi-transparent help screen slides from the top (or bottom) on top of the current view to show hints or tips. This screen often has a close button as well as "don't show this again" button. What's the best approach to slide a view on top of the current view for such an effect? Any code...

What is the best explanation for the term "generic"?

I am looking for an good explanation, maybe with some examples. In my understanding, something is "generic" when it can be used for multiple purposes. But I may be wrong... ...

How to use a python api on iPhone?

There is an "Unofficial Plurk API in Python". Plurk is a twitter-like website. Can I use the API(python) from Objective-C? Or i have to port them? ...

How to detect a property return type in Objective-C

Hello, I have an object in objective-c at runtime, from which I only know the KVC key and I need to detect the return value type (e.g. I need to know if its an NSArray or NSMutableArray) of this property, how can I do that? ...

Objective C subclass that overrides a method in the superclass

In Objective C, if you are subclassing something, and are planning to override a method on the superclass, should you re-declare the superclass method in your subclass @interface? For example, if you are subclassing UIViewController (e.g. MyViewController), and you are planning to override "viewDidLoad" should you include that method in...

Playing short sound on timer end?

Hi... In my app I have a timer that counts down, and when it stops an image is displayed and a sound is played. The sound is loaded like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"scream" ofType:@"wav"]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID); And Played like this...

Objective-C: How to get class and runtime information?

Hi all, For debugging purposes, I'd like to display as much class information as I can, and possibly runtime information (which thread does the class/function run in, etc) into the console. Is there an easy way to do this with a function, variable or even (external) framework? P.S: I'm using Cocoa Touch. ...

Passing variables through classes in Objective-C

In my scenario I have 2 view controllers, one tied to the main view and one that is connected to the first one as a subview. Now let's say that my App Delegate class wants to pass a string to the subview controller. What is the best practice to achieve this? If I wanted to pass it to the 1st controller i could just say something like [...

KVO and Bindings problems using my own (not the shared) NSUserDefaults object

I'm subclassing NSUserDefaults in my application. A side effect of this is I can't use [NSUserDefaults sharedUserDefaults], I have to have a class method to provide my own static defaults object. This isn't been a problem in code, but it's proving tricky now that I'm hooking up the preferences UI with bindings. The shared NSUserDefaults...

What does the @package directive do in Objective-C?

Does anyone know exactly what the @package directive is used for in Objective-C? The only mention I could find of it in Programming in Objective-C 2.0 by Stephen Kochan was: @package - For 64 bit images, the instance variable can be accessed anywhere within the image that implements the class ... What? Is this restricted to being...

program access to iPhone volume buttons

Is there any way to subscribe to volume buttons press evens? ...

Problem with touchesMoved and drawRect.

I have a sticky bug that I can't seem to figure out, and I think it has something to do with the way touchesMoved is implemented. in touchesMoved, I check to see where the touch is (if statement) and then accordingly, call setNeedsDisplayWithRect on a 40 by 40 area near the touchpoint. What happens in DrawRect is that a black image ...

Cost of Including Header Files in Objective-C

This may seem like a really stupid question, but what is the cost of including (actually, calling #import) a header file in Objective-C? I get tired of constantly including the same headers in various locations, so I decided to simply create a GlobalReferences.h file that includes several commonly-referenced headers. Is there any apprec...

Best way to accomplish this drawing with Quartz 2D / Core Graphics?

As the background for one of the views in my app, I'd like to draw a fairly simple rectangular border just inside its frame. This would essentially be a rectangular gradient: a black line around the frame, fading to white about 10-20 pixels in. Unfortunately, as far as I can tell, Core Graphics doesn't provide rectangular gradients (eith...