//
Achievementviewcontroller.m
LIBAOZHENG0826
//
Created by Zhang Yanfeng on 15/8/27.
Copyright (c) 2015 Zhang Yanfeng. All rights reserved.
//
#import "AchievementViewController.h"
#import "LBZModelDataAll.h"
#import "LBZPREFIXHEADER.PCH"
@interface Achievementviewcontroller ()
{
__weak Iboutlet Uiscrollview *zyfachievementscrollview;
UIView *poetintroduceview;
UIView *bgview;
}
-(Ibaction) Zyfdobackbutton: (ID) sender;
@end
@implementation Achievementviewcontroller
-(void) Viewdidload {
[Super Viewdidload];
Self.view.backgroundcolor=[uicolor browncolor];//Setting the background color
[Self button];//Call button method
}
-(Ibaction) Zyfdobackbutton: (ID) Sender {
[self Dismissviewcontrolleranimated:yes completion:nil];//return to previous page
}
-(void) button{
Nsarray *arrbutton=[lbzmodeldataall dataarrayfrommodel:poet_list];//extracting data from a macro definition
NSLog (@ "%lu", (unsigned long) arrbutton.count);
for (int i=0; i<arrbutton.count; i++) {
NSLog (@ "%@", [Lbzmodeldataall datadetailfrommodel:poet_list anddatanum:i andnsstring:poet_id]);
Automatically generate button
UIButton *button=[[uibutton Alloc]initwithframe:cgrectmake (110* (i%5) +30,150* (int) (I/5), 80, 138)];
button.tag=i;//Add Tag value easy to click when you know which one is clicked
Uiimageview *figurephoto=[[uiimageview alloc]initwithframe:cgrectmake (0, 0, 80, 138)];
figurephoto.image=[uiimage imagenamed:@ "card_back_new1.png"];//adding a picture to a button does not affect the use of the button,
[Button Addsubview:figurephoto];
Poet Name Tag (initialize spec, get data, set label font size position)
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)];
Set Label text
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);//valid display area, This setting can automatically adjust the height of the view to the length of a long string of buttons depending on how many buttons
[Button addtarget:self action: @selector (showpoetintroduce:) forcontrolevents:uicontroleventtouchupinside];
}
}
-(void) Showpoetintroduce: (UIButton *) sender{
NSLog (@ "biographies");
int a= (int) Sender.tag;//tag value is not shaping data, but can be strongly converted
self.view.alpha=0.4;//There is a problem (the view with the same lightness also changes) when setting the transparency, all the objects on the views change with the change of the transparency of all the objects above the set object, by default all packages on the object become a whole
New View
Poetintroduceview=[[uiview Alloc]initwithframe:cgrectmake (30, 50, 520, 220)];
Add background
Poetintroduceview.backgroundcolor=[uicolor colorwithpatternimage:[uiimage imagenamed:@ "Poet_extra_info_bg.png"] ;
Left
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] "word:";
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] "number:";
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] "the world said:";
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] "The History of the World:";
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.font=[uifont Systemfontofsize:12];
F1textview.textalignment=nstextalignmentleft;
[Leftview Addsubview:f1textview];
Right
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] "biography";
[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.backgroundcolor=[uicolor colorwithred:1 green:1 blue:1 alpha:0];
Textview.font=[uifont Systemfontofsize:12];
Textview.textalignment=nstextalignmentleft;
[Rightview Addsubview:textview];
Surface view
[Poetintroduceview Addsubview:leftview];
[Poetintroduceview Addsubview:rightview];
The lower occlusion view darkens the view behind the desired view by adding an intermediate view and adjusting the transparency, and the view that needs to appear continues to be bright
Bgview and Poetintroduceview are tied, Bgview is used to obscure the rear view, so the size is as large as the overall screen, the color can be black or a variety of colors, depending on the preference, the transparency set to 0.6 or 0.7 can be looming, enhance the aesthetic. The Poetintroduceview default transparency is the same as Self.view because it is added to the Self.view. Now it's coming out.
Bgview=[[uiview Alloc]initwithframe:self.view.frame];
Bgview.backgroundcolor=[uicolor Blackcolor];
bgview.alpha=0.6;
[Self.view Addsubview:bgview];
[Self.view Addsubview:poetintroduceview];
}
-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{
Click to remove the poet introduction and occlusion layer
[Poetintroduceview Removefromsuperview];
[Bgview Removefromsuperview];
}
@end
Returns to the previous view, highlighting one view and blurring other views