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

The Archive Base Latest Questions

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

I want that, when I roll the iPad, the image blinds up/down. Effect should

  • 0

I want that, when I roll the iPad, the image blinds up/down. Effect should be like

http://madrobby.github.com/scriptaculous/combination-effects-demo/ Blind Down demo.

How can I do that?

I tried Reflection example of Apple but I had performance issues since I should redraw image in every gyroscope action.

Here is the Code:

- (void)viewDidLoad
{
[super viewDidLoad];
tmp = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"galata2.jpg"]];
// Do any additional setup after loading the view, typically from a nib.
NSUInteger reflectionHeight = imageView1.bounds.size.height * 1;


imageView1 =  [[UIImageView alloc] init];
imageView1.image = [UIImage imageNamed:@"galata1.jpg"];
[imageView1 sizeToFit];
[self.view addSubview:imageView1];

imageView2 =  [[UIImageView alloc] init];
//UIImageView *tmp = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"galata2.jpg"]];
imageView2.image = [UIImage imageNamed:@"galata2.jpg"];

[imageView2 sizeToFit];



[self.view addSubview:imageView2];

motionManager = [[CMMotionManager alloc] init];
motionManager.gyroUpdateInterval = 1.0/10.0;
[motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue]
                                   withHandler: ^(CMDeviceMotion *motion, NSError *error){

                                       [self      performSelectorOnMainThread:@selector(handleDeviceMotion:) withObject:motion    waitUntilDone:YES];

                                   }];

}

////

- (void)handleDeviceMotion:(CMDeviceMotion*)motion{
CMAttitude *attitude = motion.attitude;
int rotateAngle = abs((int)degrees(attitude.roll));
//CMRotationRate rotationRate = motion.rotationRate;
NSLog(@"rotation rate = [Pitch: %f, Roll: %d, Yaw: %f]", degrees(attitude.pitch), abs((int)degrees(attitude.roll)), degrees(attitude.yaw));
int section = (int)(rotateAngle / 30);
int x = rotateAngle % 30;

NSUInteger reflectionHeight = (1024/30)*x;
NSLog(@"[x = %d]", reflectionHeight);
imageView2.image = [self reflectedImage:tmp withHeight:reflectionHeight];   
}

////

- (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height
{
if(height == 0)
    return nil;    


// create a bitmap graphics context the size of the image
CGContextRef mainViewContentContext = MyCreateBitmapContext(fromImage.bounds.size.width, fromImage.bounds.size.height);


// create a 2 bit CGImage containing a gradient that will be used for masking the 
// main view content to create the 'fade' of the reflection.  The CGImageCreateWithMask
// function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient
CGImageRef gradientMaskImage = CreateGradientImage(1, kImageHeight);

// create an image by masking the bitmap of the mainView content with the gradient view
// then release the  pre-masked content bitmap and the gradient bitmap
CGContextClipToMask(mainViewContentContext, CGRectMake(0.0, 0.0, fromImage.bounds.size.width,height), gradientMaskImage);
CGImageRelease(gradientMaskImage);

// In order to grab the part of the image that we want to render, we move the context origin to the
// height of the image that we want to capture, then we flip the context so that the image draws upside down.
//CGContextTranslateCTM(mainViewContentContext, 0.0,0.0);
//CGContextScaleCTM(mainViewContentContext, 1.0, -1.0);


// draw the image into the bitmap context
CGContextDrawImage(mainViewContentContext, CGRectMake(0, 0, fromImage.bounds.size.width, fromImage.bounds.size.height), fromImage.image.CGImage);

// create CGImageRef of the main view bitmap content, and then release that bitmap context
CGImageRef reflectionImage = CGBitmapContextCreateImage(mainViewContentContext);
CGContextRelease(mainViewContentContext);

// convert the finished reflection image to a UIImage 
UIImage *theImage = [UIImage imageWithCGImage:reflectionImage];

// image is retained by the property setting above, so we can release the original
CGImageRelease(reflectionImage);

return theImage;
}
  • 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:22:23+00:00Added an answer on May 27, 2026 at 3:22 pm

    One way to do this is to use another covering view that gradually changes height by animation;

    If you have a view called theView that you want to cover, try something like this to reveal theView underneath a cover view:

    UIView *coverView = [UIView alloc] initWithFrame:theView.frame];
    coverView.backgroundcolor = [UIColor whiteColor];
    [theView.superView addSubView:coverView];  // this covers theView, adding it to the same view that the view is contained in;
    CGRect newFrame = theView.frame;
    newFrame.size.height = 0;
    newFrame.origin.y = theView.origin.y + theView.size.height;
    [UIView animateWithDuration:1.5
                          delay: 0.0
                        options: UIViewAnimationOptionRepeat
                     animations:^{
                         coverView.frame = newFrame;
                     }
                     completion:nil
                     ];
    

    This should cover the view and then reveal it by changing the frame ov the cover, moving it down while changing the height.

    I haven’t tried the code, but this is one direction you can take to create the blind effect. I have used similar code often, and it is very easy to work with. Also, it doesn’t require knowing core animation.

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

Sidebar

Related Questions

I want that my unit tests to cover my POCO's. How should I test
I just want that my program or method should run at specific date and
I want to load a thumbnail representation of an image that is located in
I'm looking for something like Sencha Touch that isn't so heavy. I don't want
I want that list, because if something horrible happens, and I'll have to reinstall
I want that everytime someone wants to checkout the project from SVN he/she will
I want that find empty tags, here is a example txt =<lol1><><lol2> rgx =
a want that, he found all select elements with id than begins with 'chbTypes'
I want that the user shouldn't be able to resize the window form. I
I want that the form will not close by doing Alt + F4 but

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.