I have a tableview with dynamic prototypes content. I want to call for a specific ViewController programatically when a dynamic cell tap. I used SWRevealViewController calls for my project.
When I tap on cell one with #"l1" identifier I want to load main view controller with sw_front , used in SWRevealViewController. I cannot use controll+drag becaue in her I have use tabviewcontrller. When I do that it disappear the tab bar.
#import "ListViewController.h"
#interface ListViewController ()
#end
#implementation ListViewController
{
NSArray *menuItems;
}
- (void)viewDidLoad {
[super viewDidLoad];
menuItems = [NSArray arrayWithObjects:#"l1",#"l2",#"l3",#"l6",#"l4",#"l5",#"l7", nil];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [menuItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = [menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if ([cell.reuseIdentifier isEqualToString:#""]) {
UIViewController *mainviewcontroller = [[UIViewController alloc] initWithNibName:#"MainViewController" bundle:nil];
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:mainviewcontroller];
[self.navigationController presentViewController:navi animated:YES completion:nil];
}
}
If you already set storyboard ID then you can push programmatically using following code.
Here viewController1, viewController2 etc are storyboard Id of individual UIViewController.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIViewController *pushViewController = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:#"viewController%ld",indexPath.row]];
[self.navigationController pushViewController:pushViewController animated:YES];
}
Related
#property NSArray* restaurants;
#end
#implementation RestaurantsTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self requestRestaurants];
}
- (void)requestRestaurants {
NSString *urlString = #"https://s3-us-west-2.amazonaws.com/samwell.party/yasminucla/restaurants.json";
NSURL *url = [NSURL URLWithString:urlString];
NSData *restaurantData = [NSData dataWithContentsOfURL:url];
self.restaurants = [NSJSONSerialization JSONObjectWithData:restaurantData
options:NSJSONReadingAllowFragments
error:nil];
[self.tableView reloadData];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.restaurants count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"Cell" forIndexPath:indexPath];
NSInteger index = indexPath.row; // Get the row that we're at
NSString* restaurant = self.restaurants[index]; // Get the name of the restaurant for the row from the array
cell.textLabel.text = restaurant; // Set the cell text to be the name of the restaurant
return cell;
}
#end
I have a UITableView Controller embedded in a TabViewController in the storyboard and added cells to the table view programatically. The cells have objects downloaded from a .json file from the internet. I would like to push a mapKit view to each individual cell when it is clicked, but Im not sure how to do it, as I cannot connect the cells individually in the storyboard.
You need to use didSelectRowAtIndexPath and performSegueWithIdentifier.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:#"yourSegue" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UIViewController *mapViewController = segue.destinationViewController;
NSString* restaurant = self.restaurants[index];
mapViewController.title = restaurant;
}
See also: How to make a push segue when a UITableViewCell is selected
Your Response
self.storyboard = [
"Mr. Chow",
"Panera Bread",
"Il Pastaio",
"Jinky's Cafe",
"Kazu Nori",
"Happy Days"
]
Add a class of name is MapViewController Then make a property for passing the json data
#import <UIKit/UIKit.h>
#interface MapViewController : UIViewController
#property(nonatomic,strong)NSString*PassVarible;
#end
After Adding Write code your initial class
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MapViewController*vc=[self.storyboard instantiateViewControllerWithIdentifier:#"MapViewController"];
vc.PassVarible=[self.restaurants objectAtIndex:indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}
I have two UIViews in my app.
in first view there is a tableveiw with two cells(to select city and country). when user select first cell(to select city), then it goes to anothrview that has a list of cities. then when user select a city(select a tableviecell text), the selected should display in firtview's tableviewcell text.
this is my code in secondview controller(it is a tableview Controller).
- (void)viewDidLoad {
[super viewDidLoad];
detailFlights = #[#"colombo1",#"colombo2",#"colombo3",#"colombo14",#"colombo15",#"colombo16",#"colombo17"];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [detailFlights count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"identi" forIndexPath:indexPath];
cell.textLabel.text = [detailFlights objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
This kind of problem is solved using the delegate pattern. A pattern widely used in iOS programming. See this question if you don't know how it works.
As deadbeef said, you must implement delegate method to transfer data to first view, but logic for that is to choose objectAtIndex of indexPath.row in didSelect: [detailFlights objectAtIndex:indexPath.row];
As an alternative to the delegate method that others have mentioned, you can use an unwind segue to pass data back to the previous view controller.
Unwind segues give you a way to "unwind" the navigation stack back through push, modal, popover, and other types of segues. You use unwind segues to "go back" one or more steps in your navigation hierarchy. Unlike a normal segue, which create a new instance of their destination view controller and transitions to it, an unwind segue transitions to an existing view controller in your navigation hierarchy. Callbacks are provided to both the source and destination view controller before the transition begins. You can use these callbacks to pass data between the view controllers.
Here's a example where the second (source) view controller presented a list of fonts, and the first (destination) view controller updates its table row to show the selected font:
- (IBAction)unwindFromFontPreference:(UIStoryboardSegue *)segue
{
FontTableViewController *fontTableViewController = segue.sourceViewController;
if (self.currentFontSelection != fontTableViewController.currentFontSelection)
{
self.currentFontSelection = fontTableViewController.currentFontSelection;
[self.tableView reloadRowsAtIndexPaths:#[[NSIndexPath indexPathForRow:0 inSection:LALSettingsTableViewSectionFont]]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
FirstViewController.m
#import "FirstViewController.h"
#import "SecondViewController.h"
#interface FirstViewController ()<UITableViewDelegate, UITableViewDataSource, ViewControllerDelegate>
#property (nonatomic, retain) NSMutableArray* data;
#property (nonatomic, retain) IBOutlet UITableView* tableView;
#end
#implementation FirstViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.data = [NSMutableArray array];
[self.data addObject:#"country"];
[self.data addObject:#"city"];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.data.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell" forIndexPath:indexPath];
NSString* text = [self.data objectAtIndex:indexPath.row];
cell.textLabel.text = text;
return cell;
}
-(void) updateText:(NSString *)text
{
[self.data replaceObjectAtIndex:1 withObject:text];
[self.tableView reloadData];
}
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:#"secondView"])
{
UINavigationController* controller = [segue destinationViewController];
NSArray *viewControllers = controller.viewControllers;
SecondViewController* viewController = [viewControllers objectAtIndex:0];
viewController.delegate = self;
}
}
SecondViewController.h
#import <UIKit/UIKit.h>
#protocol ViewControllerDelegate <NSObject>
-(void) updateText:(NSString*)text;
#end
#interface SecondViewController : UIViewController
#property (nonatomic, assign) id<ViewControllerDelegate> delegate;
#end
SecondViewController.m
#import "SecondViewController.h"
#interface SecondViewController ()
#property(nonatomic ,retain) NSArray* detailFlights;
#end
#implementation SecondViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.detailFlights = #[#"colombo1",#"colombo2",#"colombo3",#"colombo14",#"colombo15",#"colombo16",#"colombo17"];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.detailFlights count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell" forIndexPath:indexPath];
cell.textLabel.text = [self.detailFlights objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{ NSString* text = [self.detailFlights objectAtIndex:indexPath.row];
[self.delegate updateText:text];
[self dismissViewControllerAnimated:YES completion:nil];
}
#end
whole project is here
In didDeselectRowAtIndexPath method you can get that string using following way
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSString *selectedString = [tableView cellForRowAtIndexPath:indexPath].textLabel.text;
}
now save to pass previous view controller you can store it in UserDefaults OR
make a property in previousViewController and before go back set it value like follow
if you are using navigationController then
ViewController *previousViewController = (ViewController *) self.navigationController.viewControllers[self.navigationController.viewControllers.count-2];
previousViewController.selectedString = selectedString;
or
you can also use block for passing data. example of block
This is the code I've got so far, basically what's supposed to happen is that once you make a selection in the UITableView, you should then get a transition that will take you onto the UIWebView although all that's happening is once you make a selection it just highlights blue.
First view controller .h
#import <UIKit/UIKit.h>
#interface YoMaFifthViewController : UITableViewController
{
NSArray *data, *sites;
}
#end
First view controller .m
#import "YoMaFifthViewController.h"
#import "YoMaWebsiteViewController.h"
#interface YoMaFifthViewController ()
#end
#implementation YoMaFifthViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - view lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
data = [NSArray arrayWithObjects:#"Website", #"Developer", nil];
sites = [NSArray arrayWithObjects:
#"https://www.google.co.uk/",
#"https://www.google.co.uk/",
nil];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
#pragma mark - Table view data source
- (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 [data count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.textLabel.text = [data objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [sites objectAtIndex:indexPath.row];
cell.imageView.image = [UIImage imageNamed:[data objectAtIndex:indexPath.row]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
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
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
YoMaWebsiteViewController *wvc = [[YoMaWebsiteViewController alloc] initWithNibName:#"YoMaWebsiteViewController" bundle:nil];
wvc.site = [sites objectAtIndex:indexPath.row];
[self.navigationController pushViewController:wvc animated:YES];
}
#end
Website view controller .h
#import <UIKit/UIKit.h>
#interface YoMaWebsiteViewController : UIViewController
{
IBOutlet UIWebView *webview;
}
#property (retain) NSString *site;
#end
Website view controller .m
#import "YoMaWebsiteViewController.h"
#interface YoMaWebsiteViewController ()
#end
#implementation YoMaWebsiteViewController
#synthesize site;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:self.site];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webview loadRequest:request];
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
You would need an IB Action or a segue to the website view controller (for static cells). When it comes to dynamic prototypes, a segues would work. You can do the segues with a little bit of code. First, go to the storyboard and Control-drag from the First View Controller to the Website View Controller (use the icons on the bottom or use the document outline). Then, after giving the segue an identifier, use the following code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:#"yourSegueIdentifier" sender:[self.tableView cellForRowAtIndexPath:indexPath]];
}
Edit 2: If you're using a xib do this (no control drag):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.navigationController pushViewController:viewControllerNameHere animated:YES sender:[self.tableView cellForRowAtIndexPath:indexPath]];
}
Why isn't the numberOfSectionsInTableView method not being called? It's called if I add [self.tableView reloadData] in viewDidLoad, but even then, cellForRow does not get called.
Edit: I updated the following code to register the nib for the UITableViewCell.
In a UIViewController, I have:
- (void)viewDidLoad
{
[super viewDidLoad];
XXFeedTableViewController *tableViewController = [[XXFeedTableViewController alloc] initWithStyle:UITableViewStylePlain];
tableViewController.view.frame = self.view.bounds;
[self addChildViewController:tableViewController];
}
XXFeedTableViewController.h
#interface XXFeedTableViewController : UITableViewController
#end
XXFeedTableViewController.m
#import "XXFeedTableViewController.h"
#import "XXFeedTableViewCell.h"
#interface XXFeedTableViewController ()
#end
#implementation XXFeedTableViewController
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self) {
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:#"XXFeedTableViewCell" bundle:nil] forCellReuseIdentifier:#"XXFeedTableViewCell"];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"XXFeedTableViewCell";
XXFeedTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = #"Hey";
return cell;
}
#end
Apple docs say:
If no nib file is specified or if the nib file defines no data source
or delegate, UITableViewController sets the data source and the
delegate of the table view to self. When the table view is about to
appear the first time it’s loaded, the table-view controller reloads
the table view’s data.
Try this, and see if it works. This is the way Apple recommends now with a nib based cell.
-(void)viewDidLoad {
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:#"XXFeedTableViewCell" bundle:nil] forCellReuseIdentifier:#"XXFeedTableViewCell"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"XXFeedTableViewCell";
ROFeedTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = #"Hey";
return cell;
}
After Edit:
In your initial controller, you should add the table view controller as a child controller before you add its subview:
XXFeedTableViewController *tableViewController = [[XXFeedTableViewController alloc] initWithStyle:UITableViewStylePlain];
self addChildViewController:tableViewController];
tableViewController.view.frame = self.view.bounds;
[self.view addSubview:tableViewController.view];
[tableViewController didMoveToParentViewController:self];
i have some other viewcontroller which triggers another viewcontroller which have UItableView as subView my code is following two file .h , .m
when i use single view based application with this code it works fine but when i use two view for examlpe 1st is logingscreen n call 2nd nib file using this
Viewcomment *b=[[SimpleTableViewController alloc] initWithNibName:#"SimpleTableViewController" bundle:nil];
[self presentModalViewController:b animated:YES];
or
self.window= [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[Viewcomment alloc] initWithNibName:#"Viewcomment" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
it shows "SIGABRT" !!!
Where i am wrong ?
.h file:
#import <UIKit/UIKit.h>
#interface SimpleTableViewController : UIViewController <UITableViewDelegate,UITableViewDataSource>{
NSArray *listData;
}
#property(nonatomic, retain) NSArray *listData;
#end
.m file
#import "SimpleTableViewController.h"
#implementation SimpleTableViewController
#synthesize listData;
- (void)viewDidLoad {
NSArray *array = [[NSArray alloc] initWithObjects:#"iPhone", #"iPod", #"iPad",nil];
self.listData = array;
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
}
- (void)dealloc {
}
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.listData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = #"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if (cell == nil) { cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] ;
}
NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; return cell;
}
#end
Your missing:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
from your UITableViewDataSource which will cause a crash.
If thats doesn't work make sure the view is connecting in the nib file of your view controller and make sure your UITableView is connected correctly to the data source.