Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView Blank Cells
    text
    copied!<p>My Storyboard looks like this:</p> <p><img src="https://i.stack.imgur.com/KK2pE.png" alt="enter image description here"></p> <p>As you can see, I have a TableView below the MapView and then another TableView will appear when I click on the search bar.</p> <p>My Code:</p> <p>.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import &lt;MapKit/MapKit.h&gt; #import &lt;CoreLocation/CoreLocation.h&gt; @interface STLMMeetupLocation : UIViewController &lt;UITextFieldDelegate, UITableViewDataSource, UITableViewDataSource, MKMapViewDelegate, CLLocationManagerDelegate, UISearchBarDelegate, UISearchDisplayDelegate&gt; @property (weak, nonatomic) IBOutlet MKMapView *mapView; @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UISearchBar *searchBar; @end </code></pre> <p>.m</p> <pre><code>#pragma mark - Table View - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == self.tableView) { static NSString *cellIdentifier = @"firstTableViewCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } cell.textLabel.text = @"This is a First Table View cell"; return cell; } else { static NSString *cellIdentifier = @"searchBarCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } cell.textLabel.text = @"This is a Search Bar cell"; return cell; } } </code></pre> <p>My Simulator First Screen:</p> <p><img src="https://i.stack.imgur.com/28hCE.png" alt="enter image description here"></p> <p>My Simulator Second Screen:</p> <p><img src="https://i.stack.imgur.com/Zv061.png" alt="enter image description here"></p> <p>Why is my simulators First screen's tableView's cell.textLabel.text Blank? Shouldn't it have @"This is the First Table View cell"; I know I'm doing something stupid!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload