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?
Asked
Active
Viewed 319 times
1

zavrina
- 305
- 3
- 14
-
what do u mean of `move circle`? `0.1.2.3.4.5`. After the index `5`, go to `0` automatically? – Justlike Feb 01 '16 at 02:11
-
No, I edited the post. I just want to add tutorial using UIPageViewController. For example, click "Upload", then click "Submit" button. – zavrina Feb 01 '16 at 03:37
-
If possible, I want to add animation like this example https://drive.google.com/file/d/0B0395LXtwCBfQ3N4eEJ6cnQtQms/view – zavrina Feb 01 '16 at 03:39
-
How about this one: http://i.stack.imgur.com/5HAxn.gif – Justlike Feb 01 '16 at 06:09
-
@Justlike, Yup it's exactly same as what I need. – zavrina Feb 01 '16 at 07:16
-
I do it **without** `IFTTT/JazzHands`. I can send the project to you by e-mail if you want it. – Justlike Feb 01 '16 at 07:22
-
1I upload the project to github.com. Have a try. https://github.com/wneo/ScrollTest – Justlike Feb 01 '16 at 07:30
-
@Justlike, Really really thank you :D. I will try it. (y) – zavrina Feb 01 '16 at 07:45
2 Answers
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
-
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
-
Thanks a lot for your answer. I tried your code and I think I can use it. :) – zavrina Feb 01 '16 at 05:39
-
But when I change "fromValue" and "toValue", the subview (image) moves down and then it bounces back to its original place. I wanna keep that subview at the place where it stops. How should I do it? – zavrina Feb 01 '16 at 05:45
-
pls change the value and try to adjust becase it's my programe value. – princ___y Feb 01 '16 at 06:47
-
-
if this code is helpful for you then pls vote up my answer.and accept it. – princ___y Feb 01 '16 at 07:43
-
I don't have enough reputation to vote up so I did "acceptance the answer". – zavrina Feb 01 '16 at 07:49
-