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

  • Home
  • SEARCH
  • 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 7766535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:26:38+00:00 2026-06-01T15:26:38+00:00

I have two array and three button in segment control i want that when

  • 0

I have two array and three button in segment control i want that when i load screen by default it get result Array items in table view and then on click on tomorrows button it get nextArray value and show in table

  -(void)viewDidLoad{ 
  if(!resultArray){

    resultArray =[[NSMutableArray alloc] init];
}

   [self setUpData];

   if(!nextArray){

    nextArray =[[NSMutableArray alloc] init];
 }

    [self nextData];
   appointmentsOfDay = [[NSMutableArray alloc] arrayWithArray:resultArray copyItems:YES];
    }


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

 return [appointmentsOfDay count];



}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UILabel * dobLabel = nil;
static NSString * Identifier = @"Identifier";
UITableViewCell * cell = [table dequeueReusableCellWithIdentifier:Identifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Identifier] autorelease];

    dobLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 6, 100, 32)];
    dobLabel.font = [UIFont systemFontOfSize:15];
    dobLabel.tag = 999;
    [cell addSubview:dobLabel];
    [dobLabel release];
 }
 else {
     dobLabel = (UILabel *)[cell viewWithTag:999];
 }

appDelegate = (EMRAppDelegate *)[[UIApplication sharedApplication] delegate];

 ObjectData *theCellData = [appointmentOfDay objectAtIndex:indexPath.row];





     cell.textLabel.font = [UIFont systemFontOfSize:15];
     cell.textLabel.textAlignment = UITextAlignmentLeft;
     cell.textLabel.text=[NSString stringWithFormat:@"%@ %@",theCellData.firstName,theCellData.lasttName];

    dobLabel.text = theCellData.appointmentTime;





      return cell;
    }


  - (void)onDayButtonClick:(id)sender
  {
     UISegmentedControl * segmentedControl = (UISegmentedControl *)sender;


   [appointmentsOfDay removeAllObjects];
    if (segmentedControl.selectedSegmentIndex == 0) {


        [appointmentsOfDay removeAllObjects];


         appointmentsOfDay = [[NSMutableArray alloc] arrayWithArray:resultArray copyItems:YES];



    }

    else if (segmentedControl.selectedSegmentIndex == 1) {

        [appointmentsOfDay addObject:nextArray];


    }
    else if (segmentedControl.selectedSegmentIndex == 2) {

    }

[table reloadData];
}

Crash Report

 EMR[1161:10703] -[__NSPlaceholderArray arrayWithArray:copyItems:]: unrecognized selector sent to instance 0x7320120
2012-04-09 14:13:35.021 EMR[1161:10703] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderArray arrayWithArray:copyItems:]: unrecognized selector sent to instance 0x7320120'
 *** First throw call stack:
 (0x201d052 0x2d01d0a 0x201eced 0x1f83f00 0x1f83ce2 0xc7a7 0x6bc64e 0x6bc941 0x6ce47d  0x6ce66f 0x6ce93b 0x6cf3df 0x6cf986 0x6cf5a4 0x9660 0x201eec9 0x5f95c2 0x5f955a 0x69eb76 0x69f03f 0x69e2fe 0x61ea30 0x61ec56 0x605384 0x5f8aa9 0x2f72fa9 0x1ff11c5 0x1f56022 0x1f5490a 0x1f53db4 0x1f53ccb 0x2f71879 0x2f7193e 0x5f6a9b 0x25bd 0x2535)
terminate called throwing an exception(lldb) 
  • 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-01T15:26:40+00:00Added an answer on June 1, 2026 at 3:26 pm

    The problem is that you are allocation appointmentsOfDay everytime, So remove the following code,

     appointmentsOfDay = [[NSMutableArray alloc] arrayWithArray:resultArray copyItems:YES];
    

    and add it to viewdidload.

    Then,

    if (segmentedControl.selectedSegmentIndex == 0) {
    
            [appointmentsOfDay addObject:resultArray];
    
        }
    
    else if (segmentedControl.selectedSegmentIndex == 1) {
    
            [appointmentsOfDay addObject:nextArray];
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following three arrays and need to create a new two-dimensional array
I have a two-dimensional array. When I print/dump this I get the following My
I have an array $test = array('one', 'two', 'three', 'four', 'five'); I unset two
I have two String arrays a,b. String a [] = {one,two,three}; String b []
I have 3 String arrays with constants. eg: String[] digit = {one, two, three};
I will be short, what i have is array=( one.a two.b tree.c four.b five_b_abc)
I have two array of array of string [[1,'Tambaú','Praça Santo António','Tambaú','12x0',2,'I','EM',12,6,5934,50], [2,'Beira Rio','Av. Bei
I have a two dimensional array with the following output Array ( [0] =>
I am extremely new for iPhone and SQLite. I have 1 button and three
I have two activities in which I need to pass an object array between

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.