1

I would like to move red circle (as shown in following image) slowly (may be with animation) when user swipes the app intro (PageViewController). I also want to add some animations so I'm trying to use IFTTT/JazzHands framework. But it's difficult for me to understand currently. Is there any easy way to use animation in PageViewController? Or are there any tutorials that uses IFTTT/JazzHands framework? Could anybody help me, please?

enter image description here

zavrina
  • 305
  • 3
  • 14

2 Answers2

1
Try this if its is ok vote for me


@interface homeViewController ()<UIScrollViewDelegate>

@property (weak, nonatomic) IBOutlet UIScrollView *scrollViewSlider;

@end

@implementation homeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBarHidden=true;
    [NSTimer scheduledTimerWithTimeInterval:4 target:self
    selector:@selector(scrollingTimer) userInfo:nil repeats:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


-(void)viewDidLayoutSubviews
{
    UIImage *imageOne = [UIImage imageNamed:@"download.jpeg"];
    UIImage *imageTwo = [UIImage imageNamed:@"download2.jpeg"];
    UIImage *imageThree = [UIImage imageNamed:@"download3.jpeg"];
    UIImage *imageFour = [UIImage imageNamed:@"download4.jpeg"];

    NSArray *imageArray = [NSArray arrayWithObjects:imageOne,
                        imageTwo, imageThree, imageFour, nil];

    for (int i = 0; i <= 3; i++) {

        UIImageView *imgView = [[UIImageView alloc]init];
        imgView.contentMode = UIViewContentModeScaleToFill;
        imgView.alpha = 0.5f;
        imgView.frame = CGRectMake(i * self.scrollViewSlider.bounds.size.width,
                                    0, self.scrollViewSlider.bounds.size.width,
                                   self.scrollViewSlider.bounds.size.height);

        [imgView setImage:imageArray[i]];
        [self.scrollViewSlider addSubview:imgView];
        self.scrollViewSlider.pagingEnabled = true;

        [self.scrollViewSlider setContentSize:CGSizeMake(imageArray.count *
                                                                                                       self.scrollViewSlider.bounds.size.width,
                                                         self.scrollViewSlider.bounds.size.height-20)];


    }
}

-(void) scrollingTimer
{
    CGPoint frame =  self.scrollViewSlider.contentOffset;
    [UIView animateWithDuration:3.0f animations:^(void) {

        if (frame.x != 3 * self.scrollViewSlider.frame.size.width)

            [self.scrollViewSlider setContentOffset:CGPointMake(frame.x +

                                                            self.scrollViewSlider.frame.size.width, 0)];
        else

            [self.scrollViewSlider setContentOffset:CGPointMake(0, 0)];
    }];

     }
Subbu
  • 62
  • 6
  • Thank you so much for your support. It works perfectly. But it's not what I want. I want user to swipe the page, (at first the red circle is on the "upload" button. When user swipes the screen, that red circle move to "submit" button"). – zavrina Feb 01 '16 at 05:27
  • And I don't have enough reputation to vote. Sorry for that :( – zavrina Feb 01 '16 at 05:46
0

Try this code without any Third party Class just add QuartzCore framwork from library

#import <QuartzCore/QuartzCore.h>

- (CAAnimation*)movedown;
    {
        CABasicAnimation *animation = [CABasicAnimation animation];
        animation.keyPath = @"position.y";
        animation.fromValue = @600;
        animation.toValue = @50;
        animation.duration = 0.25;

        animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

        [subView.layer addAnimation:animation forKey:@"basic"];    
        subView.layer.position = CGPointMake(0,-20);
        return animation;
    }

pls replace your animation view in-place of subview.

princ___y
  • 1,089
  • 1
  • 9
  • 27