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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:59:29+00:00 2026-06-07T06:59:29+00:00

I am writing a geometry based app. At one point in the app, there

  • 0

I am writing a geometry based app. At one point in the app, there will be a UITableView with some custom cells. These cells contain UILabels. Amid the text of some these labels, I want to insert symbols that look these two triangles: image
(source: wiley.com)

However, since I cannot find these symbols in any Apple fonts, is there a way to insert an image into the string in place of a symbol?

Here is a (very) rough idea of what I’m going for (the actual table will not be static):

image2

  • 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-07T06:59:32+00:00Added an answer on June 7, 2026 at 6:59 am

    Ok, I get what you’re trying to do. The key, I think, is to just keep adding controls to your cell, calculating the width as you go along.

    First, I’d suggest a data structure to hold your cell contents. A simple array will do the job. I generally do this stuff as an ivar:

    @interface LabelWithImagesViewController ()
    {
        NSMutableArray *_cells;
    }
    @end
    

    Then fill this array with the text and images you want. I’m doing a single row, but you can repeat for every row you need.

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        _cells = [[NSMutableArray alloc] init];
    
        [_cells addObject:[[NSArray alloc] initWithObjects:
                           [UIImage imageNamed:@"triangle.png"],
                           @"CAT",
                           [UIImage imageNamed:@"semiequal.png"],
                           [UIImage imageNamed:@"triangle.png"],
                           @"DOG",
                           @"  If",
                           [UIImage imageNamed:@"triangle1.png"],
                           @"then",
                           [UIImage imageNamed:@"triangle2.png"],
                           nil]];
    }
    

    And then, you need to create your cell:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        // Return the number of rows in the section.
        return _cells.count;
    }
    
    #define kEquationTag 100
    #define kCellHeight 44
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"equationCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        UIView *equationContainer;
    
        if (cell == nil)
        {
            // if we don't have a cell create it, including the frame to hold our custom stuff
    
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    
            equationContainer = [[UIView alloc] initWithFrame:cell.contentView.bounds];
            equationContainer.tag = kEquationTag;
            [cell.contentView addSubview:equationContainer];
        }
        else
        {
            // if we are dequeing one that already exists, let's get rid of the old custom stuff
    
            equationContainer = [cell.contentView viewWithTag:kEquationTag];
            for (UIView *view in equationContainer.subviews)
            {
                [view removeFromSuperview];
            }
        }
    
        // Configure the cell...
    
        NSArray *cellContents = [_cells objectAtIndex:indexPath.row];
    
        NSUInteger x = 0;
        UIFont *font = [UIFont systemFontOfSize:12.0];
    
        for (NSObject *obj in cellContents)
        {
            if ([obj isKindOfClass:[NSString class]])
            {
                NSString *text = (NSString *)obj;
                CGSize size = [text sizeWithFont:font];
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, (kCellHeight - size.height)/2.0, size.width, size.height)];
                label.text = text;
                label.font = font;
                [equationContainer addSubview:label];
                x += size.width;
            } 
            else if ([obj isKindOfClass:[UIImage class]])
            {
                UIImage *image = (UIImage *)obj;
                UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, (kCellHeight - image.size.height) / 2.0, image.size.width, image.size.height)];
                imageView.image = image;
                [equationContainer addSubview:imageView];
                x += image.size.width;
            }
        }
    
        return cell;
    }
    

    This yields:

    enter image description here

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

Sidebar

Related Questions

I'm trying to view some 3d geometry in a custom ipad application I'm writing.
For some endpoints SimpleGeo.com returns something like this: { geometry:{ type:Point, coordinates:[ -122.421583, 37.795027
Writing a large GUI based application in Java and was wondering if there were
I am writing a converter for 2D geometry data. One of the elements I
Writing an app which takes the preview frames from camera does some transformation to
I am writing a GLSL geometry shader and I am trying to use the
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
Writing documentation in html requires some code examples. What to do with characters that
I'm writing a program to solve a geometry problem. My algorithm doesn't treat collinear
I'm writing some low level code for X11 platform. To achieve best data copying

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.