djiconview.m
#import "DJIconView.h"@implementationDjiconview-(Instancetype) initWithFrame: (CGRect) Frame {if(self =[Super Initwithframe:frame]) { //Self.backgroundcolor = [Uicolor redcolor];Self.imageView.layer.cornerRadius =5; [Self setimage:[uiimage imagenamed:@"Yongdaimi"] Forstate:uicontrolstatenormal]; [Self settitle:@"Yongdaimi"Forstate:uicontrolstatenormal]; [Self Settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; Self.titleLabel.font= [Uifont systemfontofsize: -]; Self.titleLabel.textAlignment=Nstextalignmentcenter; } returnSelf ;}- (void) layoutsubviews {[Super layoutsubviews]; if(Djlandscape) {//Horizontal Screen /*ImageView*/Self.imageView.width=Self.width; Self.imageView.height=Self.imageView.width; self.imageview.x=0; Self.imageview.y=0; /*Titlelabel*/Self.titleLabel.hidden=NO; Self.titleLabel.width=Self.width; Self.titleLabel.height= +; Self.titlelabel.x=0; Self.titlelabel.y=Self.imageView.height; } Else{//Vertical Screen /*ImageView*/Self.imageView.width=Self.width; Self.imageView.height=Self.imageView.width; self.imageview.x=0; Self.imageview.y=0; /*Titlelabel*/Self.titleLabel.hidden=YES; }}@end
Djtabbar.m
#import "DJTabBar.h"@implementationDjtabbar-(Instancetype) initWithFrame: (CGRect) Frame {if(self =[Super Initwithframe:frame]) { //Self.backgroundcolor = [Uicolor greencolor];[self setupbtnimage:@"Tab_bar_feed_icon"Title@"All News"]; [Self setupbtnimage:@"Tab_bar_passive_feed_icon"Title@"related to me"]; [Self setupbtnimage:@"Tab_bar_pic_wall_icon"Title@"Photo Qiang"]; [Self setupbtnimage:@"Tab_bar_e_album_icon"Title@"Electronic Photo Frame"]; [Self setupbtnimage:@"Tab_bar_friend_icon"Title@"Friends"]; [Self setupbtnimage:@"Tab_bar_e_more_icon"Title@"more"]; } returnSelf ;}- (void) Setupbtnimage: (NSString *) imageName title: (NSString *) Title {UIButton*BTN =[[UIButton alloc] init]; //Set button contents to align leftBtn.contenthorizontalalignment =Uicontrolcontenthorizontalalignmentleft; //Set left paddingBtn.contentedgeinsets = Uiedgeinsetsmake (0, -,0,0); [btn Setimage:[uiimage Imagenamed:imagename] forstate:uicontrolstatenormal]; Btn.titleedgeinsets= Uiedgeinsetsmake (0, +,0,0); [Btn Settitle:title Forstate:uicontrolstatenormal]; [Btn setbackgroundimage:[uiimage imagenamed:@"TABBAR_SEPARATE_SELECTED_BG"] forstate:uicontrolstatedisabled]; [Self addsubview:btn];}- (void) layoutsubviews {[Super layoutsubviews]; Nsuinteger Count=Self.subviews.count; if(Djlandscape) {//Horizontal Screen for(inti =0; I < count; i++) {UIButton*BTN =Self.subviews[i]; Btn.width=Self.width; Btn.height= Self.width/3; Btn.x=0; BTN.Y= i *Btn.height; } } Else { for(inti =0; I < count; i++) {UIButton*BTN =Self.subviews[i]; Btn.width=Self.width; Btn.height=Btn.width; Btn.x=0; BTN.Y= i *Btn.height; } }}@end
Qzonehd.pch
// Horizontal Screen #define Djlandscape ([uiscreen mainscreen].bounds.size.width = = 1024x768)// vertical screen #define djportrait ([ UIScreen mainscreen].bounds.size.width = = 768)
Final effect:
Horizontal screen:
Vertical screen:
QQ Space HD (5)-Add left menu bar content