Voir ma vidéo http://www.youtube.com/watch?v=4acFshAlGJ8
J'utiliser https://lh3.googleusercontent.com/-WZEDMSmfrK0/TeeD93t8qYI/AAAAAAAAAKw/X9D6jRkLfLk/s800/MUKScale.png image échelle dans le ScrollView ceci est un exemple incomplet juste pour montrer comment peut-il est réalisable.
ici est une pièce utile de code, dans ce environ tout est statique, mais pour le travail réel devrait travailler plus,
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:scrollView];
UIImageView *backImgg = [[UIImageView alloc] initWithFrame:CGRectMake(x,y,886,15)];
[backImgg setImage: [UIImage imageNamed:@"MUKScale.png"]];//Image in the link above
[scrollView addSubview:backImgg];
[backImgg release];
[scrollView setContentSize:CGSizeMake(886,15)];
return;
}
NSTimer *timer ;
float timeSet =0 ;
-(IBAction) btnPressed
{
timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(showTimeInLbl) userInfo:nil repeats:YES];
}
-(void)showTimeInLbl
{
CGRect visibleRect;
visibleRect.origin = scrollView.contentOffset;
visibleRect.size = scrollView.contentSize;
NSLog(@"Visible rect: %@", NSStringFromCGRect(visibleRect));
float time = visibleRect.origin.x/8;
timeSet = time;
lblTime.text = [NSString stringWithFormat:@"%f",time];
[UIView animateWithDuration: .1
animations: ^{
[scrollView setContentOffset:CGPointMake(visibleRect.origin.x - 8,0) animated:NO];
}completion: ^(BOOL finished){
}
];
timeSet-=0.1;
lblTime.text = [NSString stringWithFormat:@"%f",timeSet];
if(timeSet<=0)
{
[timer invalidate];
lblTime.text = @"0";
[UIView animateWithDuration: .1
animations: ^{
[scrollView setContentOffset:CGPointMake(0,0) animated:NO];
}completion: ^(BOOL finished){
}
];
}
}
Bienvenue sur SO. Demandez-vous s'il vous plaît fournir un code à l'appui de votre réponse. – Luv