Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:10:25+00:00 2026-06-14T05:10:25+00:00

I am creating an iPhone app, and I’m having some trouble with the TableView

  • 0

I am creating an iPhone app, and I’m having some trouble with the TableView and adding buttons. I started with a regular view, and then added a table view, and then a couple buttons to the top, as shown here:

TableViewImage

The problem is that when I run the app I get this:

enter image description here

Neither of the buttons that I added are there. Here is my .h file:

    //
//  RootBeerTVCViewController.h
//  BaseApp
//
//  Created by Blaine Anderson on 10/12/12.
//  Copyright (c) 2012 UIEvolution, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface RootBeerTVCViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>



@property (weak, nonatomic) IBOutlet UIButton *nameButton;
@property (weak, nonatomic) IBOutlet UIButton *locationButton;
@property(strong, nonatomic) NSMutableArray* rootList; 



-(IBAction)sort:(id)sender;

@end

And here is the .M file:

//
//  RootBeerTVCViewController.m
//  BaseApp
//
//  Created by Blaine Anderson on 10/12/12.
//  Copyright (c) 2012 UIEvolution, Inc. All rights reserved.
//

#import "RootBeerTVCViewController.h"
#import "GlobalData.h"

@interface RootBeerTVCViewController ()


@end

@implementation RootBeerTVCViewController
@synthesize rootList; 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization


    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    [GlobalData sharedData].mViewManager.mNavController.navigationBarHidden=NO;

    // Do any additional setup after loading the view from its nib.
    rootList = [[GlobalData sharedData] mRootList ];
     NSLog(@"RootList in view did load: %@", rootList);
    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];

    tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

    tableView.delegate = self;

    tableView.dataSource = self;

    //[tableView addSubview:sortingView]; 

    [tableView reloadData];

    self.view = tableView;
}

- (void)viewDidUnload
{

    [self setLocationButton:nil];
    [self setNameButton:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    rootList = [[GlobalData sharedData] mRootList ];
    NSLog(@"RootList: %@", rootList);
    // Return the number of sections.
    NSLog(@"RootList count: %i", rootList.count);
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of sections.
    NSLog(@"RootList row count: %i", rootList.count);
    return rootList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    rootList =[[GlobalData sharedData].mRootBeerParser rootBeerList];
    NSLog(@"RootList Cell: %@", rootList);
    RootBeers* mRootBeer = [rootList objectAtIndex:indexPath.row];


    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if(cell == nil){
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle  reuseIdentifier:@"Cell"]; 
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    NSLog(@"Cell Name: %@", mRootBeer.brewer);
    // Configure the cell...
    cell.textLabel.text = mRootBeer.name; 
    cell.detailTextLabel.text = mRootBeer.location; 



    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:[NSArray arrayWithObject: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
{


    RootBeers* mRootBeer =[rootList objectAtIndex:indexPath.row]; 
    [GlobalData sharedData].mRootBeer = mRootBeer; 
    [[GlobalData sharedData].mViewManager pushView:DETAILVIEW animated:YES]; 



}

- (IBAction)sort:(id)sender {

    rootList =[[GlobalData sharedData].mRootBeerParser rootBeerList];


    [[GlobalData sharedData].mRootBeerParser sortRootBeerByName:rootList]; 
}
@end

If someone could give me an idea of what I’m doing wrong, that would be great. I hope that I have provided enough information, if not, please let me know and I’ll be happy to supply more.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:10:26+00:00Added an answer on June 14, 2026 at 5:10 am

    In your viewDidLoad you create a new UITableView of screen size and then set it as VC view, thus overriding the view that was loaded from xib. As a result you are only seeing the table you created in code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an iphone app and i am having some issues with drawing
I'm currently creating an iPhone app and we need some testing with about 20~30
I am dynamically creating buttons on iPhone app. UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [btn
I am creating an iphone app in which i have some vale in integer
i am creating an iphone app, can someone suggest some framework to handle api
I'm creating an iPhone app using storyboard. I have a table view and 4
I am creating an iPhone App. I have some tables to save users information.
I'm currently creating an iPhone app (Xcode 4.3.1, IOS 5) that could use Bluetooth
I'm creating an iPhone app that will have a preloaded set of locations with
I've been creating an iPhone App using Core Data. First of all, does it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.