| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- #import "attrViewController.h"
- #import "fans.h"
- #import "fansModel.h"
- #import "YBCenterVC.h"
- #import "ZFModalTransitionAnimator.h"
- #import "AFNetworking.h"
- @interface attrViewController ()<UITableViewDelegate,UITableViewDataSource,guanzhu>
- {
-
- NSInteger a;
- int _paging;
- }
- @property(nonatomic,strong)NSString *navTitle;
- @property(nonatomic,strong)NSString *noData1;
- @property(nonatomic,strong)NSString *noData2;
- @property(nonatomic,copy)NSString *btnn;
- @property(nonatomic,strong)NSArray *fansmodels;
- @property(nonatomic,strong)NSMutableArray *allArray;
- @property(nonatomic,strong)UITableView *tableView;
- @property (nonatomic, strong) ZFModalTransitionAnimator *animator;
- @end
- @implementation attrViewController
- -(NSArray *)fansmodels{
-
- NSMutableArray *array = [NSMutableArray array];
-
- for (NSDictionary *dic in self.allArray) {
-
- fansModel *model = [fansModel modelWithDic:dic];
-
- [array addObject:model];
- }
- _fansmodels = array;
-
- return _fansmodels;
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [self createView];
- [self request];
- }
- -(void)createView{
-
- }
- -(void)request{
- [YBNetworking postWithUrl:@"User.getFollowsList" Dic:@{@"touid":self.guanzhuUID,@"p":@(_paging)} Suc:^(int code, id info, NSString *msg) {
- [_tableView.mj_header endRefreshing];
- [_tableView.mj_footer endRefreshing];
- if (code == 0) {
- if (_paging == 1) {
- [_allArray removeAllObjects];
- }
- NSArray *infoA = [NSArray arrayWithArray:info];
- if (infoA.count<=0) {
- [_tableView.mj_footer endRefreshingWithNoMoreData];
- }else{
- [_allArray addObjectsFromArray:infoA];
- }
- if (_allArray.count == 0) {
- [PublicView showTextNoData:_tableView text1:_noData1 text2:_noData2 centerY:0.8];
- }else{
- [PublicView hiddenTextNoData:_tableView];
- }
- [_tableView reloadData];
-
- }else{
- [MBProgressHUD showPop:msg];
- }
- } Fail:^(id fail) {
- [_tableView.mj_header endRefreshing];
- [_tableView.mj_footer endRefreshing];
- }];
- }
- /*
- -(void)requestOr {
-
- YBWeakSelf;
-
- AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
- NSString *url = [purl stringByAppendingFormat:@"?service=User.getFollowsList&uid=%@&touid=%@&p=%@",[Config getOwnID],self.guanzhuUID,@"1"];
- [session GET:url parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- //NSLog(@"%@",responseObject);
- NSNumber *number = [responseObject valueForKey:@"ret"] ;
- if([number isEqualToNumber:[NSNumber numberWithInt:200]]) {
- NSArray *data = [responseObject valueForKey:@"data"];
- NSNumber *code = [data valueForKey:@"code"];
- if([code isEqualToNumber:[NSNumber numberWithInt:0]]) {
- NSArray *info = [data valueForKey:@"info"];
- self.allArray = info;//关注信息复制给数据源
- [self.tableView.mj_header endRefreshing];
- [self.tableView reloadData];
- //如果数据为空
- if (self.allArray.count == 0) {
- [PublicView showTextNoData:weakSelf.tableView text1:weakSelf.noData1 text2:weakSelf.noData2];
- }else{
- [PublicView hiddenTextNoData:weakSelf.tableView];
- }
- }else{
- [self.tableView.mj_header endRefreshing];
- [PublicView showTextNoData:weakSelf.tableView text1:weakSelf.noData1 text2:weakSelf.noData2];
- }
- }else{
- [self.tableView.mj_header endRefreshing];
- [PublicView showTextNoData:weakSelf.tableView text1:weakSelf.noData1 text2:weakSelf.noData2];
- }
- //指示器消失
- [PublicView indictorHide];
- }failure:^(NSURLSessionDataTask *task, NSError *error) {
- [self.tableView.mj_header endRefreshing];
- //指示器消失
- [PublicView indictorHide];
- if (self.allArray.count == 0) {
- [PublicView showTextNoData:weakSelf.tableView text1:weakSelf.noData1 text2:weakSelf.noData2];
- }
- }];
- }
- */
- - (UIStatusBarStyle)preferredStatusBarStyle {
- if (@available(iOS 13.0,*)) {
- return UIStatusBarStyleDarkContent;
- }
- return UIStatusBarStyleDefault;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationController.interactivePopGestureRecognizer.delegate = (id) self;
-
- self.btnn = [[NSString alloc]init];
- self.btnn = [NSString stringWithFormat:@"a"];
-
- self.allArray = [NSMutableArray array];
- _paging = 1;
-
- if ([_guanzhuUID isEqual:[Config getOwnID]]) {
- _navTitle = YZMsg(@"我的关注");
- _noData1 = YZMsg(@"你还没有关注任何人");
- _noData2 = YZMsg(@"赶快去关注自己感兴趣的人吧");
- }else{
- _navTitle = YZMsg(@"TA的关注");
- _noData1 = YZMsg(@"TA还没有关注任何人");
- _noData2 = @"";
- }
- self.titleL.text = _navTitle;
-
- self.subNavi.backgroundColor = UIColor.whiteColor;
- self.titleL.textColor = UIColor.blackColor;
- [self.leftBtn setImage:[UIImage imageNamed:@"pub_back_black"] forState:0];
- self.naviLine.hidden = NO;
- self.naviLine.backgroundColor = RGB(245, 245, 245);
- self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,64+statusbarHeight, _window_width, _window_height-64-statusbarHeight) style:UITableViewStylePlain];
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.backgroundColor = UIColor.whiteColor;
- YBWeakSelf;
- _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- _paging = 1;
- [weakSelf request];
- }];
-
- _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
- _paging +=1;
- [weakSelf request];
- }];
- [self.view addSubview:self.tableView];
- [self.view setBackgroundColor:[UIColor whiteColor]];
-
- //指示器显示
- // [PublicView indictorShow];
- //
- // [self request];
-
-
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.fansmodels.count;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- fans *cell = [fans cellWithTableView:tableView];
- cell.backgroundColor = UIColor.whiteColor;
- fansModel *model = self.fansmodels[indexPath.row];
- cell.model = model;
- cell.guanzhuDelegate = self;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 90;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- fansModel *model = _fansmodels[indexPath.row];
- YBCenterVC *center = [[YBCenterVC alloc]init];
- center.otherUid = model.uid;
- center.isPush = YES;
- //[self.navigationController pushViewController:center animated:YES];
- [[YBBaseAppDelegate sharedAppDelegate] pushViewController:center animated:YES];
-
- }
- -(void)doGuanzhu:(NSString *)st{
- //要求不要立刻刷新
- //[self request];
-
- }
- #pragma mark - 导航
- @end
|