無標題文章

////? AddressBookViewController.h//? QRCodeScanApp////? Created by 密碼123 on 16/9/18.//? Copyright ? 2016年 密碼123. All rights reserved.//#import@interface AddressBookViewController : CustomeNavigationViewController@end




////? AddressBookViewController.m//? QRCodeScanApp////? Created by 密碼123 on 16/9/18.//? Copyright ? 2016年 密碼123. All rights reserved.//#import "MymemberModel.h"#import "MyMemberCell.h"#import "memberFirstSectionCell.h"#import "GroupNewsTwoCell.h"#import "CFPopView.h"#import "CFFuncModel.h"#import "GroupNewsViewController.h"#import "NewGroupViewController.h"#import "AddressBookViewController.h"#import "UploadGroupViewController.h"#import "LZActionSheet.h"@interface AddressBookViewController (){? ? ? ? NSMutableArray *_sectionAry;? ? ? ? UIView *_theBgView;}@property (nonatomic,strong) UITableView *tvContent;@property (nonatomic, strong) CFPopView *popView;@property (nonatomic,retain) NSMutableArray *dataList;@property (strong,nonatomic) NSMutableArray? *searchList;@property (nonatomic,strong) UITableView *tableView;@property (nonatomic,strong) UISearchController *searchController;@property (nonatomic,retain) NSArray *imgOfFirstSectionAry;@property (nonatomic,retain) NSArray *titleOfFirstSectionAry;@end@implementation AddressBookViewController- (void)viewDidLoad {? ? [super viewDidLoad];? ? // Do any additional setup after loading the view.? ? self.view.backgroundColor=[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0];? ? [self initNavigationBar];? ? ? ? ? ? [self initWithcontrols];? ? ? ? [self initDatasource];? ? [self ZYHHandleData];? ? }-(void)viewWillDisappear:(BOOL)animated{? ? [super viewWillDisappear:animated];? ? if (self.popView.isShow)? ? {? ? ? ? [self.popView dismissFromKeyWindow];? ? ? ? [_theBgView removeFromSuperview];? ? }? ? }-(void)addPopview{? ? NSArray *dictArr=@[@{@"title":@"新建群組", @"iconName":@"4E48C566-B345-4125-A7C7-F7B9C9AB3C2B.png"},@{@"title":@"導入會員", @"iconName":@"CEF58191-4478-4CFD-B37E-8DF7271C267C.png"}];? ? self.popView = [CFPopView popViewWithFuncDicts:dictArr withpoint:CGPointMake(SCREEN_WIDTH-10-125, 64)];? ? ? ? __weak typeof (self) weakSelf = self;? ? ? ? ? ? self.popView.myFuncBlock = ^(NSInteger index){? ? ? ? ? ? ? ? NSLog(@"%ld", index);? ? ? ? switch (index) {? ? ? ? ? ? case 0:? ? ? ? ? ? {? ? ? ? ? ? ? ? [weakSelf doRemoveView];? ? ? ? ? ? ? ? NewGroupViewController *NewGroupVC=[[NewGroupViewController alloc]init];? ? ? ? ? ? ? ? NewGroupVC.hidesBottomBarWhenPushed = YES;? ? ? ? ? ? ? ? [weakSelf.navigationController pushViewController:NewGroupVC animated:YES];? ? ? ? ? ? }? ? ? ? ? ? ? ? break;? ? ? ? ? ? case 1:? ? ? ? ? ? {? ? ? ? ? ? ? ? [weakSelf doRemoveView];? ? ? ? ? ? ? ? UploadGroupViewController *UploadGroupVC=[[UploadGroupViewController alloc]init];? ? ? ? ? ? ? ? UploadGroupVC.hidesBottomBarWhenPushed = YES;? ? ? ? ? ? ? ? [weakSelf.navigationController pushViewController:UploadGroupVC animated:YES];? ? ? ? ? ? }? ? ? ? ? ? ? ? break;? ? ? ? ? ? default:? ? ? ? ? ? ? ? break;? ? ? ? }? ? ? ? ? ? ? ? [weakSelf.popView dismissFromKeyWindow];? ? };}-(void)initNavigationBar{? ? [self setNavLeftItemImage:[[UIImage imageNamed:@"mass-textiong-sercret.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] withSelector:@selector(leftTouch:)];? ? [self setNavRightItem:[[UIImage iconWithInfo:TBCityIconInfoMake(@"\U0000e929 ", 20, [HqewUtil colorWithHexString:@"#50acee"])] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] withSelector:@selector(rightTouch:)];? ? [self setNavtitleItem:@"會員"];}//刷新- (void) addRefreshHeaderView {? ? __unsafe_unretained typeof(self) vc = self;? ? // 添加上拉刷新尾部控件? ? [_tvContent addLegendHeaderWithRefreshingBlock:^{? ? ? ? // 進入刷新狀態(tài)就會回調這個Block? ? ? ? ? ? ? ? dispatch_async(dispatch_get_main_queue(), ^{? ? ? ? [vc.tvContent.header endRefreshing];? ? ? ? ? ? [vc ZYHHandleData];? ? ? ? });? ? }];}-(void)initWithcontrols{? ? _tvContent = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStylePlain];? ? _tvContent.separatorColor = [UIColor clearColor];? ? _tvContent.dataSource = self;? ? _tvContent.delegate = self;? ? _tvContent.separatorStyle = UITableViewCellSeparatorStyleSingleLine;? ? [self.view addSubview:_tvContent];? ? [self addRefreshHeaderView];? ? ? ? ? ? ? ? ? ? /*searchBar*/? ? _searchController=[[UISearchController alloc]initWithSearchResultsController:nil];? ? ? ? _searchController.delegate=self;? ? ? ? _searchController.searchResultsUpdater=self;? ? ? ? _searchController.dimsBackgroundDuringPresentation=NO;? ? ? ? _searchController.obscuresBackgroundDuringPresentation=NO;? ? ? ? _searchController.hidesNavigationBarDuringPresentation=NO;? ? ? ? ? ? _searchController.searchBar.frame=CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44);? ? ? ? _searchController.searchBar.placeholder = @"搜索";? ? ? ? ? ? _searchController.searchBar.backgroundColor=[UIColor clearColor];? ? [_searchController.searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"contact_searchbg_ios6"] forState:UIControlStateNormal];? ? ? ? ? ? //隱藏搜索圖標? ? [_searchController.searchBar setImage:[UIImage imageNamed:@"contact_search_btn"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateDisabled];? ? _searchController.searchBar.keyboardType =? UIKeyboardTypeDefault;? ? _searchController.searchBar.delegate = self;? ? ? ? // 修改searchBar的背景顏色? ? float version = [[[UIDevice currentDevice] systemVersion] floatValue];? ? if ([_searchController.searchBar respondsToSelector:@selector(barTintColor)])? ? {? ? ? ? float iosVersion7_1 = 7.1;? ? ? ? ? ? ? ? if (version >= iosVersion7_1) {? ? ? ? ? ? [[[[_searchController.searchBar.subviews objectAtIndex:0] subviews] objectAtIndex:0] removeFromSuperview];? ? ? ? ? ? [_searchController.searchBar setBackgroundColor:[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0]];? ? ? ? }? ? ? ? else {? ? ? ? ? ? [_searchController.searchBar setBarTintColor:[UIColor clearColor]];? ? ? ? ? ? [_searchController.searchBar setBackgroundColor:[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0]];? ? ? ? }? ? }? ? else? ? {? ? ? ? [[_searchController.searchBar.subviews objectAtIndex:0] removeFromSuperview];? ? ? ? [_searchController.searchBar setBackgroundColor:[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0]];? ? }? ? ? ? //? ? //隱藏找資源上面的搜索框? ? _tvContent.tableHeaderView = _searchController.searchBar;}-(void)initDatasource{? ? _sectionAry=[[NSMutableArray alloc]initWithObjects:@"",@"我的會員", nil];? ? self.dataList=[NSMutableArray arrayWithCapacity:0];? ? ? ? _imgOfFirstSectionAry=@[@"3E8F56B2-EE72-4824-9184-0A265012F28B.png",@"5C051F2A-2A5A-4076-87EA-9E37F4E59C53.png",@"F3AE7A16-0854-4AFE-88D0-89DFDC1EAD77.png",@"F91EBB54-46C5-45B3-8D90-CF9FCD486BB7.png"];? ? _titleOfFirstSectionAry=@[@"新的會員",@"俱樂部",@"標簽",@"活動群組"];}#pragma mark - UITableViewDelegate,UITableViewDataSource- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{? ? if (self.searchController.active)? ? {? ? ? ? return 0;? ? }? ? else? ? {? ? ? ? return? _sectionAry.count;? ? }}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{? ? if (self.searchController.active)? ? {? ? ? ? return 0;? ? }? ? else? ? {? ? ? ? if (section==0)? ? ? ? {? ? ? ? ? ? return 4;? ? ? ? }? ? ? ? else? ? ? ? {? ? ? ? ? ? return self.dataList.count;? ? ? ? }? ? }}- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{? ? return 55;}-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{? ? if (self.searchController.active)? ? {? ? ? ? return 0.01;? ? }? ? else? ? {? ? ? ? if (section==0)? ? ? ? {? ? ? ? ? ? return 0.01;? ? ? ? }? ? ? ? else? ? ? ? {? ? ? ? ? ? return 36.0;? ? ? ? }? ? }}-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{? ? if (_searchController.active)? ? {? ? ? ? return nil;? ? }? ? else? ? {? ? ? ? UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];? ? ? ? btn.frame=CGRectMake(0, 0, SCREEN_WIDTH, 44);? ? ? ? ? ? ? ? UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-10, 44)];? ? ? ? label.text=_sectionAry[section];? ? ? ? label.font=[UIFont systemFontOfSize:15];? ? ? ? btn.backgroundColor=[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0];? ? ? ? label.textColor=[UIColor grayColor];? ? ? ? ? ? ? ? label.backgroundColor=[UIColor clearColor];? ? ? ? ? ? ? ? [btn addSubview:label];? ? ? ? ? ? ? ? return btn;? ? }? ? }- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{? ? if (_searchController.active)? ? {? ? ? ? static NSString *flag = @"cell";? ? ? ? UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:flag];? ? ? ? if (!cell) {? ? ? ? ? ? cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:flag];? ? ? ? }? ? ? ? ? ? ? ? [cell.textLabel setText:self.searchList[indexPath.row]];? ? ? ? ? ? ? ? return cell;? ? }? ? else? ? {? ? ? ? if (indexPath.section==0)? ? ? ? {? ? ? ? ? ? static NSString *flag = @"memberFirstSectionCell";? ? ? ? ? ? memberFirstSectionCell *cell =[tableView dequeueReusableCellWithIdentifier:flag];? ? ? ? ? ? if (!cell) {? ? ? ? ? ? ? ? cell=[[memberFirstSectionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:flag withHeight:55.0];? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? ? ? [cell setFirstCell:[_titleOfFirstSectionAry objectAtIndex:indexPath.row] and:[_imgOfFirstSectionAry objectAtIndex:indexPath.row]];? ? ? ? ? ? ? ? ? ? ? ? return cell;? ? ? ? }? ? ? ? else? ? ? ? {? ? ? ? ? ? static NSString *strIdentifer = @"MyMemberCell";? ? ? ? ? ? MyMemberCell *cell = [tableView dequeueReusableCellWithIdentifier:strIdentifer];? ? ? ? ? ? if (!cell) {? ? ? ? ? ? ? ? cell=[[MyMemberCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strIdentifer withHeight:55.0];? ? ? ? ? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? if (indexPath.row0)

