什么是最佳做法?
<HTML> or <html>
Run Code Online (Sandbox Code Playgroud)
为什么我们应该坚持一个特定的案例?
但是,所有浏览器似乎都会解释这两种情况并返回预期的输出.
这是一个生成GIF图像的ObjectiveC方法:
@implementation NSArray (GIFImage)
- (NSString*)GIFImageWithImageDuration:(CGFloat)GIFImageDuration
{
NSArray *images = self;
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
CGImageDestinationRef destination = CGImageDestinationCreateWithURL((CFURLRef)[NSURL fileURLWithPath:path],
kUTTypeGIF,
images.count,
NULL);
NSDictionary *frameProperties = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:GIFImageDuration]
forKey:(NSString *)kCGImagePropertyGIFDelayTime]
forKey:(NSString *)kCGImagePropertyGIFDictionary];
NSDictionary *gifProperties = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:0] forKey:(NSString *)kCGImagePropertyGIFLoopCount]
forKey:(NSString *)kCGImagePropertyGIFDictionary];
for ( NSInteger index = 0; index < images.count; index++ )
{
UIImage *image = (UIImage *)[images objectAtIndex:index];
CGImageDestinationAddImage(destination, image.CGImage, (CFDictionaryRef)frameProperties);
}
CGImageDestinationSetProperties(destination, (CFDictionaryRef)gifProperties);
CGImageDestinationFinalize(destination);
CFRelease(destination);
NSLog(@"animated GIF file created at …Run Code Online (Sandbox Code Playgroud) 我尝试在我的HTML代码中显示一个gif动画图像
<img src="preview.gif" loop=infinite />
Run Code Online (Sandbox Code Playgroud)
无论有没有循环标记,它总是只播放一次.
有什么帮助让它连续循环?
html ×2
animated-gif ×1
css ×1
gif ×1
ios10 ×1
javascript ×1
lowercase ×1
objective-c ×1
uppercase ×1