I’m using a new class with nib and tableview. To costumize the TableViewCells i have defined some functions and constant values (#define) and special TableViewCells
- (UITableViewCell*) CreateMultilinesCell :(NSString*)cellIdentifier { ... }
I want to use this costumized cell in other TableViews too.
Is it possible to pack this specific code into a file and load it into multiple files ?
like inlcude in PHP
From comment: What is the most reduced (OO-free, just functions) file possible in iPhone SDK ?
i hope you understand what i mean.
cheers Simon
Create a function and put it in it’s own file, and create a header and include that and call that function.
Like this:
CellCreator.m:
UITableViewCell *CreateMultilinesCell(NSString *cellIdentifier) { ... }CellCreator.h (and be sure to
#include <UIKit/UIKit.h>):UITableViewCell *CreateMultilinesCell(NSString *cellIdentifier);Your TableView files (at the top):
#include "CellCreator.h"To use it:
UITableViewCell *cell = CreateMultilinesCell(@"identifier);