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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:16:11+00:00 2026-05-25T14:16:11+00:00

I am trying to fill the array with the objects till the specified count

  • 0

I am trying to fill the array with the objects till the specified count and when that count is reached ,I will not add the objects to the array and I am able to do that..

But what I am want is suppose I have given count 7,and & objects are added into the array,so when I want to add the 8th object the object and index 0 should be pushed out and all the objects should be take their their new positions to make place for new object.

So friends how can this be done

from the below comments I tried this code

if(count ==7)
    {
    [array1 removelastObject] ;
    }

   [array1 insertObject:orderGroup atIndex:0 ] ;

and It works…

Thank you very much friends..

Regards
Ranjit

  • 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-25T14:16:12+00:00Added an answer on May 25, 2026 at 2:16 pm
    -(id)popAndPush:(id)newObject{
        id poppedObject = nil;
        if([array count]==maxCount){       /// remove first object (new count will be maxCount-1
            poppedObject = [[array removeObjectAtIndex:0] retain];
        }
        [array addObject:newObject];       /// push new object
        return [poppedObject autorelease];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
I am trying to get the following loop working to fill an array of
I am trying to remove an object from an array and fill the slot
I am trying to fill a form in a php application from a C#
I have been trying to do a fill using the open source Srecord Program.
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I am trying to call into an unmanaged DLL that has the following structure:
I am trying to fill a RealVector (from Apache Commons Math) with values. I
I am having a baffling issue while trying to fill an NSMutableArray with UIImages.

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.