Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLudwing Najera
4,596 PointsBlog Reader input not showing up on app
the inputs on my BlogReader app are not showing up on the simulator, although i put "Cell" in the storyboard identifier and I have no idea what is going on. here is my code for debugging.
@interface TableViewController ()
@end
@implementation TableViewController
(id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; }
-
(void)viewDidLoad { [super viewDidLoad];
self.titles = [NSArray arrayWithObjects:@"The Missing Widget in the Android SDK: SmartImageView", @"Get started with iOS Development", @"An Interview with Shay Howe", @"Treehouse Friends: Paul Irish", @"Getting A Job In Web Design and Development", @"Treehouse Show Episode 13 – LLJS, Navicons and Framework Flights", nil]; }
(void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
(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 [self.titles count]; }
-
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = [self.titles objectAtIndex:indexPath.row];
return cell; }
and my .h file too
@interface TableViewController : UITableViewController
@property (nonatomic, strong) NSArray *titles;
@end
please help?
5 Answers
Guilherme Juraszek
3,550 PointsChange the .m file (from TableViewController.m to HomeReaderTableViewController.m), chage the .h file (from TableViewController.h to HomeReaderTableViewController.h).
In the HomeReaderTableViewController.h change the line that says:
@interface TableViewController : UITableViewController
to
@interface HomeReaderTableViewController : UITableViewController
In the HomeReaderTableViewController.m file change:
from
#import "TableViewController.h"
to
#import "HomeReaderTableViewController.h"
and the line that says
@interface TableViewController (){
to
@interface HomeReaderViewController (){
and the line that says:
@implementation TableViewController
to
@implementation HomeReaderViewController
In the Storyboard at Interface Builder, go to the right panel, at Identity Inspector and where it says Custom Class chage it to HomeReaderViewController
Ludwing Najera
4,596 Pointsi added a breakpoint at the titles array, and when it was enabled the app started up faster, but when i disabled the breakpoint, it started up slower. Coincidence?
Guilherme Juraszek
3,550 PointsI suggest that you change the class name (file name, headers and class name) to something else (like HomeReaderTableViewController) and set the first reponder class in your table view controller in Interface Builder as HomeReaderTableViewController. I think the Interface Builder is mistakenly using the default class, witch is named TableViewController, and not your subclass.
Ludwing Najera
4,596 Pointsi tried to change the first responder but i don't know how to exactly and i changed the names of the .m and .h files and it gave me a bunch of errors. I'm using Xcode 6 beta, and things might be different. But, thanks for the help!
Ludwing Najera
4,596 PointsThank you so much!