title: Cocoa: Why is my table view blank?
body: <p>Why is my table view blank? It was fine until I added "initWithStyle"</p>
  
  <p>Here is what it looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/6ox52.png" alt="alt text"></p>
  
  <p>And here is what my code looks like:</p>
  
  <p>Here is my .h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  
  @interface TableViewController : UITableViewController {
  
  NSMutableArray *jokes;
  IBOutlet UITableView *jokeTableView; 
  
  
   }
  
  @property (nonatomic, retain) NSMutableArray *jokes;
  @property (retain) UITableView *jokeTableView;
  
  @end
  </code></pre>
  
  <p>And here is my implementation file:</p>
  
  <pre><code>#import "TableViewController.h"
  #import "Joke.h"
  
  @implementation TableViewController
  @synthesize jokes;
  @synthesize jokeTableView;
  
  - (void)awakeFromNib {
  [jokeTableView init];
  }
  
  
  
  
  - (id)initWithStyle:(UITableViewStyle)style {
  if (self = [super initWithStyle:style]) {
      self.jokes = [NSMutableArray arrayWithObjects:
                    [Joke jokeWithValue:@"If you have five dollars     and Chuck Norris has five dollars, Chuck Norris has more money than you"],
                    [Joke jokeWithValue:@"There is no 'ctrl' button on Chuck Norris's computer. Chuck Norris is always in control."],
                    [Joke jokeWithValue:@"Apple pays Chuck Norris 99 cents every time he listens to a song."],
                    [Joke jokeWithValue:@"Chuck Norris can sneeze with his eyes open."],
                    nil];
  
      self.jokeTableView.rowHeight = 30.0;
      // self.jokeTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
      self.jokeTableView.sectionHeaderHeight = 0;
  }
  return self;
  }
  
  
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Saying how many sections wanted (Just     like in address, where sorts by first name)
  return 1;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView 
  numberOfRowsInSection:(NSInteger)section {
  return [jokes count];
  }
  
  
  - (UITableViewCell *)tableView:(UITableView *)tableView 
       cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  static NSString *CellIdentifier = @"Team";  
  UITableViewCell *cell = 
  [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
      cell = [[[UITableViewCell alloc] 
               initWithFrame:CGRectZero 
               reuseIdentifier:CellIdentifier] autorelease];
  }
  Joke *j = (Joke *)[jokes objectAtIndex:indexPath.row];
  if( j )
      cell.text = j.joke;
  return cell;
  }
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  }
  
  
  - (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  }
  
  - (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:
  (UIInterfaceOrientation)interfaceOrientation {
  return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
  }
  
  - (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning]; 
  }
  
  - (void)dealloc {
  [jokes release];
  [jokeTableView release];
  [super dealloc];
  }
  
  @end
  </code></pre>