i want to attech UIActivityIndicator with UITableView when then first time table load on iphone activity must start blinking and when the table compleletely load in iphone when i click on load more cell then also i want to show activity blink for that moment when more rows loading kindly tell me how can i do that this is the code if you complete this code by your self then thanks in advance
#import "RootViewController.h"
#import "Tweet.h"
#implementation RootViewController
#synthesize customImage,pagecontrol,cell;//indexPath;
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad
{
pageSize = 2;
// totalpages =(NSInteger) (xmlParser.tweets)/5 ;
xmlParser = [[XMLParser alloc] loadXMLByURL:#"http://api.twitter.com/1/statuses/user_timeline/KentFranks.xml"];
[super viewDidLoad];
self.title = #"Tweets";
}
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if([xmlParser.tweets count]>pageSize)
{
return pageSize+1;
}
return xmlParser.tweets.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
//UIImage *twitterLogo = [[UIImage imageNamed:#"twitter-logo.png"]autorelease];
NSString *imagepath = [[NSBundle mainBundle] pathForResource:#"twitter-logo" ofType:#"png"];
UIImage *image =[[ UIImage alloc] initWithContentsOfFile:imagepath];
cell.imageView.image = image;
cell.detailTextLabel.text= #"Add Subtitle here";
Tweet *currentTweet = [[xmlParser tweets] objectAtIndex:indexPath.row];
if(indexPath.row<pageSize)
{
cell.textLabel.text = currentTweet.content;
}
else
{
cell.textLabel.text = #"Load more ";
}
NSLog(#"cell: %#",cell);
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
-(IBAction)loadmorebutton:(id)sender;
{
NSIndexPath *currentPath = [self.tableView indexPathForSelectedRow];
NSIndexPath *nextPath = [NSIndexPath indexPathForRow:currentPath.row+1 inSection:currentPath.section];
[self.tableView selectRowAtIndexPath:nextPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row==pageSize)
{
pageSize=pageSize+2;
[tableView reloadData];
}
}
/*
-(IBAction)pagecontrol:(UIPageControl *)pageControl
{
[self.tableView reloadData];
}
-(IBAction)Pageindexchanges:(id)sender
{
NSLog(#"clicked page index: %i ",pagecontrol.currentPage);
}
*/
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 55;
}
#pragma mark -
#pragma mark Table view delegate
/*- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
*/
#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload
{
}
- (void)dealloc
{
[xmlParser release];
[super dealloc];
}
#end
Try this code may be helped you...
Add the spinner directly to the cell view felt a little hacky, so I used a 1x1 transparent png as the image view and resized it to be whatever my spinner size is:
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:#"NoReuse"] autorelease];
cell.textLabel.text = #"Loading...";
UIActivityIndicatorView *spinner = [[[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
// Spacer is a 1x1 transparent png
UIImage *spacer = [UIImage imageNamed:#"spacer"];
UIGraphicsBeginImageContext(spinner.frame.size);
[spacer drawInRect:CGRectMake(0,0,spinner.frame.size.width,spinner.frame.size.height)];
UIImage* resizedSpacer = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
cell.imageView.image = resizedSpacer;
[cell.imageView addSubview:spinner];
[spinner startAnimating];
return cell;
That gives a cell that looks like this:
This May Help you
https://github.com/pothibo/PHRefreshTriggerView
And second one option is
https://github.com/enormego/EGOTableViewPullRefresh
Related
ViewController.h
#import <UIKit/UIKit.h>
#interface TableViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>
{
UITableView *table;
NSArray *tableData;
}
#end
ViewController.m
#import "TableViewController.h"
#interface TableViewController ()
#end
#implementation TableViewController
- (void)viewDidLoad
{
[super viewDidLoad];
table.delegate = self;
table.dataSource = self;
table = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewCellStyleDefault];
[self.view addSubview:table];
tableData = [[NSArray alloc] initWithObjects:[UIImage imageNamed:#"StopWatch.png"],[UIImage imageNamed:#"TrashCan.png"],[UIImage imageNamed:#"Key.png"],[UIImage imageNamed:#"Telephone.png"],[UIImage imageNamed:#"ChalkBoard.png"],[UIImage imageNamed:#"Bucket.png"],nil];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
//cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.imageView.image = [tableData objectAtIndex:indexPath.row];
return cell;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *str = #"TableViewSection";
return str;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 22;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
#end
I want to have display, this images on the tableview cell.
Please tell me, How to images display on the tableview cell.
My style is only coding. I use not to storyboard.
you are assigning the delegate and dataSource properties before the object initialization, try changing the order, like this:
table = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewCellStyleDefault];
table.delegate = self;
table.dataSource = self;
what is your datasource ? xml tableview cell
this way static
cell.imageView.image = [UIImage imageNamed:#"Maps-icon.png"];
cell.imageView.highlightedImage = [UIImage imageNamed:#"Maps-icon.png"];
or
[cell.imageView setImageWithURL:[NSURL URLWithString:[newsItem objectForKey:#"image"]]
placeholderImage:[UIImage imageNamed:#"placeholder"]];
newsItem NSDictionary
NSDictionary *newsItem = [soapSource objectAtIndex:indexPath.row];
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to pass data to detail view after being selected in a table view?
I'm using a plist (array of dictionaries) to populate a tableview. Now, when a cell i pressed, I want to pass the reprecented dictionary to the detail view with a segue. It's working properly to fill the tableview, but how do I send the same value to the detail view? This is my try:
#import "WinesViewController.h"
#import "WineObject.h"
#import "WineCell.h"
#import "WinesDetailViewController.h"
#interface WinesViewController ()
#end
#implementation WinesViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (void)viewWillAppear:(BOOL)animated {
wine = [[WineObject alloc] initWithLibraryName:#"Wine"];
self.title = #"Vinene";
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [wine libraryCount];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"wineCell";
WineCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
cell.nameLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Name"];
cell.districtLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:#"District"];
cell.countryLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Country"];
cell.bottleImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Image"]];
cell.flagImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Flag"]];
cell.fyldeImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Fylde"]];
cell.friskhetImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Friskhet"]];
cell.garvesyreImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:#"Garvesyre"]];
return cell;
}
#pragma mark - Table view delegate
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:#"DetailSegue"]) {
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
WinesDetailViewController *winesdetailViewController = [segue destinationViewController];
//Here comes the error line:
winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:#"Name"];
}
}
I get one error for:
winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:#"Name"];
Use of undeclaired identifier: indexPath. did you mean NSIndexPath? I think I've missed something important here..
Instead of indexPath.row (which doesn't exist in this function like it does in your tableView:cellForRowAtIndexPath: function where it is passed as an argument) use selectedRowIndex like this:
winesdetailViewController.winedetailName = [wine objectAtIndex:selectedRowIndex.row] valueForKey:#"Name"];
Or, even better yet, change your detail view controller to just accept the whole dictionary, pass the dictionary, and let it set its' own values:
winesdetailViewController.winedetail = [wine objectAtIndex:selectedRowIndex.row];
The error is correct, there is no variable indexPath defined there. However, just a couple lines above that line you define selectedRowIndex which probably has the value that you're after.
I have a storyboard with a UIView and a UITableView in it. The UITableView has custom cells (UITableViewCell with xib).
When I run the app, only the first row of the table is shown, the rest of the table is hidden.
The rows are not seen on the screen, but they respond to user interaction as expected.
The rest of the cells are revealed only after the table is scrolled upwards.
What could be the problem?
Here is the code for UIView with the table:
#implementation EldersTableViewController
#synthesize items;
#synthesize tableView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
EldersDataHendler *edh = [[EldersDataHendler alloc]init];
NSMutableArray *itemsFromPList = [edh dataForTableFrom:[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"eldersData" ofType:#"plist"]]];
self.items = itemsFromPList;
[edh release];
edh=nil;
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (IBAction)didPressBackButton:(UIButton *)sender {
[self.view removeFromSuperview];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.items count];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
SEObject *cellInfo = [self.items objectAtIndex:indexPath.row];
EldersItemCell* cell = (EldersItemCell*)[tableView dequeueReusableCellWithIdentifier:#"EldersItemCell"];
if (cell == nil) {
NSArray* topObjects = [[NSBundle mainBundle] loadNibNamed:#"EldersItemCell" owner:self options:nil];
for (id obj in topObjects){
if ([obj isKindOfClass:[EldersItemCell class]]){
cell = (EldersItemCell*)obj;
break;
}
}
}
[cell setObject:cellInfo];
return cell;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SEObject *cellInfo = [self.items objectAtIndex:indexPath.row];
if (!eldersDetailsViewController){
eldersDetailsViewController = [[self.storyboard instantiateViewControllerWithIdentifier:#"elderDetailsVC"] retain];
}
eldersDetailsViewController.seObject = cellInfo;
[self.view addSubview:eldersDetailsViewController.view];
}
- (void)dealloc {
[eldersDetailsViewController release];
[tableView release];
[super dealloc];
}
#end
Thanks in advance,
Luda
1st just create an object class for your cell design,then import it in your .m file.then try like this and connect the table view delegate and data source properly
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Displayfriendscell";
Displayfriendscell *cell = (Displayfriendscell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[Displayfriendscell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
// Configure the cell...
[[cell viewWithTag:121] removeFromSuperview];
[[cell viewWithTag:151] removeFromSuperview];
friend *user = [sortedFriendsArray objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.nameLabel.text = user.contactNAame;
cell.nameLabel.text = user.friendName;
//cell.nameLabel.text =[[sortedFriendsArray objectAtIndex:indexPath.row] objectForKey:#"name"];
//user.friendName=[[sortedFriendsArray objectAtIndex:indexPath.row] objectForKey:#"name"];
NSLog(#"name is%#",cell.nameLabel.text);
return cell;
}
Problem solved! Thanks a lot dear arooaroo. There was something with the custom cell with the xib. So I've created a custom Table View Cell programmatically. Here is a nice tutorial
I am trying to make my UITableView Editable but I'm having some trouble with the code, specifically with the commitEditingStyle method. It is not working I think the method I have is only for plist and not for an array by itself.
#import "RoutineTableViewController.h"
#import "AlertPrompt.h"
#implementation RoutineTableViewController
#synthesize myArray;
- (void)dealloc
{
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
myArray = [[NSMutableArray alloc] init];
myData = [[NSMutableArray arrayWithContentsOfFile:#"mydata"] retain];
if (myData == nil)
{
myData = [NSMutableArray array];
}
[super viewDidLoad];
UIBarButtonItem * addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:#selector(showPrompt)];
[self.navigationItem setLeftBarButtonItem:addButton];
[addButton release];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
-(void)showPrompt
{
AlertPrompt *prompt = [AlertPrompt alloc];
prompt = [prompt initWithTitle:#"Add Workout Day" message:#"\n \n Please enter title for workout day" delegate:self cancelButtonTitle:#"Cancel" okButtonTitle:#"Add"];
[prompt show];
[prompt release];
}
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex != [alertView cancelButtonIndex])
{
NSString *entered = [(AlertPrompt *)alertView enteredText];
NSLog([NSString stringWithFormat:#"%#", entered]);
if(myData && entered)
{
[myArray addObject:entered];
[tableView reloadData];
}
}
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [myArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [self.myArray objectAtIndex:indexPath.row];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
[self.list removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[myArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
As prevoulsy ansewered; self.list has to be Mutable.
The next thing you need to do is "warn" the tableView about the updates.
So you would do it like this:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
[self.list removeObjectAtIndex:row];
//Notice we "warn" the tableView
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:[NSMutableArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
//We also tell the table the updates are done so it can do the proper animations
[tableView endUpdates];
}
Remember you first change the model and then update the tableView with the add, reload and delete methods in between a beginUpdates and endUpdates.
What type is self.list? It needs to be an NSMutableArray for a call to 'removeObjectAtIndex' to be valid.
There is no .plist involved here, that's just the name of this NSMutableArray. Your sample code assumes you are declaring an NSMutableArray called list in your #interface...
#interface RoutineTableViewController : UIViewController {
NSMutableArray *list;
}
#property (nonatomic, retain) NSMutableArray *list;
#end
... and synthesizing it (and filling it with something) somewhere in your code.
below test code causes EXC_BAD_ACCESS when it's scrolled many time.
would somebody like to tell me the problem?
-myview.h---------------------------------------------------
#interface MyView : UINavigationController < UITableViewDataSource, UITableViewDelegate, UINavigationBarDelegate >
{
UITableView* mTableView;
NSMutableArray* data;
}
-myview.m---------------------------------------------------
#implementation MyView
- (void)viewDidLoad
{
[super viewDidLoad];
int th = self.navigationBar.frame.size.height;
int w = self.view.frame.size.width;
int h = self.view.frame.size.height;
mTableView = [[[UITableView alloc] initWithFrame:
CGRectMake(0.0f, th, w, h - th) style:UITableViewStylePlain] retain];
mTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
mTableView.dataSource = self;
mTableView.delegate = self;
[mTableView setRowHeight:55];
[self.view addSubview:mTableView];
data = [[[NSMutableArray alloc] init] retain];
for (int i = 0; i < 150; i++)
{
[data addObject:[NSDictionary
dictionaryWithObjects:[NSArray arrayWithObjects:#"good", [UIColor blackColor], nil]
forKeys:[NSArray arrayWithObjects:#"name", #"color", nil]]];
}
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 150;
}
- (UITableViewCell *)tableViewCellWithReuseIdentifier:(NSString *)identifier
{
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
cell.textLabel.text = #"goooood";
return cell;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [self tableViewCellWithReuseIdentifier:CellIdentifier];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)dealloc
{
[super dealloc];
}
- (BOOL)canBecomeFirstResponder
{
return YES;
}
#end
You should have a view controller that contains your table view (it could even be a subclass of UITableViewController). I don't believe that UINavigationController is mean't to be subclassed as you have. If you want a navigation controller you should create an instance of CustomTableViewController, containing your tableview, and then use the initWithRootViewController: method of UINavigationController:
CustomTableViewController * ctvc = [[CustomTableViewController alloc] init];
UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:ctvc];
[ctvc release];
// Superview is where you want this added
// probably your window in app did finish launching
[superview addSubview:navigationController.view];
[navigationController release];