Gifu/docs/docsets/Gifu.docset/Contents/Resources/Documents/Protocols/GIFAnimatable.html

641 lines
29 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>GIFAnimatable Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/GIFAnimatable" class="dashAnchor"></a>
<a title="GIFAnimatable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Gifu Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/kaishin/gifu/"><img src="../img/gh.png"/>View on GitHub</a></p>
<p class="header-right"><a href="dash-feed://https%3A%2F%2Fpyroh%2Egithub%2Eio%2Fdocsets%2FGifu%2Exml"><img src="../img/dash.png"/>Install in Dash</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Gifu Reference</a>
<img id="carat" src="../img/carat.png" />
GIFAnimatable Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/Animator.html">Animator</a>
</li>
<li class="nav-group-task">
<a href="../Classes/GIFImageView.html">GIFImageView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/GIFAnimatable.html">GIFAnimatable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/ImageContainer.html">ImageContainer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>GIFAnimatable</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">GIFAnimatable</span><span class="p">:</span> <span class="kd">class</span></code></pre>
</div>
</div>
<p>The protocol that view classes need to conform to to enable animated GIF support.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_"></a>
<a name="//apple_ref/swift/Property/animator" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable8animatorGSqCS_8Animator_">animator</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Responsible for managing the animation frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">animator</span><span class="p">:</span> <span class="kt"><a href="../Classes/Animator.html">Animator</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer"></a>
<a name="//apple_ref/swift/Property/layer" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5layerCSo7CALayer">layer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Notifies the instance that it needs display.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">layer</span><span class="p">:</span> <span class="kt">CALayer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect"></a>
<a name="//apple_ref/swift/Property/frame" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable5frameVSC6CGRect">frame</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>View frame used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">frame</span><span class="p">:</span> <span class="kt">CGRect</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode"></a>
<a name="//apple_ref/swift/Property/contentMode" class="dashAnchor"></a>
<a class="token" href="#/s:vP4Gifu13GIFAnimatable11contentModeOSC17UIViewContentMode">contentMode</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Content mode used for resizing the frames.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">contentMode</span><span class="p">:</span> <span class="kt">UIViewContentMode</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:ve4GifuRxS_13GIFAnimatablexS_14ImageContainerrS0_20intrinsicContentSizeVSC6CGSize"></a>
<a name="//apple_ref/swift/Property/intrinsicContentSize" class="dashAnchor"></a>
<a class="token" href="#/s:ve4GifuRxS_13GIFAnimatablexS_14ImageContainerrS0_20intrinsicContentSizeVSC6CGSize">intrinsicContentSize</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the intrinsic content size based on the size of the image.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">intrinsicContentSize</span><span class="p">:</span> <span class="kt">CGSize</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_"></a>
<a name="//apple_ref/swift/Property/activeFrame" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable11activeFrameGSqCSo7UIImage_">activeFrame</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the active frame if available.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">activeFrame</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable10frameCountSi"></a>
<a name="//apple_ref/swift/Property/frameCount" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable10frameCountSi">frameCount</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Total frame count of the GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">frameCount</span><span class="p">:</span> <span class="kt">Int</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb"></a>
<a name="//apple_ref/swift/Property/isAnimatingGIF" class="dashAnchor"></a>
<a class="token" href="#/s:vE4GifuPS_13GIFAnimatable14isAnimatingGIFSb">isAnimatingGIF</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Introspect whether the instance is animating.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">isAnimatingGIF</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT12withGIFNamedSS_T_">animate(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/animate(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable7animateFT11withGIFDataV10Foundation4Data_T_">animate(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">animate</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFNamed:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT12withGIFNamedSS_T_">prepareForAnimation(withGIFNamed:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepares the animator instance for animation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFNamed</span> <span class="nv">imageName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageName</em>
</code>
</td>
<td>
<div>
<p>The file name of the GIF in the main bundle.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_"></a>
<a name="//apple_ref/swift/Method/prepareForAnimation(withGIFData:)" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19prepareForAnimationFT11withGIFDataV10Foundation4Data_T_">prepareForAnimation(withGIFData:)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Prepare for animation and start animating immediately.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForAnimation</span><span class="p">(</span><span class="n">withGIFData</span> <span class="nv">imageData</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>imageData</em>
</code>
</td>
<td>
<div>
<p>GIF image data.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_"></a>
<a name="//apple_ref/swift/Method/prepareForReuse()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable15prepareForReuseFT_T_">prepareForReuse()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating and free up GIF data from memory.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">prepareForReuse</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/startAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable17startAnimatingGIFFT_T_">startAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Start animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">startAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_"></a>
<a name="//apple_ref/swift/Method/stopAnimatingGIF()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable16stopAnimatingGIFFT_T_">stopAnimatingGIF()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Stop animating GIF.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">stopAnimatingGIF</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_"></a>
<a name="//apple_ref/swift/Method/updateImageIfNeeded()" class="dashAnchor"></a>
<a class="token" href="#/s:FE4GifuPS_13GIFAnimatable19updateImageIfNeededFT_T_">updateImageIfNeeded()</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Updates the image with a new frame if necessary.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">updateImageIfNeeded</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>2015 © Reda Lemeden. See LICENSE for more details.</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>