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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:15:22+00:00 2026-05-23T14:15:22+00:00

I’m developing a location-aware application as a project for the university and one of

  • 0

I’m developing a location-aware application as a project for the university and one of the feature to develop consists of showing the first five points of interest closest to the user. I’m using a table view whose cells style is UITableViewCellStyleSubtitle. I’m having some problems because beyond the title and subtitle of the cell i’m using an image (arrow) to show the direction which the user should follow to reach the POI. This image should rotate as soon as the heading/position of the device change. The problem is that only the last row of the table view works and the main problem is that I don’t figure out how to use five different cells since each POI can have a different position rather the position of the device thereby each cell’s image should rotate independently.
I report an image to give a better understanding of my problem.

TableView

Here follows the code I used for the tableview cells:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *tableIdentifier = @"tableIdentifier";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tableIdentifier];

    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tableIdentifier] autorelease];
    }

    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor];

    NSUInteger row = [indexPath row];


    cell.detailTextLabel.text = [NSString stringWithFormat:@"Distance: %.3f Km",[...];

    UIImage *cellImage = [UIImage imageNamed:@"arrow.png"];
    cell.imageView.image = cellImage;
    self.cellImageView = cell.imageView;

    return cell;
}

Any ideas of how to use 5 different cells in order to provide each arrow with its right angle?!

Thanks

  • 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-23T14:15:23+00:00Added an answer on May 23, 2026 at 2:15 pm

    By doing:

    self.cellImageView = cell.imageView.

    You are giving yourself a reference only to the very last of the cells. Each time a cell is configured, your cellImageView variable gets updated to point to that cell’s image view and you lose your reference to the previous cell’s image view.

    So, one way of solving your problem is to accumulate the cell image views in an array. Just make sure you keep the image view matched up with the appropriate location; cells can get reused as the tableview displays. But the tableview owns those cells and can mess with them however it wants for caching purposes (hence the reuse identifier).

    A better way would be to cooperate with the tableview and let it know when things need changing. Forget about your ivar, and just set the correct heading during cell configuration. Need to change the heading for a cell? Tell the tableview to reload that cell. Need to change the headings for all cells? Just call [[self tableView] reloadData].

    Only if you run into issues with noticeable UI slowdowns should you worry about doing something more clever.

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.