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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:21:43+00:00 2026-05-27T15:21:43+00:00

I am using gyroscope to handle rotation. For every degree that I rotate iPad,

  • 0

I am using gyroscope to handle rotation. For every degree that I rotate iPad, I should redraw the image on the screen to change the height of the mask.

But redrawing stops the gyroscope.

What can I do for this situation?

Edit code added

- (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height
{
CGImageRef gradientMaskImage = CreateGradientImage(1, height);

CGImageRef masked = CGImageCreateWithMask([fromImage.image CGImage], gradientMaskImage);
CGImageRelease(gradientMaskImage);

UIImage *theImage = [UIImage imageWithCGImage:masked];

return theImage;
}

Gyroscope will give me a value, and I calculate a height for the image. After that I call this function to redraw the mask and image. So if I roll the device, image will blind up or blind down.

  • 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-27T15:21:44+00:00Added an answer on May 27, 2026 at 3:21 pm

    You can redraw the image in a background thread. When the image is ready, update the UI on the main thread.

    static dispatch_queue_t background_queue;
    - (void)updateImage {
      if (background_queue == nil){
            background_queue = dispatch_queue_create("com.myappname.myIdentifier", 0);
      }
    
      dispatch_async(background_queue, ^ {  // render the image in the background thread
         UIImage * theImage = [self reflectedImage:fromImage withHeight:height]; 
         dispatch_sync(dispatch_get_main_queue(), ^{
            imageView.image = theImage;    // Update the imageview in the main thread
         });
      });
    }
    

    Edit: code fixes

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

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
I have gyroscope + accelerometer data at each time period T . Using C++,
Using WebViewBrush I can render web page content (it's screen shot) to e.g. Rectangle
Using Yii, I want to delete all the rows that are not from today.
Using the opencart image manager how would I set the upload to automatically remove:
I am testing Core Motion and using the gyroscope. Right now I am getting
Using report builder 3.0, I have a report that queries a cube. How do
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using CRM 4, I have an entity form that contains a tab with an

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.