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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:08:32+00:00 2026-05-30T22:08:32+00:00

i am having problem with setting the noOfRowsInSection in table view when displaying the

  • 0

i am having problem with setting the noOfRowsInSection in table view when displaying the current location and when not displaying the current view , it seems that when i set the current location on a “current location” row gets inserted in the table view automatically and messes up the count of rows in noOfRowsInSection (im counting the no of annotations in the map for no of rows) , i solved the problem by simple increasing the no by one when the user is connected to the internet my code:

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



int countval=[[map annotations] count];
Reachability *reach=[[Reachability reachabilityForInternetConnection] retain];
NetworkStatus status = [reach currentReachabilityStatus];


if (searching)
{
    return [copyListOfItems count];
}
else {
        if([[self stringFromStatus:status] isEqualToString:@"Connected via wifi"] || [[self stringFromStatus:status] isEqualToString:@"Connected via WWAN"])

    {

        return countval+1;//
    }
    else
    {

        return countval;
    }
}

}

but , now im having problem while reloading the table using

[self.tableView reloadData];

the numberOfRowsInSection gets refreshed and messes up again , how can i set the numberOfRowsInSection again while being refreshed or is there another way to fix this problem, i would be really grateful and thankful for any suggestions, code , tutorials . Thanking you in advance

  • 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-30T22:08:33+00:00Added an answer on May 30, 2026 at 10:08 pm

    Found the problem , when reloading the table view
    my code:

        return countval+1;
    

    just keeps adding 1 to numberOfRowsInSection so it gives you array out of bound error , which i fixed by simply putting a constant number 87 which is the count of annotations on my map , not the best solution but since my annotations count is fixed , it solved the problem.

    return 87;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with OpenAL that only seems to occur with iPod hardware,
I'm having a problem with setting up a PreparedStatement to insert a new row
I am having a problem setting the Authorize attribute Role value from a variable.
I'm having a problem setting a cookie and doing a 302 redirect In chrome
I am having a problem setting up the following in Visual Studio 2008: a
I am having a problem setting the background of UITableView to a UIImageView (see
I am having a problem where a cookie I am setting is being lost
I am in the process of setting up CruiseControl.NET. The problem I am having
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I'm having a problem setting the font for UILabels and UITextViews with Interface Builder.

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.