IOS uses TableView for Pull-down amplification

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.