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 7537291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:48:41+00:00 2026-05-30T06:48:41+00:00

i have created a xib file in Xcode 4.2 and i am looking at

  • 0

i have created a xib file in Xcode 4.2 and i am looking at getting it to the tabbed application but i have been trying and I’m a little bit new to Xcode , coding so thats why i need your help i have my code below but there are a few little errors but what i would like you lot to help me with is maybe getting to a tabbed application… well telling me what to do anyhow. heres a video for you to have a look at in case i haven’t explained it correct (this is my video i did just for this question http://www.youtube.com/watch?v=e7R5_kGClM0 hope the video help but more importantly you can help me.

There is the .h but the is no errors in this

#import <UIKit/UIKit.h>

@interface myview : UIViewController <UITableViewDelegate, UITableViewDataSource, UIPickerViewDelegate, UIPickerViewDataSource>    


@property (strong, nonatomic) IBOutlet UITableView* tableView;
@property (strong, nonatomic) IBOutlet UIPickerView* pickerView;
@property (strong, nonatomic) NSMutableArray* tableData;
@property (strong, nonatomic) NSMutableArray* pickerData;


@end

This is the .m but i will break it up

#import "myview.h"

@implementation myview


@synthesize tableView, pickerView, tableData, pickerData;





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

this is the -(void)viewDidLoad];etc..

- (void)viewDidUnload
{
    [super viewDidUnload];

    tableView.delegate = self;
    tableView.dataSource = self;
    pickerView.delegate = self;
    pickerView.dataSource = self;

    tableData = [[NSMutableArray alloc] init]; // table starts empty
    pickerData = [[NSMutableArray alloc] initWithObjects:@"1", @"2", @"3", @"4", @"5", nil]; // picker starts with values 1, 2, 3, 4, 5

    [tableView reloadData];
    [pickerView reloadAllComponents];    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

-(bool)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {
    //The number of sections in UITableView
    return 1;

}


- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
    // The number of rows in the UITableView
    return [tableData 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];

    }

    // Set the table cell text to the appropriate value in tableDate
    cell.textLabel.text = [tableData objectAtIndex:indexPath.row];

    return cell;

}

- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Whatever happens when you select a table view row.
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    // The number of sections in the UIPickerView
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    // The number of rows in the UIPickerView
    return [pickerData count];
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    // The data for each row in the UIPickerView
    return [pickerData objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    // whatever you want to happen when a row is selected.

    // here I am assuming you want to remove from the picker and add to the table on selection
    [tableData addObject:[pickerData objectAtIndex:row]];
    [pickerData removeObjectAtIndex:row];

    [tableView reloadData];
    [pickerView reloadAllComponents];
}




@end

Here Are The Errors In The Code There are Two

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
                          ^^^^^^^^^^^^^^^^^
      **Local declaration of 'tableView hides instance variable**

Second error

    [pickerView reloadAllComponents];
            ^^^^^^^^^^^^^^
Local declaration of 'pickerView hides instance variable

Thanks Very Much I Hope To Here From You Soon !!!

  • 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-05-30T06:48:43+00:00Added an answer on May 30, 2026 at 6:48 am

    Use this, “tableView hides instance variable” occurs if local variable and instance variable have the same name.

     - (UITableViewCell*)tableView:(UITableView*)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
                static NSString *cellIdentifier = @"cell";
    
           UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:cellIdentifier];
    
                if (cell == nil) {
                    cell = [ [UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    
          }
    cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
    
        return cell;
    
    }
    

    and for pickerView use this

    [self.pickerView reloadAllComponents];

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

Sidebar

Related Questions

I have been working with Xcode 4.2.1, but following some tutorials and videos from
I want to create a new nib file in the xcode 3.0 , but
I have created a new iPhone project in Xcode 4 and added some files
I have created a universal window based application in xcode 4. Additionally I created
I have Xcode 4 and I created an application using the Tab Bar template
When I create a new cocoa project in Xcode, it creates a MainMenu.xib file
Have started playing with Xcode 4.2, and created a single page application using storyboard
In Xcode 4 I created a new Cocoa application called Tabletest , on the
I have created a C# class file by using a XSD-file as an input.
I have a relatively confusing problem: I created several empty Xcode projects and ran

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.