IOS uses TableView for Pull-down amplification
Last Update:2015-09-30
Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">First Step: decorate the topview that need to be enlarged:</span></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;"></span></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">1. Create TopView</span></p></p><pre><pre>Uiimageview *topview = [[uiimageview alloc] init];</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">2. Setting Up a picture</span></p></p><pre><pre>UIImage *image = [UIImage imagenamed:<span style="color: #800000;">@ "</span><span style="color: #800000;">big.jpg</span><span style="color: #800000;">"</span><span style="color: #000000;"></span>= image;</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">3. Set the initial position and content mode of the TopView</span></p></p><pre><pre><span style="color: #008000;">//</span> <span style="color: #008000;">initial position</span> topview.frame = CGRectMake (<span style="color: #800080;">0</span>,-<span style="color: #000000;"></span>= uiviewcontentmodescaleaspectfill;</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">4. Set the inner margin to move the TableView Contentview down</span></p></p><pre><pre><span style="color: #800080;">2</span> <span style="color: #800080;">0</span> <span style="color: #800080;">0</span> <span style="color: #800080;">0</span>);</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">5. Insert the TopView into the bottom of the TableView (contentview Below)</span></p></p><pre><pre>[self.tableview Insertsubview:topview atindex:<span style="color: #800080;">0</span><span style="color: #000000;"></span>= topView;</pre></pre><p><p></p></p><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">Step two: Implement the Drop-down amplification:</span></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;"></span></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">1. By proxy method:<span style="font: 14.0px Menlo; font-family: ‘Helvetica Neue‘; font-size: 14px;">scrollviewdidscroll: implementation of pull</span> -down amplification</span></p></p><pre><pre>-(<span style="color: #0000ff;">void</span>) scrollviewdidscroll: (uiscrollview *) ScrollView</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">2. Get the Drop-down distance</span></p></p><pre><pre><span style="color: #800080;">2</span> -scrollview.contentoffset.y;</pre></pre><p><p></p></p><p><p><span style="font-family: ‘Helvetica Neue‘; font-size: 14px;">3. Zoom TopView According to Pull-down distance</span></p></p><pre><pre><span style="color: #0000ff;">if</span> <span style="color: #800080;">0</span> <span style="color: #000000;">) { </span>= Cgaffinetransformmakescale (<span style="color: #800080;">1</span><span style="color: #800080;">0.005</span><span style="color: #800080;">1</span><span style="color: #800080;">0.005</span>); <span style="color: #008000;">//</span> <span style="color: #008000;">0.005, magnification factor</span> }</pre></pre><p><p></p></p><p><p></p></p><p><p>Demo:https://github.com/bigplane/downmagnifydemo</p></p><p><p></p></p><p><p>IOS uses TableView for Pull-down amplification</p></p></span>