안녕하세요, 저는 uiimageview.At에서 이미지를 변경하는 uislider를 처음으로 사용해도 지연이 없습니다. 하지만 게시 할 단추를 클릭하면 (모달보기가 열림) 모달보기가 닫힙니다 (두 번째 시간) uiimageview 지연으로 images.i 캔트가 왜 느려지는지 알 수 있습니다. (두 번째로 고집하는 UISlider
-(IBAction)sliderSlide:(UISlider *)aSlider {
float f=slider.value;
NSString *show=[NSString stringWithFormat:@"%.0f %%",f];
label2.text=show;
NSString *show1=[NSString stringWithFormat:@"%.0f",f];
imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"/Smiley_000%@.png", show1]];
float slid=slider.value;
if(slid>99)
{
[imageView1 setHidden:NO];
[imageView2 setHidden:YES];
NSString *fullpath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Smiley_00099.png"];
imageView.image = [UIImage imageWithContentsOfFile:fullpath];
secondarray=[NSArray arrayWithObjects:
[UIImage imageNamed:@"Rays_00000.png"],
[UIImage imageNamed:@"Rays_00001.png"],
[UIImage imageNamed:@"Rays_00002.png"],
[UIImage imageNamed:@"Rays_00003.png"],
[UIImage imageNamed:@"Rays_00004.png"],
[UIImage imageNamed:@"Rays_00005.png"],
[UIImage imageNamed:@"Rays_00006.png"],
[UIImage imageNamed:@"Rays_00007.png"],
[UIImage imageNamed:@"Rays_00008.png"],
[UIImage imageNamed:@"Rays_00009.png"],
nil];
imageView1.animationImages = secondarray;
// How many seconds it should take to go through all images one time.
imageView1.animationDuration = 0.5;
// How many times to repeat the animation (0 for indefinitely).
imageView1.animationRepeatCount = 0;
[imageView1 startAnimating];
}
else if (slid<1)
{
[imageView2 setHidden:NO];
[imageView1 setHidden:YES];
NSString *fullpath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Smiley_0000.png"];
imageView.image = [UIImage imageWithContentsOfFile:fullpath];
firstarray=[NSArray arrayWithObjects:
[UIImage imageNamed:@"Teardrop_00000.png"],
[UIImage imageNamed:@"Teardrop_00001.png"],
[UIImage imageNamed:@"Teardrop_00002.png"],
[UIImage imageNamed:@"Teardrop_00003.png"],
[UIImage imageNamed:@"Teardrop_00004.png"],
[UIImage imageNamed:@"Teardrop_00005.png"],
[UIImage imageNamed:@"Teardrop_00006.png"],
[UIImage imageNamed:@"Teardrop_00007.png"],
[UIImage imageNamed:@"Teardrop_00008.png"],
[UIImage imageNamed:@"Teardrop_00009.png"],
[UIImage imageNamed:@"Teardrop_00000.png"],
[UIImage imageNamed:@"Teardrop_00000.png"],
[UIImage imageNamed:@"Teardrop_00000.png"],
[UIImage imageNamed:@"Teardrop_00000.png"],
[UIImage imageNamed:@"Teardrop_00000.png"],
nil];
imageView2.animationImages = firstarray;
// How many seconds it should take to go through all images one time.
imageView2.animationDuration = 0.8;
// How many times to repeat the animation (0 for indefinitely).
imageView2.animationRepeatCount = 0;
[imageView2 startAnimating];
[self.view addSubview:imageView2];
}
else
{
[imageView1 setHidden:YES];
[imageView2 setHidden:YES];
[imageView1 stopAnimating];
[imageView2 stopAnimating];
}
[[NSUserDefaults standardUserDefaults] setFloat:slid forKey:@"slider"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
내가 어떤 애니메이션을 취소하고 슬라이더는 이제 다시 속도 만에 얻을 : 내가 슬라이더를 밀어 두 번째 성능의 감소가 PLS
편집 1 말해 왜 u는 볼 수 있다면
이 내 코드입니다 사진은 슬라이더 okey를 고집하고 있지만 사진은 처음에는 느립니다.
이것은 슬라이더 콜백에서 실행되는 코드입니다. 이 대리자 메서드는 초당 수백 번 호출 할 수 있습니다. – coneybeare
네, 맞습니다 (멍청한 놈처럼) 나는 그 줄이 사라지도록 전 세계에 배열을 정의 할 수 없습니다. –