Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
//
// MyControl.h
// MusicPlayer_V1.0
// Copyright (c) 2014年 apple. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface MyControl : NSObject
+ (UILabel *)creatLabelWithFrame:(CGRect)frame
text:(NSString *)text ;
+ (UIButton *)creatButtonWithFrame:(CGRect)frame
target:(id)target
sel:(SEL)sel
tag:(NSInteger)tag
image:(NSString *)name
title:(NSString *)title;
//创建UIImageView
+ (UIImageView *)creatImageViewWithFrame:(CGRect)frame
imageName:(NSString *)name;
//创建UITextField
+ (UITextField *)creatTextFieldWithFrame:(CGRect)frame
placeHolder:(NSString *)string
delegate:(id <UITextFieldDelegate>)delegate
tag:(NSInteger)tag;
@end
+70
View File
@@ -0,0 +1,70 @@
//
// MyControl.m
//
// Created by LX on 14-5-9.
// Copyright (c) 2014年 apple. All rights reserved.
//
#import "MyControl.h"
@implementation MyControl
+ (UILabel *)creatLabelWithFrame:(CGRect)frame text:(NSString *)text{
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.text = text;
label.backgroundColor = [UIColor clearColor];
label.numberOfLines = 0;
label.font = [UIFont systemFontOfSize:15];
return [label autorelease];
}
+ (UIButton *)creatButtonWithFrame:(CGRect)frame target:(id)target sel:(SEL)sel tag:(NSInteger)tag image:(NSString *)name title:(NSString *)title{
UIButton *button = nil;
if (name) {
//创建图片按钮
//创建背景图片 按钮
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
if (title) {//图片标题按钮
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
}
}else if (title) {
//创建标题按钮
button = [UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:title forState:UIControlStateNormal];
}
button.frame = frame;
button.tag = tag;
[button addTarget:target action:sel forControlEvents:UIControlEventTouchUpInside];
return button;
}
+ (UIImageView *)creatImageViewWithFrame:(CGRect)frame imageName:(NSString *)name{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
imageView.image = [UIImage imageNamed:name];
return [imageView autorelease];
}
+ (UITextField *)creatTextFieldWithFrame:(CGRect)frame placeHolder:(NSString *)string delegate:(id<UITextFieldDelegate>)delegate tag:(NSInteger)tag{
UITextField *textField = [[UITextField alloc] initWithFrame:frame];
//设置风格类型
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.placeholder = string;
//设置代理
textField.delegate = delegate;
//设置tag值
textField.tag = tag;
return [textField autorelease];
}
@end