The factory class of the code-writing interface

Source: Internet
Author: User

#import<Foundation/Foundation.h>#import<UIKit/UIKit.h>@interfaceDluikit:nsobject#pragmaMark---------UILabel--------/** Label Word color font*/+ (UILabel *) Labeltextcolor: (Uicolor *) TextColor fontSize: (cgfloat) size;/** Label Text size*/+ (UILabel *) Labelwithtext: (NSString *) Text fontSize: (cgfloat) size;/** Label Word Color line number text font size*/+ (UILabel *) Labelwithtextcolor: (Uicolor *) TextColor NumberOfLines: (nsinteger) numberoflines text: (NSString*) Text fontSize: (cgfloat) size;/** Label background color to its number of lines text font size*/+ (UILabel *) Labelwithbackgroundcolor: (Uicolor *) backgroundcolor textcolor: (Uicolor*) TextColor textalignment: (nstextalignment) textalignment numberoflines: (N Sinteger) numberoflines text: (NSString*) Text fontSize: (cgfloat) size;#pragmaMark---------Uiimageview--------/** ImageView Pictures*/+ (Uiimageview *) Imageviewwithimage: (UIImage *) image;/** ImageView Picture interaction*/+ (Uiimageview *) Imageviewwithimage: (UIImage *) Image userinteractionenabled: (BOOL) enabled;/** ImageView fill mode picture*/+ (Uiimageview *) Imageviewwithcontentmode: (uiviewcontentmode) mode Image: (UIImage*) image;/** ImageView fill mode interactive picture*/+ (Uiimageview *) Imageviewwithcontentmode: (uiviewcontentmode) mode userinteractionenabled: (BOOL) enabled Image: (UIImage*) image;#pragmaMark---------UIButton--------/** UIButton Foreground map*/+ (UIButton *) Buttonwithimage: (UIImage *) image;/** UIButton background color title color title Font size*/+ (UIButton *) Buttonwithbackgroundcolor: (Uicolor *) backgroundcolor Titlecolor: (Uicolor*) Titlecolor title: (NSString*) title fontSize: (cgfloat) size;/** UIButton background color title color title High bright light title font size*/+ (UIButton *) Buttonwithbackgroundcolor: (Uicolor *) backgroundcolor Titlecolor: (Uicolor*) Titlecolor Titlehighlightcolor: (Uicolor*) Titlehighlightcolor title: (NSString*) title fontSize: (cgfloat) size;#pragmaMark---------TableView--------+ (UITableView *) Tableviewwithframe: (CGRect) Frame style: (Uitableviewstyle) style Delegate:(ID)Delegate;+ (void) Dl_tableview: (UITableView *) TableView withdelegate: (ID)Delegate;@end
#import "DLUIKit.h"@implementationDluikit#pragmaMark---------Label--------+ (UILabel *) Labeltextcolor: (Uicolor *) TextColor fontSize: (cgfloat) Size {return[Sjuikit labelwithbackgroundcolor:[uicolor Clearcolor] Textcolor:textcolor textalignment:nstextalignmentleft NumberOfLines:1Text:nil Fontsize:size]; }+ (UILabel *) Labelwithtext: (NSString *) Text fontSize: (cgfloat) Size {return[Sjuikit labelwithbackgroundcolor:[uicolor Clearcolor] Textcolor:[uicolor Blackcolor] TextAlignment: Nstextalignmentleft NumberOfLines:1Text:text Fontsize:size]; }+ (UILabel *) Labelwithtextcolor: (Uicolor *) TextColor NumberOfLines: (nsinteger) numberoflines text: (NSString*) Text fontSize: (cgfloat) Size {return[Sjuikit labelwithbackgroundcolor:[uicolor Clearcolor] Textcolor:textcolor textalignment:nstextalignmentleft    Numberoflines:numberoflines Text:text Fontsize:size]; }+ (UILabel *) Labelwithbackgroundcolor: (Uicolor *) backgroundcolor textcolor: (Uicolor*) TextColor textalignment: (nstextalignment) textalignment numberoflines: (N Sinteger) numberoflines text: (NSString*) Text fontSize: (cgfloat) size {UILabel*label =[[UILabel alloc] init]; Label.backgroundcolor=BackgroundColor; Label.textcolor=TextColor; Label.textalignment=textalignment; Label.numberoflines=NumberOfLines; Label.text=text; Label.font=[Uifont systemfontofsize:size]; returnlabel;}#pragmaMark---------ImageView--------+ (Uiimageview *) Imageviewwithimage: (UIImage *) Image {return[Sjuikit Imageviewwithcontentmode:uiviewcontentmodescaletofill userinteractionenabled:no image:image];}+ (Uiimageview *) Imageviewwithimage: (UIImage *) Image userinteractionenabled: (BOOL) enabled {return[Sjuikit Imageviewwithcontentmode:uiviewcontentmodescaletofill userinteractionenabled:enabled image:image];}+ (Uiimageview *) Imageviewwithcontentmode: (uiviewcontentmode) mode Image: (UIImage*) Image {return[Sjuikit imageviewwithcontentmode:mode userinteractionenabled:no image:image];}+ (Uiimageview *) Imageviewwithcontentmode: (uiviewcontentmode) mode userinteractionenabled: (BOOL) enabled Image: (UIImage*) Image {Uiimageview*imageview =[[Uiimageview alloc] init]; Imageview.contentmode=mode; Imageview.userinteractionenabled=enabled; Imageview.image=image; returnImageView;}#pragmaMark---------UIButton--------+ (UIButton *) Buttonwithimage: (UIImage *) Image {UIButton*BTN =[UIButton Buttonwithtype:uibuttontypecustom];    [Btn Setimage:image Forstate:uicontrolstatenormal]; returnbtn; }+ (UIButton *) Buttonwithbackgroundcolor: (Uicolor *) backgroundcolor Titlecolor: (Uicolor*) Titlecolor title: (NSString*) title fontSize: (cgfloat) Size {return[Sjuikit buttonwithbackgroundcolor:backgroundcolor titlecolor:titlecolor titlehighlightcolor:titlecolor title: Title Fontsize:size];}+ (UIButton *) Buttonwithbackgroundcolor: (Uicolor *) backgroundcolor Titlecolor: (Uicolor*) Titlecolor Titlehighlightcolor: (Uicolor*) Titlehighlightcolor title: (NSString*) title fontSize: (cgfloat) size {UIButton*BTN =[UIButton Buttonwithtype:uibuttontypecustom]; Btn.backgroundcolor=BackgroundColor;    [Btn Settitlecolor:titlecolor Forstate:uicontrolstatenormal];    [Btn Settitlecolor:titlehighlightcolor forstate:uicontrolstatehighlighted];    [Btn Settitle:title Forstate:uicontrolstatenormal]; Btn.titleLabel.font=[Uifont systemfontofsize:size]; Btn.adjustsimagewhenhighlighted=NO; returnbtn;}+ (UITableView *) Tableviewwithframe: (CGRect) Frame style: (Uitableviewstyle) style Delegate:(ID)Delegate{UITableView*tableview =[[UITableView alloc] Initwithframe:frame Style:style]; Tableview.separatorstyle=Uitableviewcellseparatorstylenone; TableView.Delegate=Delegate; Tableview.datasource=Delegate; Tableview.backgroundcolor=[Uicolor Whitecolor]; UIView*footerview =[[UIView alloc] init]; Tableview.tablefooterview=Footerview; returnTableView;}+ (void) Dl_tableview: (UITableView *) TableView withdelegate: (ID)Delegate{Tableview.separatorstyle=Uitableviewcellseparatorstylenone; TableView.Delegate=Delegate; Tableview.datasource=Delegate; Tableview.backgroundcolor=[Uicolor Whitecolor]; UIView*footerview =[[UIView alloc] init]; Tableview.tablefooterview=Footerview; }@end

The factory class of the code-writing interface

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.