• 黔江:1000余亩蓝莓成熟 市民乐享“莓”好时光 2019-05-22
  • 【周展安】重新认识《在延安文艺座谈会上的讲话》的现实意义 2019-05-22
  • 十九大代表卢丽安利用周末与在沪台胞分享她参会心得  2019-05-19
  • (两会受权发布)最高人民法院院长简历 2019-05-14
  • 巫山县大峡村:深度贫困村的脱贫之变 2019-05-12
  • “关注泌尿健康”三金片媒体沙龙北京站 2019-05-09
  • 人民网评:教师欠薪为何又成新闻了? 2019-05-07
  • 涪陵:全国人大代表刘家奇院坝讲“两会” 乡亲点赞“六子致富经” 2019-05-07
  • 海南将与香港携手开拓国际客源市场--旅游频道 2019-05-01
  • 赵孟頫:书法大师是怎么炼成的? 2019-04-28
  • 只看到“贫穷”而看不到“富裕”,只看到贫富差别而看不到其根源是社会财富被个人占为私有的私有制,都是片面错误的。 2019-04-25
  • 紫光阁中共中央国家机关工作委员会 2019-04-25
  • 大众因“排放门”被罚10亿欧元 外媒:处罚还没完 2019-04-11
  • 俄罗斯足球队50横扫沙特队真是让人大饱眼福,特提精神!俄罗斯是战斗民族名不虚传。 2019-04-09
  • 西安启动唐长安城明德门遗址保护工程 2019-04-07
  • 今天看啥
      热点:

        新疆35选7的开奖号 www.ts3ne.com

        iOS-加载数据的实现-MJRefresh,ios-加载-mjrefresh


        使用CocoaPods加载三方库:

        pod 'MJRefresh'

         

        MJRefresh类结构图:


         

        具体实现方法和效果图:

        • The drop-down refresh 01-Default

          self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
             //Call this Block When enter the refresh status automatically 
          }];
          或
          // Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
          self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
          
          // Enter the refresh status immediately
          [self.tableView.header beginRefreshing];

          (下拉刷新01-普通)

        • The drop-down refresh 02-Animation image

          // Set the callback(一Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
          MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
          // Set the ordinary state of animated images
          [header setImages:idleImages forState:MJRefreshStateIdle];
          // Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
          [header setImages:pullingImages forState:MJRefreshStatePulling];
          // Set the refreshing state of animated images
          [header setImages:refreshingImages forState:MJRefreshStateRefreshing];
          // Set header
          self.tableView.mj_header = header;

          (下拉刷新02-动画图片)

        • The drop-down refresh 03-Hide the time

          // Hide the time
          header.lastUpdatedTimeLabel.hidden = YES;

          (下拉刷新03-隐藏时间)

        • The drop-down refresh 04-Hide status and time

          // Hide the time
          header.lastUpdatedTimeLabel.hidden = YES;
          
          // Hide the status
          header.stateLabel.hidden = YES;

          (下拉刷新04-隐藏状态和时间0)

        • The drop-down refresh 05-DIY title

          // Set title
          [header setTitle:@"Pull down to refresh" forState:MJRefreshStateIdle];
          [header setTitle:@"Release to refresh" forState:MJRefreshStatePulling];
          [header setTitle:@"Loading ..." forState:MJRefreshStateRefreshing];
          
          // Set font
          header.stateLabel.font = [UIFont systemFontOfSize:15];
          header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];
          
          // Set textColor
          header.stateLabel.textColor = [UIColor redColor];
          header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];

          (下拉刷新05-自定义文字)

        • The drop-down refresh 06-DIY the control of refresh

          self.tableView.mj_header = [MJDIYHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
          // Implementation reference to MJDIYHeader.h和MJDIYHeader.m

          (下拉刷新06-自定义刷新控件)

        • The pull to refresh 01-Default

          self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
              //Call this Block When enter the refresh status automatically
          }];
          或
          // Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
          self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

          (上拉刷新01-默认)

        • The pull to refresh 02-Animation image

          // Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
          MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
          
          // Set the refresh image
          [footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
          
          // Set footer
          self.tableView.mj_footer = footer;

          (上拉刷新02-动画图片)

        • The pull to refresh 03-Hide the title of refresh status

          // Hide the title of refresh status
          footer.refreshingTitleHidden = YES;
          // If does have not above method,then use footer.stateLabel.hidden = YES;

          (上拉刷新03-隐藏刷新状态的文字)

        • The pull to refresh 04-All loaded

          //Become the status of NoMoreData
          [footer noticeNoMoreData];

          (上拉刷新04-全部加载完毕)

        • The pull to refresh 05-DIY title

          // Set title
          [footer setTitle:@"Click or drag up to refresh" forState:MJRefreshStateIdle];
          [footer setTitle:@"Loading more ..." forState:MJRefreshStateRefreshing];
          [footer setTitle:@"No more data" forState:MJRefreshStateNoMoreData];
          
          // Set font
          footer.stateLabel.font = [UIFont systemFontOfSize:17];
          
          // Set textColor
          footer.stateLabel.textColor = [UIColor blueColor];

          (上拉刷新05-自定义文字)

        • The pull to refresh 06-Hidden After loaded

          //Hidden current control of the pull to refresh
          self.tableView.mj_footer.hidden = YES;

          (上拉刷新06-加载后隐藏)

        • The pull to refresh 07-Automatic back of the pull01

          self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

          (上拉刷新07-自动回弹的上拉01)

        • The pull to refresh 08-Automatic back of the pull02

          MJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
          
          // Set the normal state of the animated image
          [footer setImages:idleImages forState:MJRefreshStateIdle];
          //  Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
          [footer setImages:pullingImages forState:MJRefreshStatePulling];
          // Set the refreshing state of animated images
          [footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
          
          // Set footer
          self.tableView.mj_footer = footer;

          (上拉刷新07-自动回弹的上拉02)

        • The pull to refresh 09-DIY the control of refresh(Automatic refresh)

          self.tableView.mj_footer = [MJDIYAutoFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
          // Implementation reference to MJDIYAutoFooter.h和MJDIYAutoFooter.m

          (上拉刷新09-自定义刷新控件(自动刷新))

        • The pull to refresh 10-DIY the control of refresh(Automatic back)

          self.tableView.mj_footer = [MJDIYBackFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
          // Implementation reference to MJDIYBackFooter.h和MJDIYBackFooter.m

          (上拉刷新10-自定义刷新控件(自动回弹))

        • UICollectionView01-The pull and drop-down refresh

          // The drop-down refresh
          self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
             //Call this Block When enter the refresh status automatically 
          }];
          
          // The pull to refresh
          self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
             //Call this Block When enter the refresh status automatically
          }];

          (UICollectionView01-上下拉刷新)

        • UIWebView01-The drop-down refresh

          //Add the control of The drop-down refresh
          self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
             //Call this Block When enter the refresh status automatically
          }];

          (UICollectionView01-上下拉刷新)

        文章来源:https://github.com/CoderMJLee/MJRefresh

         

        新疆35选7的开奖号 www.ts3ne.comtrue//www.ts3ne.com/IOSjc/1316437.htmlTechArticleiOS-加载数据的实现-MJRefresh,ios-加载-mjrefresh 使用CocoaPods加载三方库: pod ' MJRefresh ' MJRefresh类结构图: 具体实现方法和效果图: The drop-d...

        相关文章

          暂无相关文章
        相关搜索:

        帮客评论

        视觉看点
      • 黔江:1000余亩蓝莓成熟 市民乐享“莓”好时光 2019-05-22
      • 【周展安】重新认识《在延安文艺座谈会上的讲话》的现实意义 2019-05-22
      • 十九大代表卢丽安利用周末与在沪台胞分享她参会心得  2019-05-19
      • (两会受权发布)最高人民法院院长简历 2019-05-14
      • 巫山县大峡村:深度贫困村的脱贫之变 2019-05-12
      • “关注泌尿健康”三金片媒体沙龙北京站 2019-05-09
      • 人民网评:教师欠薪为何又成新闻了? 2019-05-07
      • 涪陵:全国人大代表刘家奇院坝讲“两会” 乡亲点赞“六子致富经” 2019-05-07
      • 海南将与香港携手开拓国际客源市场--旅游频道 2019-05-01
      • 赵孟頫:书法大师是怎么炼成的? 2019-04-28
      • 只看到“贫穷”而看不到“富裕”,只看到贫富差别而看不到其根源是社会财富被个人占为私有的私有制,都是片面错误的。 2019-04-25
      • 紫光阁中共中央国家机关工作委员会 2019-04-25
      • 大众因“排放门”被罚10亿欧元 外媒:处罚还没完 2019-04-11
      • 俄罗斯足球队50横扫沙特队真是让人大饱眼福,特提精神!俄罗斯是战斗民族名不虚传。 2019-04-09
      • 西安启动唐长安城明德门遗址保护工程 2019-04-07