[IOS] Have you used the native UIRefreshControl ?, Ios7.1.2 native font
The third party is too powerful, pull up and refresh, pull down, left, right, various refreshes,
First, we will introduce several third parties:
JHRefresh: https://github.com/Jiahai/JHRefresh
You can customize the animation top and drop-down refresh. The Demo effect is similar to the animation effect of public comments. The animation is implemented by frame animation.
Then bring your own picture group ~ ~ ~
MJRefresh: https://github.com/CoderMJLee/MJRefresh
Simple to use and support TableView and CollectionView at the same time: For details, see github connection.
AAPullToRefresh: https://github.com/r-plus/AAPullToRefresh
Pull up and pull down the front. This can be left or right. It's amazing.
TMOTableView: https://github.com/duowan/TMOTableView
When our friends pull and refresh, this feature is to support automatic click loading.
User-friendly ...... XXX ~~
Of course, there is still a long history... Something that looks old...
EGOTableViewPullRefresh: https://github.com/enormego/EGOTableViewPullRefresh
After talking about a powerful third party, the native UIRefreshControl becomes lost and interpersonal...
Momo alone cry .... But sometimes we don't need to be so powerful as long as a simple pull-down refresh...
Let's talk about the story of UIRefreshControl...
First, it can only be used in TableView, and you will find in UITableViewController
Specific Code:
Self. refresh = [[UIRefreshControl alloc] init]; NSLog (@ "%. 2f %. 2f ", self. refresh. frame. size. width, self. refresh. frame. size. height); self. refresh. tintColor = [UIColor blueColor]; self. refresh. attributedTitle = [[NSAttributedString alloc] initWithString: @ "pull-down refresh"]; [self. refresh addTarget: self action: @ selector (RefreshViewControlEventValueChanged) forControlEvents: UIControlEventValueChanged]; [self. tableView addSubview: self. refresh];
<pre name="code" class="objc">- (void)RefreshViewControlEventValueChanged{ NSLog(@"Refresh XXXX"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{// [loadingImageView removeFromSuperview]; [self.refresh endRefreshing]; });}
When you jump to the header file, you will find that there are few items in it, and the frame of UIRefreshControl is also the default one, which is usually the Controller or View on which it depends.
Generally, it is UITableViewController or TableView. A UIControlEventValueChanged notification will be broadcast during the drop-down.
So much we can do .....
Can we customize images to implement drop-down animation similar to the fruit library?
Find a way to add images, and then find the following code, but the animation of the system will be in the middle of the image
loadingImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"loading"]]; loadingImageView.center = CGPointMake(187.5, 40); [self.refresh insertSubview:loadingImageView atIndex:0]; [self.refresh bringSubviewToFront:loadingImageView];
Then we can determine that we can only inherit and override UIRefreshControl, and then it becomes more complicated .. .
It's almost time to eat... Find and add it... Y_Y ~