12-29 buy the tail of the interface: load more designs

Source: Internet
Author: User
Tags uikit

Just like yesterday's custom cell, you still need to customize a view to show Footerview

Similar content is not discussed, only the different parts are discussed

1. Design the content of the custom tail

There is a new point of knowledge that simulates clicking on the downloaded data from the network, then the button disappears, the display is loading, and then a new cell appears. This time a new function is needed, the code is as follows:

Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (3.0 * nsec_per_sec)), Dispatch_get_main_queue (), ^{

Self.loadMoreBtn.hidden = NO;

Self.loadingView.hidden = YES;

This function means delaying 3 seconds to perform the operation.

2. Set the agent for Footview and make controller the agent of Footview. Notifies the controller to load a new cell when the Footview internal button is clicked. The specific implementation code is as follows:

2.1 First to set the agent Footview, in the. h file: #import <UIKit/UIKit.h>

1. Defining the Proxy protocol

@class Czfootview;

@protocol czfooterviewdelegate <NSObject>

@optional

3.1 Declaring proxy methods

-(void) FOOTERVIEWDIDCLICKEDLOADMOREBTN: (Czfootview *) Footerview;

@end

@interface Czfootview:uiview

2. Defining Proxy Properties

@property (nonatomic, weak) id<czfooterviewdelegate> delegate;

+ (instancetype) Footview;

@end

In the. m file, when the Loadmorebtnclick method sends a message to the agent, it tells the agent to invoke the proxy method. The code is as follows:

2.2 Implementing the Proxy method in the controller's. m file

The actual results are as follows:

12-29 buy the tail of the interface: load more designs

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.