objective-c

show content based on navigation route? UITable

Hello All, I have a table which I'm using as a menu. If my user navigates from a table cell titled "basic math" I want to show a text view with text being populated from an NSArray titled the same as the cell title...so basicmath.txt Can anyone point me in the right direction or tell me if this is at all possible? or am I barking up ...

@protocol extends @protocol

can @protocol extend @protocol ? @protocol Prot1 : Prot2 @end like in java: public interface Interface1 extends Interface2 { } ...

How to generically handle class objects that differ only by initialized properties?

I like the idea of abstracting CellControllers in a heterogeneous UITableView as suggested by Matt Gallagher. However in the case of typical push-detail-view behavior, I find myself creating nearly-identical variants of LinkRowCellController that differ only by the detail view controllers' init methods -- init:, initWithBook:, initWithMa...

Objective-C Method Parameters Problem

I'm attempting to define an extremely simple utility method that will save me from having to use a calculator to define RGB values as percentages. When I look into Apple's sample code called "QuartzCache", in the DrawView.m file, line 96, I see this: float whiteColor[4] = {1, 1, 1, 1}; However, when I attempt to created a method like ...

What is the proper way to access local variables in a delegate?

I'm trying to access an NSMutableArray which is a data member of my AppDelegate class. It is synthesized in the implementation, and is an array of a custom class which has a "name" NSString data member. I currently use it to fill a Table View (a SubView) like this: cell.textLabel.text = [[[delegate contentArray] objectAtIndex:indexPat...

Expandable Collections in Objective-C?

I was checking out this question which has this code - (NSArray *) percentagesRGBArray:(float[]) rgbArray { NSNumber *red = [NSNumber numberWithFloat:rgbArray[0] / 255]; NSNumber *green = [NSNumber numberWithFloat:rgbArray[1] / 255]; NSNumber *blue = [NSNumber numberWithFloat:rgbArray[2] / 255]; NSNumber *alpha = [NSNumb...

NSManagedObjects that I own being released by main.m?

First, in my root view controllers viewDidLoad, I initialize an NSDictionary with arrays of NSManagedObjects, like so: - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Decks"; UIBarButtonItem *browseButton = [[UIBarButtonItem alloc] initWithTitle:@"Browse" style:UIBarButtonItemStylePlain target:self action:@selecto...

Proper way to push a view controller

I have a UIViewController that I wish to push onto the stack, however, when I call [viewController release] on it after I push it, any time I pop it off of the stack however, I get various errors pertaining to deallocated instances of the view controller. Here is an example of an implementation: RootViewController *rootViewcontr...

Objective-C 2.0 dot notation - Class methods?

Please note I am specifically referring to the fact that dot notation is being used on class methods, not instance methods. Out of curiosity, I wanted to see what would happen if I tried to use Objective-C 2.0 dot notation syntax on a class method. My experiment was as follows: #import <Foundation/Foundation.h> static int _value = 8; ...

Changing the default UITabBarController background color.

So I have an iPhone application running that is controlled at the highest level by a UITabBarController. It is the default black Tab Bar at the bottom that you see in many iPhone apps. I am kind of new to iPhone SDK programming, and I know I have seen other apps that have their own background color for the Tab Bar at the bottom. I am not...

Quartz 2D stroke alignment

Is it possible to adjust the alignment, from the default centered, of a stroke when using kCGPathFillStroke as the drawing mode? For example, when drawing a closed path using: CGContextDrawPath(context, kCGPathFillStroke); The stroke lies 50% outside/50% inside the drawn path. The stroke color has a non-opaque alpha so the net effect...

Need multiple views to respond to a touch event in an iPhone app

Setup: I have two views that I need to respond to the touch event, and they are layered out on top of one another. View 1 is on top of View 2. View 2 is a UIWebView. View 1 is sublclassed to capture the touch event. My problem is that if I try to call the UIWebView event handlers (touchesBegan: and touchesEnded:) from within the event...

Releasing instance variable causes crash, but why?

I have an instance variable defined and synthesized as a property like so: @interface CardFrontView : GenericCardView { UIImage *_letterImage; } @property (nonatomic, retain) UIImage *letterImage; @end @implementation CardFrontView @synthesize letterImage = _letterImage; ... I set the letterImage property in -init: - (id)initW...

xcode linking error

EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone application against my own library. To do this, I have the library project referenced from within the application. I have the header path properly set up, as compilation doesn't cause any issues. However, I'm having trouble during the linking phase and I get ...

How to launch GUI app via sh

I want to my app launch itself after install.I am not sure whether this is true.I note that pxl files usually has the postflight file and it contains "launch" chars and it relating a plist file.So,Can I launch my GUI app via some sh commandline ? ...

iPhone - UITextField not set to editable programmatically when using modal dialog?

Hello, I am kinda new with iPhone development and I'm having a bit of trouble with an apparently very simple thing. - (IBAction) addButtonPressed:(id) sender { AddDrinkViewController *addDrinkVC = [[AddDrinkViewController alloc] initWithNibName:@"DrinkDetailView" bundle:nil]; UINavigationController *addNavCon = [[UINavigationContr...

A basic objective - C question thats been giving me some trouble

Hi guys, I'm having a problem with this: -(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u { I'm not really sure whats going on here, is the mehtod initWithName being passed an argument of n which is being casted to an NSString ? and is also being passed an argument d which is being casted to an NSString als...

Convert from NSString to NSDate (even if you don't know the NSString format)

I have an NSString that might contain 5-10 different style dates and times. I need to convert all of them into NSDates. Does dateWithNaturalLanguageString no longer exist in iPhone SDK 3.1.3? I do NOT need to convert things like @"last Wednesday at 1 pm". I need to convert things like: @"01-Feb-2010" @"Feb 1, 2010" @"February 1, 2010"...

[CALayer retainCount] sent to deallocated instance

Whenever I push a view controller onto my stack, then pop it off, I get this error: *** -[CALayer retainCount]: message sent to deallocated instance <memory address> It seems to happen right after dealloc is called on the view controller that is being popped off and is exclusive to only this view controller. I'm sure the CALayer has s...

Class Constants

I have several obj-c classes, each of which require a number of contants that are used in switch statements. I had tried defining these numerical constants in the .m file using the #define preprocessor instruction. All these constants begin with 'kCell'. This seems to work well but Xcode's code sense is presenting me with every 'kCell' ...