- (void)viewDidLoad {
[super viewDidLoad];
//设置导航栏标题,和右侧按钮
self.title = @"广告详情";
[self.navigationController.navigationBar setTitleTextAttributes:@{
NSFontAttributeName : [UIFont systemFontOfSize:18],
NSForegroundColorAttributeName : [UIColor whiteColor]
}];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
UIBarButtonItem* item = [[UIBarButtonItem alloc]
initWithTitle:@"<"
style:UIBarButtonItemStylePlain
target:self
action:@selector(left)];
UIBarButtonItem* rightitem = [[UIBarButtonItem alloc]initWithTitle:@"我要参战" style:UIBarButtonItemStylePlain target:self action:@selector(join)];
self.navigationItem.rightBarButtonItem = rightitem;
self.navigationItem.leftBarButtonItem = item;
//界面分为两个部分
//1.一个scrollview 占据界面剩余部分
UIScrollView*myScroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-64)];
//myScroll.backgroundColor=[UIColor grayColor];
[self.view addSubview:myScroll];
UILabel*titlelbl=[[UILabel alloc]initWithFrame:CGRectMake(0, 8, self.view.frame.size.width, 25)];
titlelbl.text=@"世纪大战,快来参与";
titlelbl.textAlignment=NSTextAlignmentCenter;
titlelbl.font = [UIFont boldSystemFontOfSize:16.f];
[myScroll addSubview:titlelbl];
UILabel*timelbl=[[UILabel alloc]initWithFrame:CGRectMake(8, 40,self.view.frame.size.width/2-8, 12)];
timelbl.text=@"时间:2016年8月15日";
titlelbl.textColor=[UIColor grayColor];
timelbl.font = [UIFont systemFontOfSize:12.f];
[myScroll addSubview:timelbl];
UILabel*orglbl=[[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2, 40,self.view.frame.size.width/2-8, 12)];
orglbl.text=@"来源:鱼丸官方";
orglbl.textColor=[UIColor grayColor];
orglbl.font = [UIFont systemFontOfSize:12.f];
[myScroll addSubview:orglbl];
//基本设置
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(8, 56, self.view.frame.size.width-16, myScroll.frame.size.height-56)];
NSString *text = @"详细内容:近日,有网民连续发网帖举报湖南新邵县迎光乡上沙溪村支部书记彭承双“村支书全家低保,新盖的房比小学还大”。记者18日从新邵县委宣传部获悉,网民反映的部分事实属实,纪委已经立案调查,将严肃处理能批地盖房子的人没有容身之所,而村支部书记的房子盖得却比上沙溪小学还要大两倍”“一个村委书记,全家上老下小都吃低保”……记者从网帖上看到,网民上传了数张照片,直指上沙溪村村支书彭承双存在违规建房、在评定低保时优亲厚友、全家吃低保等违规违纪现象记者从新邵县委宣传部获悉,针对网友反映的问题,中共新邵县委已责成相关部门进行立案调查。根据调查,2007年5月,彭承双向国土部门取得《个人建房用地批复单》审批面积为280平方米,批地类别为非农用地中的荒地。彭承双在申请建房用地审批中弄虚作假,将自己和爱人拆分为两户申请占地建房,且少批多占,违反了国土管理的相关法律政策。此外,上沙溪村支部书记彭承双本人和其直系亲属没有人享受低保政策,但存在优亲厚友、违规操作的问题,违反了相关法规政策和纪律规定据介绍,新邵县民政部门已经取消了彭承双违规为亲友办理的低保户身份,发放的低保款将上缴县财政。同时责成迎光乡纪委对彭承双进行立案调查,对存在的问题依法依规进行处理记者了解到,新邵县委责成迎光乡政府对全乡范围内的国土用地审批和低保评定工作进行一次全面清查,对存在的问题及时整改介绍,该案于今年1月4日立案。经查,该传销组织以国家投资西部大开发为幌子,多次组织受害人到广西钦州、南宁、北海、防城港等地开展所谓的“一日游”活动,对受害人进行洗脑,从而骗取受害人投资。涉案人员以河南籍为主。为打掉这个传销组织,广西警方开展多警种合成作战,共出动警力483人,搜查窝点66个,抓获涉嫌传销违法犯罪嫌疑人183人,冻结账户资金1000多万元介绍,该案于今年1月4日立案。经查,该传销组织以国家投资西部大开发为幌子,多次组织受害人到广西钦州、南宁、北海、防城港等地开展所谓的“一日游”活动,对受害人进行洗脑,从而骗取受害人投资。涉案人员以河南籍为主。为打掉这个传销组织,广西警方开展多警种合成作战,共出动警力483人,搜查窝点66个,抓获涉嫌传销违法犯罪嫌疑人183人,冻结账户资金1000多万元";
label.text = text;
UIFont *textFont = [UIFont systemFontOfSize:14.f];
label.font = textFont;
// 调整行间距
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:6];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])];
label.attributedText = attributedString;
//折行
label.lineBreakMode = NSLineBreakByWordWrapping;
//必须写,否则只显示一行
[label setNumberOfLines:0];
[self.view addSubview:label];
//最大尺寸
// MAXFLOAT 为可设置的最大高度
CGSize size = CGSizeMake(self.view.frame.size.width-16, MAXFLOAT);
//获取当前那本属性
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:textFont,NSFontAttributeName, nil];
//实际尺寸
CGSize actualSize = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
label.frame = CGRectMake(10, 70, actualSize.width,actualSize.height);
[myScroll addSubview:label];
myScroll.contentSize=CGSizeMake(self.view.frame.size.width, label.frame.size.height+100);
/*
此处包含title 时间 来源:鱼丸官方 3个lbl
和一个显示广告详情的多行lbl
*/
//2.一个view占据页面下部约60高度的地方
UIView *myView=[[UIView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-64, self.view.frame.size.width, 64)];
myView.backgroundColor=[UIColor colorWithRed:0.96 green:0.66 blue:0.15 alpha:1];
[self.view addSubview:myView];
UILabel*netbarname=[[UILabel alloc]initWithFrame:CGRectMake(8, 8, self.view.frame.size.width, 20)];
netbarname.text=@"战场:嵊州风暴网络会所";
[myView addSubview:netbarname];
netbarname.textColor=[UIColor whiteColor];
UILabel*netbaraddress=[[UILabel alloc]initWithFrame:CGRectMake(8, 36, self.view.frame.size.width, 20)];
netbaraddress.text=@"地址:河南省洛阳市涧西区西苑路48号";
netbaraddress.textColor=[UIColor whiteColor];
[myView addSubview:netbaraddress];
/*
此处包含网吧名和网吧地址两个lbl
*/
//添加一个分割线
UIView *lineView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 1)];
lineView.backgroundColor=[UIColor grayColor];
[myView addSubview:lineView];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)left
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)join
{
//跳转到战场详情页
[self.navigationController popViewControllerAnimated:YES];
}