#import <UIKit/UIKit.h> @interface LifeView : UIView @end
#import "LifeView.h"
@interface LifeView ()
{
NSInteger count;
}
@end
@implementation LifeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
NSLog(@"<-- 1 %s , count = %@-->", __func__, @(count++));
}
return self;
}
- (void)willMoveToSuperview:(nullable UIView *)newSuperview
{
NSLog(@"<-- 2 %s , count = %@-->", __func__, @(count++));
}
- (void)didMoveToSuperview
{
NSLog(@"<-- 3 %s , count = %@-->", __func__, @(count++));
}
- (void)willMoveToWindow:(nullable UIWindow *)newWindow
{
NSLog(@"<-- 4/7 %s , count = %@-->", __func__, @(count++));
}
- (void)didMoveToWindow
{
NSLog(@"<-- 5/8 %s , count = %@-->", __func__, @(count++));
}
- (void)layoutSubviews
{
NSLog(@"<-- 6 %s , count = %@-->", __func__, @(count++));
}
- (void)removeFromSuperview
{
NSLog(@"<-- 9 %s , count = %@-->", __func__, @(count++));
}
- (void)dealloc
{
NSLog(@"<-- 10 %s , count = %@-->", __func__, @(count++));
}
@end
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"life view";
LifeView *lifeView = [[LifeView alloc] initWithFrame:CGRectMake(10.0, 80.0, 100.0, 100.0)];
[self.view addSubview:lifeView];
lifeView.tag = 1000;
lifeView.backgroundColor = [UIColor orangeColor];
}
// 实例化时 2017-06-16 00:37:10.694 DemoViewLife[3963:121184] <-- 1 -[LifeView initWithFrame:] , count = 0--> 2017-06-16 00:37:10.695 DemoViewLife[3963:121184] <-- 2 -[LifeView willMoveToSuperview:] , count = 1--> 2017-06-16 00:37:10.695 DemoViewLife[3963:121184] <-- 3 -[LifeView didMoveToSuperview] , count = 2--> 2017-06-16 00:37:10.697 DemoViewLife[3963:121184] <-- 4/7 -[LifeView willMoveToWindow:] , count = 3--> 2017-06-16 00:37:10.697 DemoViewLife[3963:121184] <-- 5/8 -[LifeView didMoveToWindow] , count = 4--> 2017-06-16 00:37:10.701 DemoViewLife[3963:121184] <-- 6 -[LifeView layoutSubviews] , count = 5-->
// 销毁时 2017-06-16 00:37:25.514 DemoViewLife[3963:121184] <-- 4/7 -[LifeView willMoveToWindow:] , count = 6--> 2017-06-16 00:37:25.514 DemoViewLife[3963:121184] <-- 5/8 -[LifeView didMoveToWindow] , count = 7--> 2017-06-16 00:37:25.515 DemoViewLife[3963:121184] <-- 9 -[LifeView removeFromSuperview] , count = 8--> 2017-06-16 00:37:25.516 DemoViewLife[3963:121184] <-- 9 -[LifeView removeFromSuperview] , count = 9--> 2017-06-16 00:37:25.518 DemoViewLife[3963:121184] <-- 10 -[LifeView dealloc] , count = 10-->
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有