xcode - How to load gif image and control that in ios? -
In my application, I want to load GIF images in my scene and also prevents and keeps animating. < / P>
Please follow the tutorial below that can help you.
Step 1:
Download the Library below the URL and add it to your project. Https://drive.google.com/folderview?id=0B5JC34Lt79ctamtOVTV6SHhzOVU&usp=sharing
Step 2:
Import the file to your "viewController" .h "like below // gifImage // #import" SCGIFImageView.h "// gifImage //
Step 3:
your" viewController Please make the given item below. " // gifImage // IBOutlet SCGIFImageView * _gifImageView; IBOutlet UIButton * _button; // gifImage //
Step 4:
Create an account on your "viewController" // gifImage // - (IBAction) Control Antim: (ID ) Sender; // gifImage //
Step 5:
Add the following code You wanted to use gif image // gifImage // // Load url gif Image ns URL * imageURL = [NSURL URLWithString: @ "http://google.co.in/anim.gif"]; NSDTA * ImageData = [NSDTATA DATAVITY content of the: imageURL]; / * // Load local GIF image NSString * filePath = [[NSBundle main bundle] pathForResource: @ "1.gif" type type: zero]; NSDTa * ImageData = [NSDTATA DataWithTransffiles: Phylax]; * / _gifImageView = [[SCGIFImageView alloc] initWithFrame: CGRectMake (225, 70, 75, 75)]; [_gifImageViewSetData: ImageData]; [Self.view addSubview: _gifImageView]; // gifImage //
Step 6:
To stop / add the following code // gifImage // - (IBAction) Control Antim: (ID) Sender {_gifImageView.animating =! _gifImageView.animating; If (_gifImageView.animating) {[_button setTitle: @ "Stop" forState: UIControlStateNormal]; } And {{_button setTitle: @ "Continue" forState: UIControlStateNormal]; }} // gifImage // [1]: https://drive.google.com/folderview?id=0B5JC34Lt79ctamtOVTV6SHhzOVU&usp=sharing
Comments
Post a Comment