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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:23:57+00:00 2026-06-07T19:23:57+00:00

I have no trouble using iCarousel with UIImageViews, everything works great. However, I wanted

  • 0

I have no trouble using iCarousel with UIImageViews, everything works great.

However, I wanted to add some extra drawing with the image, so I did a quick subclass of UIView that included an image and had a custom draw routine. Simple enough. However, inside of the viewForItemAtIndex, when I set the image property, it doesn’t update visually. Instead it repeats the n images that represented the visible images and thus the originally loaded objects.

Example, I have 26 images, a – z. 5 visible on startup, a – e. Without the ‘setNeedsReload’ i get images a – e repeatedly, instead of a – z, when I scroll through the view.

I have found that if I add ‘setNeedsDisplay‘ inside the setImage property, it will work correctly. However, there is a huge performance penalty.

My question is two fold:

  1. Am I missing something?
  2. Should I just extend UIImageView instead and
    do the custom drawing inside a ‘processImage’ style method like Nick
    did in FXImage?

Thanks,

/// GroupImageView.m

- (void)setImage:(UIImage *)newImage {
    image = newImage;
    [self setNeedsDisplay];
}

// override of the drawRect routine.
- (void)drawRect:(CGRect)rect {

    //  only draw if we have an image to draw
    if (image) {
        CGContextRef context = UIGraphicsGetCurrentContext();

        // blah blah, fancy drawing crap
        CGContextRotateCTM (context, radians((rand() % 5 + 2)));
        CGContextTranslateCTM(context, -0.5f * insetRect.size.width, -0.5f * insetRect.size.height);
        CGContextFillRect(context,insetRect);
        // etc

        [image drawInRect:insetRect blendMode:kCGBlendModeNormal alpha:[self alpha]];

        // etc
    } 
}

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view {

    if (view == nil) {
        view = [[GroupImageView alloc] initWithImage:[UIImage imageNamed:@"Loading.png"]];
    }
    CGImageRef ref = [group posterImage];
    UIImage* coverImage;
    if (ref) {
        coverImage = [UIImage imageWithCGImage:ref scale:1/scaleFactor orientation:UIImageOrientationUp];
    }
    else {
        coverImage = [UIImage imageNamed:@"Sunflower.png"];
    }

    [(GroupImageView*)view setImage:coverImage];
    return view;

}
  • 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-07T19:23:59+00:00Added an answer on June 7, 2026 at 7:23 pm

    UIImageView does not use drawRect for drawing the image because drawRect uses Core Graphics for drawing, and Core Graphics is not hardware accelerated.

    A UIView subclass that uses drawRect to draw its contents will be 100 times slower than a UIImageView, which is why you’re getting performance problems.

    FXImageView gets around this by doing the drawing on a background thread and using an NSOperationQueue to make sure that images are updated in order as needed.

    Forking FXImageView and modifying the processImage method to do your drawing is not a bad idea – it will certainly be less work than recreating FXImageView’s queuing and caching behaviour from scratch. Note that you’ll need to modify the cache key logic as well because FXImageView’s caching is based on the specific drawing attributes that it uses.

    I might consider updating FXImageView to include a custom drawing block property – it seems like something that might be useful.

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

Sidebar

Related Questions

I have trouble using sed. I need to replace some lines in very deprecated
I'm having some trouble using constraints correctly. I have three tables, 'item', 'store' and
I have a ASP.NET MVC site using Membership Provider. I have trouble testing some
I have some trouble using the Zend url helper with get parameter. In a
I'm having some trouble using sessions with php.. I think I have figured out
I have some trouble using decltype for member function pointers: #include <iostream> #include <type_traits>
I have some trouble with using authlogic in my rails app, so I began
I have some JSF-trouble using h:selectOneMenu with a list from my backend bean: My
I have some trouble using an Ajax query in a Rails + JQuery ecosystem.
I am having some trouble using the GTK Expander widget. I have several expanders

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.