QQ Space HD (5)-Add left menu bar content

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.