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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:03:41+00:00 2026-06-14T20:03:41+00:00

So I have this method: -(void)addLaneToRacingLanes:(UITapGestureRecognizer*)sender{ laneDataObject *data=[self.laneDataObjects objectAtIndex:sender.view.tag]; [self.racingLanes addObject:data]; NSLog(@%i,self.racingLanes.count); [sender.view setBackgroundColor:[UIColor

  • 0

So I have this method:

-(void)addLaneToRacingLanes:(UITapGestureRecognizer*)sender{


    laneDataObject *data=[self.laneDataObjects objectAtIndex:sender.view.tag];
    [self.racingLanes addObject:data];


    NSLog(@"%i",self.racingLanes.count);
    [sender.view setBackgroundColor:[UIColor yellowColor]];

}

It uses the tag from the senders view to find out which data object corresponds to that view.I’m using this to add to my racingLanes which is how I update these views, but my problem is that for some reason I cant add my laneDataObjects to my array racingLanes. Any ideas?

This is how the properties are set up:

@property (strong,nonatomic)NSArray *laneDataObjects;
@property (strong,nonatomic) NSMutableArray *racingLanes;

I have already run through the tags and they all work. The tags work such that lane 1 is tag 0 with its data object at 0, then lane 2 is tag 1 and its data is 1, so on and so forth. I already pre-tested this. And I have checked that both the laneDataObject array has been properly set up. Is it because my racingLanes isn’t using a custom getter or setter? How would I go about changing that?
Incase it matters I used

NSLog(@" %i",self.racingLanes.count);

to find out if the array was empty.

  • 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-14T20:03:41+00:00Added an answer on June 14, 2026 at 8:03 pm

    It is a near certainty that the racingLanes has not been initialized: since the objects that you are adding are non-nil (you’d see an exception thrown otherwise) the racingLanes must be nil then.

    You need to set racingLanes to NSMutableArray in the designated initializer:

    _racingLanes = [NSMutableArray array];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbee question here - I have this method in the view controller m: -(void)
I have a method to insert data into server like this: public void doInsert(){
I have this method: private void listView1_DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count >
I have in a view this method - (void)viewWillAppear:(BOOL)animated{ [textField1 becomeFirstResponder];} then when I
If I have this method: -(void) methodName { action1; action2; [self methodName]; } I
Suppose I have this method: - (void)placeView:(UIView*)theView withCenterIn:(CGPoint)centerPoint; So I pass the view and
i have this method: private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar ==
I have this method: public void onClick(View v) { if (test != true) {
I currently have this method: -(void)seperateGuides { DLog(GetGuideListCount: %i, [[appDelegate getGuideList] count]); columnOneArray =
I have this method: public void testJSNI2(){ String x = test; } I can

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.