UIView
クラスを受講する
メソッド内initWithFrame
:
//this method create custom activity indicator
UIImage *startImage = [UIImage imageNamed:@"1.png"];
customActivityIndicator = [[UIImageView alloc] //take in in .h file
initWithImage:startImage ];
//Add more images which to be used for the animation
customActivityIndicator.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
[UIImage imageNamed:@"8.png"],
nil];
//Set animation duration
customActivityIndicator.animationDuration = 0.5;
//set frame at the middle of the imageview
customActivityIndicator.frame = self.frame;
方法を取る:
// call this methode from the class where u want to animate custom indicator
(void)startAnimating
{
[customActivityIndicatorstartAnimating];
}
方法を取る:
// call this methode from the class where u want to stope animate custom
(void)stopAnimating
{
[customActivityIndicatorstaopAnimating];
}