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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:08:27+00:00 2026-05-16T18:08:27+00:00

I basically want to show a UITableViewCellAccessoryDisclosureIndicator depending on certain situations, in this case,

  • 0

I basically want to show a UITableViewCellAccessoryDisclosureIndicator depending on certain situations, in this case, where a URL exists in my row data (which I reference via indexPath.row.

I have the right code to figure that out (ie if an URL exists), but I am unsure where I should state this code in the “cellForRowAtIndexPath:” method. I’ve tried it inside the if(cell == nil) clause and outside of it, and both times the cell is redrawn sometimes with or without the indicator when the cell comes back into view from scrolling.

It works fine on initial draw.

Any tips on how I can best achieve this?

  • 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-16T18:08:27+00:00Added an answer on May 16, 2026 at 6:08 pm

    Yes, you should put it in the cellForRowAtIndexPath: delegate method, outside of the “if (cell == nil)” statement. Since the cells are recycled, you have to make sure that the accessory type is set to the right value for every cells and not only the one(s) that need specific accessory type.

    For example :

    - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)ip {
        UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:@"CELL"];
    
        if (cell == nil) {
            cell = [[[UITableView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELL"] autorelease];
        }
    
        if (ip.row == 3) {
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
    
        return cell;
    }
    

    This code would not work the way we want it to. Since the cells are recycled, the cell with accessory type set to UITableViewCellAccessoryDisclosureIndicator will be reused later at an undefined row and would then exhibit a disclosure indicator even if it is not located at row #3.

    To deal with cells reusing, we have to set accessory type for EVERY cells, whatever their row :

        if (ip.row == 3) {
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
        else {
            cell.accessoryType = UiTableViewCellAccessoryNone;
        }
    

    I don’t know for sure if this explains your problem, but it sure looks related to cell reusing.

    EDIT :

    OK, you found the solution by yourself while I was typing my answer. :o)

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

Sidebar

Related Questions

ProgressDialog onClick not working.. here is my code .. Basically i want to show
I basically want to do this in code: PersonList myPersonList; //populate myPersonList here, not
I basically want to show some php if it's inside the category work, I
I have an NSArray of 500 annotations and I basically want to show only
I have a button that i basically want to either show or hide it
Basically I want to override some function in the flex/actionscript list class which creates
My datasource is XML (sharepoint list). I basically want to show the date formatted
Basically, I want to show a crosshairs in the middle of my map that
I basically want to be able to deploy multiple versions of the same EAR
I basically want to make things easier by just looping LinkButtons instead of making

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.