123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674 |
- #import "SchDetailVC.h"
- #import "CLButton.h"
- #import "STButton.h"
- #import "EXButton.h"
- #import "SchInfo.h"
- #import "SearchComment.h"
- #import "FaqVC.h"
- #import "ApplyVC.h"
- #import "descVC.h"
- #import "TopicesVC.h"
- #import "SchoolNewsVC.h"
- #import "MapVC.h"
- #import "KSchoolCell.h"
- @interface SchDetailVC ()<UIAlertViewDelegate,UITableViewDelegate,UITableViewDataSource>
- {
- UILabel *lbl00, *lbl01, *lbl02, *lbl03, *lbl10;
-
- UILabel *kName, *kPrice, *kType, *kCar, *kTime, *kAdress, *kPick;
-
- UIView *kHolder;
-
- CLButton *btn00, *btn01, *btn02, *btn3, *btn4, *btn5;
-
- UIScrollView *scroll;
-
- UITableView *mainTableView;
-
-
- SchInfo *schInfo;
- UIImageView *img00;
- NSMutableArray *starImgs;
- NSDictionary *model;
- NSArray *dataArray;
- NSArray *types;
- }
- @end
- @implementation SchDetailVC
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- self.title = @"驾校详情";
- self.view.backgroundColor = [UIColor whiteColor];
- [self configNavigationBar];
-
- [self myInit];
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- }
- #pragma mark -
- -(void)myInit
- {
- dataArray = [NSArray array];
- types = @[@"陪练",@"复训",@"计时训练",@"报名",@"",@"",@""];
-
- scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height - kNavOffSet - kSafeAreaBottomHeight)];
- [self.view addSubview:scroll];
- [self.view setBackgroundColor:[UIColor whiteColor]];
- scroll.scrollEnabled = YES;
-
- //下方按钮条
- UIView* bar = [[UIView alloc] initWithFrame:CGRectMake(0, kSize.height - kNavOffSet - 60 - kSafeAreaBottomHeight, self.view.width, 60)];
- [bar setBackgroundColor:backGroundColor];
- [self.view addSubview:bar];
- [self.view bringSubviewToFront:bar];
-
- NSArray* titles = @[@"点评",@"问答"/*,@"报名"*/];
- NSArray* images = @[@"img03pen.png",@"img04talk.png"/*,@"img05Rig.png"*/];
- CGFloat w,bd;
- w = 60;
- // bd = (self.view.width - w*3)/4.0;
- bd = (self.view.width - w*2)/3.0;
- for (int i =0; i<titles.count; i++) {
- STButton* btn = [[STButton alloc] initWithFrame:CGRectMake((bd+w)*i+bd, 0, w, 60)];
- [btn setStyle:1];
- [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:13 forState:UIControlStateNormal];
- [btn setTitleColor:subTitleColor forState:UIControlStateNormal];
- [btn target:self tag:i-3];
- [bar addSubview:btn];
- }
-
- UILabel* label;
- UIImageView* iv;
- CLButton* btn;
- CGFloat dx,dy;
- CGFloat imgw;
- CGFloat curTop;
-
- dx = 90; dy = dx*.6; bd = 8;
- iv = [[UIImageView alloc] initWithFrame:SGRectMake(bd, bd , dx, dy)];
- [iv setContentMode:UIViewContentModeScaleAspectFit];
- [iv setImage:[UIImage imageNamed:@"nope_pic_icon.png"]];
- [scroll addSubview:iv];
- //头像
- img00 = iv;
-
- label = [[UILabel alloc] initWithFrame:SGRectMake(dx+bd*2, 0, dx*2 + 20, (dy+bd*2)/3)];
- [scroll addSubview:label];
- //名称
- lbl00 = label;
-
- imgw = 10;
- //星星
- starImgs = [NSMutableArray array];
- for (int i =0; i<5; i++)
- {
- iv = [[UIImageView alloc] initWithFrame:SGRectMake(dx+bd*2 + imgw*1.3*i, (dy+bd*2)/2-imgw/2, imgw, imgw)];
- [iv setImage:[UIImage imageNamed:@"rankstar0_img.png"]];
- iv.hidden = YES;
- [scroll addSubview:iv];
- [starImgs addObject:iv];
- }
-
- label = [[UILabel alloc] initWithFrame:SGRectMake(dx+bd*2, (dy+bd*2)*2/3, dx, (dy+bd*2)/3)];
- [label setText:@"" Font:FontTitle TextColor:[UIColor redColor]];
- [scroll addSubview:label];
- //价格
- lbl01 = label;
-
- label = [[UILabel alloc] initWithFrame:SGRectMake(320-dx-bd, (dy+bd*2)*2/3, dx, (dy+bd*2)/3)];
- [label setText:@"" Font:FontTitle TextColor:kTitleColor Alignment:NSTextAlignmentRight];
- [scroll addSubview:label];
- //关注
- lbl02 = label;
-
- curTop = dy+bd+bd+bd;
- dy = 35;
- btn = [[CLButton alloc] initWithFrame:SGRectMake(0, curTop , 320, dy)];
- [btn setImage:[UIImage imageNamed:@"mobile_phone_ico.png"] withTitle:@"10086" Font:NormalFont forState:UIControlStateNormal];
- [btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
- [scroll addSubview:btn];
- [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [btn setTag:0];
- //电话按钮(已添加拨打功能)tag=0
- btn00 = btn;
- [btn addViewWithRect:SGRectMake(0, curTop , 320, .5) Color:KlineColor];
-
-
- btn = [[CLButton alloc] initWithFrame:SGRectMake(0, curTop+dy, 320, dy)];
- [btn setImage:[UIImage imageNamed:@"address_icon.png"] withTitle:@"辽宁省" Font:NormalFont forState:UIControlStateNormal];
- [btn target:self tag:1];
- [btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
- [scroll addSubview:btn];
- //地址按钮
- btn01 = btn;
- [btn addViewWithRect:SGRectMake(0, curTop +dy, 320, .5) Color:KlineColor];
-
-
- btn = [[CLButton alloc] initWithFrame:SGRectMake(0, curTop+dy*2, 320, dy)];
- [btn setImage:[UIImage imageNamed:@"subject1_simulate_execercise_more_icon.png"] withTitle:@"路线" Font:NormalFont forState:UIControlStateNormal];
- [btn target:self tag:2];
- [btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
- [scroll addSubview:btn];
- //路线按钮
- btn02 = btn;
- [btn addViewWithRect:SGRectMake(0, curTop +dy*2, 320, .5) Color:KlineColor];
-
- curTop += dy*3 + bd;
-
- btn = [[CLButton alloc] initWithFrame:SGRectMake(0, curTop, 320, dy)];
- [btn setDetailN:@"更多 >"];
- [scroll addSubview:btn];
- [btn target:self tag:10];
- //更多驾校详情按钮
- btn3 = btn;
- //添加黑色隔条
- [btn addViewWithRect:SGRectMake(0, curTop-bd, 320, bd) Color:KlineColor];
- label = [[UILabel alloc] initWithFrame:SGRectMake(bd, curTop, 80, dy)];
- [label setText:@"驾校简介"];
- [label setTextColor:contentTextColor];
- [scroll addSubview:label];
- lbl03= label;
-
- CGFloat lblh = 60;
- label = [[UILabel alloc] initWithFrame:SGRectMake(bd, curTop+dy, 320-bd*2, lblh)];
- [label setNumberOfLines:0];
- [label setTextColor:contentTextColor];
- [scroll addSubview:label];
- //简介内容
- lbl10 = label;
- [label addViewWithRect:SGRectMake(0, curTop+dy, 320, .5) Color:KlineColor];
-
- curTop += lblh + dy;
- UIButton* btnn;
- [btnn addViewWithRect:SGRectMake(0, curTop, 320, .5) Color:KlineColor];
- btnn = [[UIButton alloc] initWithFrame:SGRectMake(0, curTop, 320, dy)];
- [btnn setTitle:@"驾校新闻" textColor:defGreen font:16 fotState:UIControlStateNormal];
- [btnn target:self tag:12];
- [scroll addSubview:btnn];
- [btnn addSelfViewWithRect:SGRectMake(0, - 1 ,320, 1) Color:KlineColor];
- //驾校新闻按钮
- btn4 = (CLButton*)btnn;
-
- btn = [[CLButton alloc] initWithFrame:SGRectMake(0, curTop + dy + bd, 320, dy)];
- [btn setTitle:@"" textColor:contentTextColor font:NormalFont fotState:UIControlStateNormal];
- [btn setImage:nil forState:UIControlStateNormal];
- [btn setDetailN:@"点击加入讨论 >"];
- [btn target:self tag:13];
- [scroll addSubview:btn];
- //跳转驾校社区按钮
- btn5 = btn;
- [btn addSelfViewWithRect:SGRectMake(0, - bd ,320, bd) Color:KlineColor];
- [btn addSelfViewWithRect:SGRectMake(0, dy ,320, bd) Color:KlineColor];
-
- //课程信息部分
-
- CGFloat y = curTop + 2*(dy + bd);
- label = [[UILabel alloc] initWithFrame:SGRectMake(bd, y, 320-bd, dy)];
- [label setText:@"培训类型"];
- [label setFont:[UIFont scaleSize:16]];
- [label setTextColor:contentTextColor];
- [scroll addSubview:label];
-
- y += dy;
- //用这个表来展示数据吧
- mainTableView = [[UITableView alloc] initWithFrame:SGRectMake(0, y, kSize.width, 0) style:UITableViewStylePlain];
- mainTableView.delegate = self;
- mainTableView.dataSource = self;
- mainTableView.scrollEnabled = NO;
- [scroll addSubview:mainTableView];
-
-
- kHolder = [[UIView alloc] initWithFrame:SGRectMake(0, y, kSize.width, 185)];
- kHolder.backgroundColor = backGroundColor;
- [scroll addSubview:kHolder];
- label = [[UILabel alloc] initWithFrame:SGRectMake(20, 0, kSize.width - 40, 30)];
- label.text = @"该驾校暂无课程信息哦~";
- label.textColor = defGreen;
- [label addSelfViewWithRect:SGRectMake(-20, 30 ,320, 1) Color:KlineColor];
- [kHolder addSubview:label];
-
- [scroll setContentSize:CGSizeMake(kSize.width, mainTableView.y + 120)];
-
- [self getSchInfoById];
- }
- //这个是刷新驾校的UI
- -(void)freshUI
- {
- int starNum = [model[@"star"] intValue];
- if (starNum == 0)
- {
- starNum = 3;
- }
- for (int i = 0; i < starNum; i ++)
- {
- UIImageView *img = starImgs[i];
- img.hidden = NO;
- }
-
- NSString *path = nil;
- NSString *str;
- if ([model[@"headimg"] length] > 1) {
- path = model[@"headimg"];
- }
-
- [img00 sd_setImageWithURL:[NSURL URLWithString:path] placeholderImage:[UIImage imageNamed:@"nope_pic_icon.png"]];
-
- img00.userInteractionEnabled = YES;
- [img00 addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage:)]];
-
- [lbl00 setText:model[@"name"] Font:FontTitle TextColor:kTitleColor];
-
- str = model[@"price"];
- if ([str isEqualToString:@""] || [str isEqualToString:@"0"]) {
- str = @"¥暂无";
- }else{
- str = [NSString stringWithFormat:@"¥%@",str];
- }
- [lbl01 setText:str];
-
- [lbl02 setText:[NSString stringWithFormat:@"%@人关注",model[@"watch"]]];
-
- [btn00 setTitle:model[@"telePhone"] forState:UIControlStateNormal];
- [btn01 setTitle:model[@"address"] forState:UIControlStateNormal];
-
- NSString *route = [NSString stringWithFormat:@"班车路线: %@",model[@"route"]];
- if ([model[@"route"] length] == 0) {
- route = @"班车路线: 暂无";
- }
- [btn02 setTitle:route forState:UIControlStateNormal];
- [btn5 setTitle:model[@"shortName"] forState:UIControlStateNormal];
-
-
- str = model[@"desc"];
- if (str.length == 0)
- {
- str = @"暂无相关简介";
- }
- [lbl10 setText:str];
-
- [btn5 setDetailN:@"点击加入讨论 >"];
-
-
- //课程信息
- NSArray *kArray = model[@"products"];
- if (kArray.count == 0) {
-
- [kHolder setHidden:NO];
- [scroll setContentSize:CGSizeMake(kSize.width, mainTableView.y + 120)];
- }else{
-
- [kHolder setHidden:YES];
- dataArray = [NSArray arrayWithArray:kArray];
- mainTableView.height = 44*dataArray.count + 55;
- [scroll setContentSize:CGSizeMake(kSize.width, mainTableView.y + mainTableView.height + 100)];
- [mainTableView reloadData];
- }
- }
- -(void)btnClick:(UIButton*)sender
- {
- int tag = (int)sender.tag;
-
- if (-1 == tag) {
- //报名
- NSString* str = model[@"jxbh"];
- NSString* str1 = model[@"name"];
- if (str && str1) {
- ApplyVC *appVC = [[ApplyVC alloc] init];
- appVC.jxbh = str;
- appVC.jxmc = str1;
- [self navPushHideTabbarToVC:appVC];
- }else{
- ShowMsgFailed();
- }
- }
- if ( 0 == tag)
- {
- NSString *telString = model[@"telePhone"];
- if (!telString || telString.length < 1) {
- return;
- }
- UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:model[@"telePhone"] delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"呼叫", nil];
- [alert show];
- return;
- }
-
- if (tag == 1)
- {
- //进入地图页面
- MapVC *mapVC = [[MapVC alloc] init];
- // mapVC.jxdz = model[@"address"];
- mapVC.lat = [model[@"latitude"] doubleValue];
- mapVC.lng = [model[@"longitude"] doubleValue];
- mapVC.isJustLoad = YES;
- mapVC.siteName = model[@"shortName"];
- [self navPushHideTabbarToVC:mapVC];
- }
-
- if (tag == 2)
- {
- descVC *vc = [[descVC alloc] init];
- vc.titleString = @"路线详情";
- vc.desc = model[@"route"];
- [self navPushHideTabbarToVC:vc];
- }
-
- if (tag == 10)
- {
- descVC *vc = [[descVC alloc] init];
- vc.desc = model[@"desc"];
- vc.titleString = @"驾校简介";
- [self navPushHideTabbarToVC:vc];
- }
-
-
- //下面需要有驾校编号才能进入
- NSString *jxbh = model[@"jxbh"];
- if (!jxbh || jxbh.length < 1) {
- return;
- }
-
- if (-3 == tag) {
-
- SearchComment* vc = [[SearchComment alloc] init];
- vc.bpjr = jxbh;
- vc.type = @"1";
- [self navPushHideTabbarToVC:vc];
- }
- if (-2 == tag) {
-
- FaqVC* vc = [FaqVC new];
- [vc setJxbh:jxbh];
- [self navPushHideTabbarToVC:vc];
- }
-
- if (tag == 12)
- {
- //NSLog(@"新闻");
- SchoolNewsVC *news = [[SchoolNewsVC alloc] init];
- news.jxbh = jxbh;
- [self navPushHideTabbarToVC:news];
- }
-
- if (tag == 13)
- {
- TopicesVC* vc = [[TopicesVC alloc] init];
- vc.type = @"1";
- vc.groupId = @"-1";
- vc.jxbh = jxbh;
- vc.jxjc = model[@"shortName"];
- [self navPushHideTabbarToVC:vc];
- }
-
- if (tag == 14)
- {
- //NSLog(@"更多课程");
- }
- }
- -(void)tapImage:(UITapGestureRecognizer *)tap
- {
- NSArray *images = model[@"schPlaces"];
-
- if (images.count < 1) {
- return;
- }
-
- NSMutableArray *urls = [NSMutableArray array];
- for (NSDictionary *dic in images) {
- if (dic[@"filePath"]) {
- [urls addObject:dic[@"filePath"]];
- }
- }
-
- [RQ_SHARE_FUNCTION showPhotoBrowserWithDataSource:urls currentIndex:0 isCanSave:YES];
- }
- //弹出显示详细课程信息
- -(void)getViewWithDic:(NSDictionary *)dic
- {
- UIView *vi = [[UIView alloc] initWithFrame:CGRectMake(-1, kSize.height/2.0 - 80, kSize.width + 2, 200)];
- vi.backgroundColor = backGroundColor;
- vi.layer.borderColor = defGreen.CGColor;
- vi.layer.borderWidth = 1;
- [self.view addSubview:vi];
-
- CGFloat kx,ky,kw,kh;
- kx = 8;
- ky = 0;
- kw = kSize.width/2.0 - 9;
- kh = 30;
-
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, ky, 2*kw - 100, kh)];
- label.textColor = kTitleColor;
- label.textAlignment = NSTextAlignmentCenter;
- label.font = [UIFont scaleSize:18];
- label.text = @"培训详情";
- [vi addSubview:label];
-
- EXButton* btn = [[EXButton alloc] initWithFrame:CGRectMake(kSize.width - 50, 0, 30, 30)];
- [btn addTarget:self action:@selector(removeKView:) forControlEvents:UIControlEventTouchUpInside];
- [btn setImage:[[UIImage imageNamed:@"question_error.png"] tint:[UIColor grayColor]] forState:UIControlStateNormal];
- [btn setTitle:@"×" textColor:[UIColor whiteColor] font:30 fotState:UIControlStateNormal];
- [vi addSubview:btn];
-
- ky += kh + 8;
- label = [[UILabel alloc] initWithFrame:CGRectMake(kx, ky, kw, kh)];
- label.textColor = kTitleColor;
- [vi addSubview:label];
- kName = label;
-
- kx += kw;
- label = [[UILabel alloc] initWithFrame:CGRectMake(kx, ky, kw, kh)];
- label.textColor = kTitleColor;
- [vi addSubview:label];
- kPrice = label;
-
- ky += kh;
- label = [[UILabel alloc] initWithFrame:CGRectMake(kx, ky, kw, kh)];
- label.textColor = kTitleColor;
- [vi addSubview:label];
- kCar = label;
-
- kx -= kw;
- label = [[UILabel alloc] initWithFrame:CGRectMake(kx, ky, kw, kh)];
- label.textColor = kTitleColor;
- [vi addSubview:label];
- kType = label;
-
- kw *= 2;
- ky += kh;
- NSMutableArray *kLabels = [NSMutableArray arrayWithCapacity:3];
- for (int i = 0; i < 3; i ++) {
-
- label = [[UILabel alloc] initWithFrame:CGRectMake(kx, ky + i*kh, kw, kh)];
- label.textColor = kTitleColor;
- [vi addSubview:label];
- [kLabels addObject:label];
- }
-
- kTime = kLabels[0];
- kAdress = kLabels[1];
- kPick = kLabels[2];
-
- kName.text = [NSString stringWithFormat:@"课程:%@",types[[dic[@"shopType"] intValue] - 1]];
- kPrice.text = [NSString stringWithFormat:@"价格:%@%@",dic[@"price"],dic[@"priceUnit"]];
- kType.text = [NSString stringWithFormat:@"证件:%@",dic[@"permitCarType"]];
- kCar.text = [NSString stringWithFormat:@"车辆:%@",dic[@"carBrands"]];
- kTime.text = [NSString stringWithFormat:@"学车时间:%@",dic[@"time"]];
- kAdress.text = [NSString stringWithFormat:@"训练场地:%@",dic[@"address"]];
-
- if ([dic[@"shopType"] isEqualToString:@"4"]) {
- kPick.text = @"接送信息:不接送";
- }else{
- if ([dic[@"isPick"] isEqualToString:@"0"]) {
- kPick.text = @"接送信息:不接送";
- }else{
- kPick.text = [NSString stringWithFormat:@"接送信息:%@[%@]",dic[@"pickAddress"],dic[@"pickTime"]];
- }
- }
- }
- -(void)removeKView:(EXButton *)sender
- {
- UIView *view = sender.superview;
- if (view) {
- [view removeFromSuperview];
- }
- }
- #pragma mark tableView delegate
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return dataArray.count;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- KSchoolCell *cell = [tableView dequeueReusableCellWithIdentifier:@"kCell"];
- if (cell == nil)
- {
- cell = [[KSchoolCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"kCell"];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
-
- NSDictionary *dic = dataArray[indexPath.row];
-
- cell.nameLabel.text = types[[dic[@"shopType"] intValue] - 1];
- cell.priceLabel.text = dic[@"price"];
- cell.unitLabel.text = dic[@"priceUnit"];
- cell.carTypeLabel.text = dic[@"permitCarType"];
-
- return cell;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSDictionary *dic = dataArray[indexPath.row];
- [self getViewWithDic:dic];
- }
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kSize.width, 50)];
-
- headerView.backgroundColor = backGroundColor;
-
- CGFloat width = (kSize.width - 16)/7.0;
-
- CGFloat x,y,w,h,bd;
- x = bd = 8;
- y = 5;
- w = 2*width;
- h = 40;
-
- UILabel *label = [[UILabel alloc] setxywh];
- label.textAlignment = NSTextAlignmentCenter;
- label.text = @"培训名称";
- [label setFont:[UIFont scaleSize:16]];
- [headerView addSubview:label];
-
- x += 2*width;
- w = 2*width;
- label = [[UILabel alloc] setxywh];
- label.textAlignment = NSTextAlignmentCenter;
- label.text = @"驾照";
- [label setFont:[UIFont scaleSize:16]];
- [headerView addSubview:label];
-
- x += 2.5*width;
- label = [[UILabel alloc] setxywh];
- label.textAlignment = NSTextAlignmentCenter;
- label.text = @"价格";
- [label setFont:[UIFont scaleSize:16]];
- [headerView addSubview:label];
-
- return headerView;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- return 50;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
- return [UIView new];
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- return .1;
- }
- #pragma mark - 获取驾校信息
- -(void)getSchInfoById
- {
- if (![Util connectedToNetWork]) {
- showMsgUnconnect();
- return;
- }
- NSMutableArray *arr=[NSMutableArray array];
- if (!_schoolId) {
- return;
- }
- [arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:_schoolId,@"id", nil]];
- NSString* method = @"getSchInfoById";
- [MBProgressHUD showLoadToView:self.view];
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- [MBProgressHUD hideHUDForView:self.view];
-
- if (!root)
- {
- ShowMsgFailed();
- return;
- }
- NSString* code = root[@"code"];
- if ( 1 == code.intValue ) {
- [LoadingView showMsg:root[@"body"]];
- return;
- }
-
- NSDictionary* body = root[@"body"];
- model = body;
- [self freshUI];
- }];
-
- }
- #pragma mark - 呼叫功能
- -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
- if (1 == buttonIndex)
- {
- NSString* str = model[@"telePhone"];
-
- NSMutableString * url=[[NSMutableString alloc] initWithFormat:@"tel:%@",str];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
- }
- }
- @end
|