{

[_tvContent reloadData];

}

}

}

else

{

[SVProgressHUD showInfoWithStatus:[NSString stringWithFormat:@"%@",[dic objectForKey:@"msg"]]];

}

} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

NSLog(@"%@", error);

[self.tableView.header endRefreshing];

[MBProgressHUD hideAllHUDsForView:self.view animated:YES];

}];

}

/*

#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

// Get the new view controller using [segue destinationViewController].

// Pass the selected object to the new view controller.

}

*/

@end

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子蕴茴,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,729評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件正驻,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機桥温,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,226評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來梁丘,“玉大人侵浸,你說我怎么就攤上這事》彰眨” “怎么了掏觉?”我有些...
    開封第一講書人閱讀 169,461評論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長值漫。 經常有香客問我澳腹,道長,這世上最難降的妖魔是什么杨何? 我笑而不...
    開封第一講書人閱讀 60,135評論 1 300
  • 正文 為了忘掉前任酱塔,我火速辦了婚禮,結果婚禮上危虱,老公的妹妹穿的比我還像新娘羊娃。我一直安慰自己,他們只是感情好埃跷,可當我...
    茶點故事閱讀 69,130評論 6 398
  • 文/花漫 我一把揭開白布蕊玷。 她就那樣靜靜地躺著邮利,像睡著了一般。 火紅的嫁衣襯著肌膚如雪垃帅。 梳的紋絲不亂的頭發(fā)上延届,一...
    開封第一講書人閱讀 52,736評論 1 312
  • 那天,我揣著相機與錄音挺智,去河邊找鬼祷愉。 笑死,一個胖子當著我的面吹牛赦颇,可吹牛的內容都是我干的。 我是一名探鬼主播赴涵,決...
    沈念sama閱讀 41,179評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼媒怯,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了髓窜?” 一聲冷哼從身側響起扇苞,我...
    開封第一講書人閱讀 40,124評論 0 277
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎寄纵,沒想到半個月后鳖敷,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經...
    沈念sama閱讀 46,657評論 1 320
  • 正文 獨居荒郊野嶺守林人離奇死亡程拭,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,723評論 3 342
  • 正文 我和宋清朗相戀三年定踱,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片恃鞋。...
    茶點故事閱讀 40,872評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡崖媚,死狀恐怖,靈堂內的尸體忽然破棺而出恤浪,到底是詐尸還是另有隱情畅哑,我是刑警寧澤,帶...
    沈念sama閱讀 36,533評論 5 351
  • 正文 年R本政府宣布水由,位于F島的核電站荠呐,受9級特大地震影響,放射性物質發(fā)生泄漏砂客。R本人自食惡果不足惜泥张,卻給世界環(huán)境...
    茶點故事閱讀 42,213評論 3 336
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望鞭盟。 院中可真熱鬧圾结,春花似錦、人聲如沸齿诉。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,700評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至歇竟,卻和暖如春挥唠,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背焕议。 一陣腳步聲響...
    開封第一講書人閱讀 33,819評論 1 274
  • 我被黑心中介騙來泰國打工宝磨, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人盅安。 一個月前我還...
    沈念sama閱讀 49,304評論 3 379
  • 正文 我出身青樓唤锉,卻偏偏與公主長得像,于是被迫代替她去往敵國和親别瞭。 傳聞我的和親對象是個殘疾皇子窿祥,可洞房花燭夜當晚...
    茶點故事閱讀 45,876評論 2 361

推薦閱讀更多精彩內容

  • 1、設置UILabel行間距 NSMutableAttributedString*attrString=[[NSM...
    iOS祎閱讀 2,169評論 0 0
  • Mode================SqlData.h. 首先 添加頭文件#import { sqlite3 ...
    代碼搬運包工頭閱讀 178評論 0 0
  • 概述在iOS開發(fā)中UITableView可以說是使用最廣泛的控件蝙寨,我們平時使用的軟件中到處都可以看到它的影子晒衩,類似...
    liudhkk閱讀 9,067評論 3 38
  • 一、集合概述 Java是一種面向對象語言墙歪,如果我們要針對多個對象進行操作听系,就必須對多個對象進行存儲。而數(shù)組長度固定...
    阿里巴特愛扯皮閱讀 144評論 0 0
  • “你覺得你愛的人都不在了虹菲,你不愿意活下去靠胜,那你死了,愛你的人怎么辦届惋?你們?yōu)楹稳绱私^情”
    雨里里閱讀 175評論 0 0