user914425
user914425

Reputation: 16483

TableView SigAlert Error

I have a primarly code based iphone sample app that works. It is Navigation based app. This sample app code comes with a RootViewController (.h and .m). I am trying to import another

#import "TopView.h"

...

#pragma mark UITableViewDelegate methods

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    UIViewController *viewController;
    TopView *TopViewController;
switch (indexPath.row) {
    case PDF: 
        viewController = [[[PDFExampleViewController alloc] init] autorelease];
                    [self.navigationController pushViewController:viewController animated:YES];
        break;
    case TopView: 
        tableviewController = [[[TopView alloc] init] autorelease];
                    [self.navigationController pushViewController:viewController animated:YES]; 
        break;
    default: 
        viewController = [[[UIViewController alloc] init] autorelease];
                    [self.navigationController pushViewController:viewController animated:YES];
} 

}

I am getting SigAlerts. I am trying to import the following simple TableView Xib based sample code.
http://www.icodeblog.com/2008/08/08/iphone-programming-tutorial-populating-uitableview-with-an-nsarray/

Above UITableView based one works by itself. My head spinning trying to debug the SigAlerts and setter errors. Any help on importing above UITableView into the main app would be greatly appreciated.

Upvotes: 0

Views: 76

Answers (1)

mbh
mbh

Reputation: 3312

What is TopView? Is this a UIViewController? If so please change the name as it is misleading. From the name it looks like a UIView subclass

If this is not a UIViewcontroller, you cannot push it like the following. A UIView cannot be pushed on to a UINAvigationController.

 case TopView: 
        tableviewController = [[[TopView alloc] init] autorelease];
       [self.navigationController pushViewController:viewController animated:YES]; 

Also what are the values of these which you are using in the Switch-Case

PDF
TopView 

In addition there is a typo?

 tableviewController //supposed to be topViewController??

Another one, from next time onwards name your instance variables starting with small letter

i.e topViewController and NOT TopViewController

Upvotes: 1

Related Questions