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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:30:47+00:00 2026-06-17T12:30:47+00:00

I am completely stumped on this problem and it should be so simple that

  • 0

I am completely stumped on this problem and it should be so simple that its driving me nuts.

I am working with this apple reflection tutorial.

Apple Reflection Example

They have the image gradient that shows up from top to bottom.

  • How can I make a gradient from left to right
  • how can I flip the image horizontally. In their example they flip the image vertically.

any help?

//The gradient code is here but I don't know what should be the gradient start / end points
CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh)
{
.....
gradientStartPoint = CGPointZero;
        gradientEndPoint = CGPointMake(0, pixelsHigh);
}

//similarly I know the image flip happens here but for life of me I cannot make it flip horizontally

- (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height
{
.....
CGContextTranslateCTM(mainViewContentContext, 0.0, height);
        CGContextScaleCTM(mainViewContentContext, 1.0, -1.0);
}
  • 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-17T12:30:48+00:00Added an answer on June 17, 2026 at 12:30 pm

    Try this:

    //horizontal gradient
    CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh)
    {
        .....
        gradientStartPoint = CGPointZero;
        gradientEndPoint = CGPointMake(pixelsWide, 0);
    }
    
    //horizontal flip
    
    - (UIImage *)reflectedImage:(UIImageView *)fromImage withWidth:(NSUInteger)width
    {
        .....
        CGContextTranslateCTM(mainViewContentContext, width, 0,0);
        CGContextScaleCTM(mainViewContentContext, -1.0, 1.0);
    }
    

    For the horizontal flip you should add a new method, since you have to specify the width, no the height.

    Good Luck!

    EDIT 1:

    In order to get the gradient, you should add another modification to reflectedImage:withWidth.

    - (UIImage *)reflectedImage:(UIImageView *)fromImage withWidth:(NSUInteger)width
    {
        .....
        CGImageRef gradientMaskImage = CreateGradientImage(width, 1);
        .....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am completely stumped at the nature of this problem. We export data from
I'm working on a school assignment and I've been completely stumped with this step.
I have NEVER had this problem before and i am completely stumped. the site
This problem has completely stumped me. This is for iOS 5.0 with Xcode 4.2
I have an odd problem that has me completely stumped. Unfortunately I have a
I've been staring at this one for a while and I'm completely stumped. You'll
I'm sure this is something really simple, like a misplaced quote, but I'm completely
Alright so I have an assignment that I have been completely stumped on. My
I am completely stumped here. I have the following fragment shader working: varying lowp
I'm completely stumped with a problem using CoreLocation. I've checked out some other questions

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.