#import
@interface LTView : UIView
#warning 创建需要的属性
@property (nonatomic, retain) UILabel *mLabel;
@property (nonatomic ,retain) UITextField *mTextField;
@end
#import "LTView.h"
@implementation LTView
#warning 第一步,重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self createMyView];
}
return self;
}
#warning 第三步,创建视图
- (void)createMyView
{
//初始化我们定义的属性
self.mLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 70, 50)];
self.mLabel.backgroundColor = [UIColor greenColor];
[self addSubview:self.mLabel];
[_mLabel release];
self.mTextField = [[UITextField alloc]initWithFrame:CGRectMake(90, 10, 230, 50)];
self.mTextField.backgroundColor = [UIColor yellowColor];
[self addSubview:self.mTextField];
[_mTextField release];
}
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (void)dealloc
{
[_window release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
LTView *mView = [[LTView alloc]initWithFrame:CGRectMake(10, 100, 340, 70)];
mView.backgroundColor = [UIColor grayColor];
[self.window addSubview:mView];
[mView release];
return YES;
}
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。