-(void)button{
NSArray *arrbutton=[LBZModelDataAll dataArrayFromModel:poet_list];
// NSLog(@"%@",arrbutton);
NSLog(@"%lu",(unsigned long)arrbutton.count);
for (int i=0; i<arrbutton.count; i++) {
NSLog(@"%@",[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:i andNSString:poet_id]);
///////////////////////// /////////////////////////
//自动生成button
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(110*(i%5)+30,150*(int)(i/5), 80, 138)];
button.tag=i;
UIImageView *figurephoto=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 138)];
if (/* DISABLES CODE */ (0)) {
figurephoto.image=[UIImage imageNamed:@"3.jpg"];
}
else{
figurephoto.image=[UIImage imageNamed:@"card_back_new1.png"];
}
[button addSubview:figurephoto];
//诗人名字标签
UILabel *poetnameLable=[[UILabel alloc]initWithFrame:CGRectMake(0, 115, 80, 8)];
poetnameLable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:i andNSString:name_poet_list];
poetnameLable.font=[UIFont systemFontOfSize:12];
poetnameLable.textAlignment=NSTextAlignmentCenter;
[button addSubview:poetnameLable];
UILabel *figureLable=[[UILabel alloc]initWithFrame:CGRectMake(20, 128, 60, 10)];
//设置标签文字
figureLable.text=[NSString stringWithFormat:@"0/%@",[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:i andNSString:poet_id]];
figureLable.font=[UIFont systemFontOfSize:12];
figureLable.textAlignment=NSTextAlignmentCenter;
[button addSubview:figureLable];
[ZYFachievementscrollView addSubview:button];
ZYFachievementscrollView.contentSize=CGSizeMake(568, 150*(int)(i/5)+150);//有效显示区域
[button addTarget:self action:@selector(showPoetIntroduce:) forControlEvents:UIControlEventTouchUpInside];
}
}
-(void)showPoetIntroduce:(UIButton *)sender{
NSLog(@"人物小传");
// NSArray *arrbutton=[LBZModelDataAll dataArrayFromModel:poet_list];
int a=(int)sender.tag;
// self.view.alpha=0.4;//有问题(上面的view同明度也变化)
//新视图
PoetIntroduceview=[[UIView alloc]initWithFrame:CGRectMake(30, 50, 520, 220)];
//添加背景
PoetIntroduceview.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"poet_extra_info_bg.png"]];
//左边
UIView *leftView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 220)];
UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(18, 50, 140, 120)];
imageview.image=[UIImage imageNamed:@"people_0001.png"];/////////诗人图像接口
[leftView addSubview:imageview];
UILabel *aLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 40, 160, 20)];
aLable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:name_poet_list];
aLable.font=[UIFont systemFontOfSize:15];
aLable.textAlignment=NSTextAlignmentCenter;
[leftView addSubview:aLable];
UILabel *bLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 60, 160, 20)];
bLable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:birth2death];
bLable.font=[UIFont systemFontOfSize:10];
bLable.textAlignment=NSTextAlignmentCenter;
[leftView addSubview:bLable];
UILabel *cLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 80, 20, 15)];
[email protected]"字:";
cLable.textColor=[UIColor redColor];
cLable.font=[UIFont systemFontOfSize:12];
cLable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:cLable];
UILabel *c1Lable=[[UILabel alloc]initWithFrame:CGRectMake(180, 80, 140, 15)];
c1Lable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:extra];
c1Lable.font=[UIFont systemFontOfSize:12];
c1Lable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:c1Lable];
UILabel *dLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 95, 20, 15)];
[email protected]"号:";
dLable.textColor=[UIColor redColor];
dLable.font=[UIFont systemFontOfSize:12];
dLable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:dLable];
UILabel *d1Lable=[[UILabel alloc]initWithFrame:CGRectMake(180, 95, 140, 15)];
d1Lable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:call];
d1Lable.font=[UIFont systemFontOfSize:12];
d1Lable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:d1Lable];
UILabel *eLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 110, 30, 15)];
[email protected]"世称:";
eLable.textColor=[UIColor redColor];
eLable.font=[UIFont systemFontOfSize:12];
eLable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:eLable];
UILabel *e1Lable=[[UILabel alloc]initWithFrame:CGRectMake(190, 110, 130, 15)];
e1Lable.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:nickname];
e1Lable.font=[UIFont systemFontOfSize:12];
e1Lable.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:e1Lable];
UILabel *fLable=[[UILabel alloc]initWithFrame:CGRectMake(160, 125, 160, 15)];
[email protected]"世称来历:";
fLable.textColor=[UIColor redColor];
[leftView addSubview:fLable];
fLable.font=[UIFont systemFontOfSize:12];
fLable.textAlignment=NSTextAlignmentLeft;
UITextView *f1textview=[[UITextView alloc]initWithFrame:CGRectMake(160, 140, 160,60)];
f1textview.backgroundColor=[UIColor colorWithRed:1 green:1 blue:1 alpha:0];
f1textview.text=[LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:nick_desc];
f1textview.allowsEditingTextAttributes=NO;////////////设置不可编辑不能用这个,得用下面的一个
f1textview.editable=NO;
f1textview.selectable=NO;
f1textview.font=[UIFont systemFontOfSize:12];
f1textview.textAlignment=NSTextAlignmentLeft;
[leftView addSubview:f1textview];
//右边
UIView *rightView=[[UIView alloc]initWithFrame:CGRectMake(340, 0, 180, 220)];
UILabel *gLable=[[UILabel alloc]initWithFrame:CGRectMake(20, 20, 70, 20)];
gLable.backgroundColor=[UIColor colorWithRed:0.7 green:0.1 blue:0.1 alpha:1.0];
[email protected]"人物小传";
[rightView addSubview:gLable];
UITextView *textView=[[UITextView alloc]initWithFrame:CGRectMake(20, 40, 150, 170)];
textView.text= [LBZModelDataAll dataDetailFromModel:poet_list andDataNum:a andNSString:xiao_zhuan];
textView.editable=NO;//设置可编辑属性
textView.selectable=NO;//设置可选择属性
textView.backgroundColor=[UIColor colorWithRed:1 green:1 blue:1 alpha:0];
textView.font=[UIFont systemFontOfSize:12];
textView.textAlignment=NSTextAlignmentLeft;
[rightView addSubview:textView];
//表层视图
[PoetIntroduceview addSubview:leftView];
[PoetIntroduceview addSubview:rightView];
//下层遮挡视图通过添加一层中间视图并调节透明度使所需要显现的视图后面视图变暗,而所需要显现的视图继续明亮
bgview=[[UIView alloc]initWithFrame:self.view.frame];
bgview.backgroundColor=[UIColor blackColor];
bgview.alpha=0.6;
[self.view addSubview:bgview];
[self.view addSubview:PoetIntroduceview];
}