티스토리 뷰
UIView LifeCycle
- (void)didMoveToSuperview {
[super didMoveToSuperview];
NSLog(@"didMoveToSuperview");
}
- (void)awakeFromNib {
[super awakeFromNib];
NSLog(@"awakeFromNib");
}
- (void)willMoveToWindow:(UIWindow *)newWindow {
[super willMoveToWindow:newWindow];
NSLog(@"willMoveToWindow");
}
- (void)didMoveToWindow {
[super didMoveToWindow];
NSLog(@"didMoveToWindow");
}
- (void)layoutSubviews {
[super layoutSubviews];
NSLog(@"layoutSubviews");
}
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
NSLog(@"drawRect");
}
2016-05-05 12:16:40.252 test[3087:304865] didMoveToSuperview
2016-05-05 12:16:40.254 test[3087:304865] willMoveToWindow
2016-05-05 12:16:40.254 test[3087:304865] didMoveToWindow
2016-05-05 12:16:40.256 test[3087:304865] layoutSubviews
2016-05-05 12:16:40.256 test[3087:304865] drawRect
- awakeFromNib 이 호출 안되는 이유?
It sends an awakeFromNib message to the appropriate objects in the nib file that define the matching selector:
- In Mac OS X, this message is sent to any interface objects that define the method.
It is also sent to the File’s Owner and any proxy objects that define it as well.
- In iPhone OS, this message is sent only to the interface objects that were instantiated by the nib-loading code.
It is not sent to File’s Owner, First Responder, or any other proxy objects.
UIView LifeCycle 상세
1. initWithCoder:
layerClass
setNeedsDisplay
addConstraints:
addConstraint: (can happen multiple times)
2. willMoveToSuperview:
3. invalidateIntrinsicContentSize
4. didMoveToSuperview
5. awakeFromNib
6. willMoveToWindow:
7. needsUpdateConstraints
8. didMoveToWindow
9. setNeedsLayout
10. updateConstraints
intrinsicContentSize
11. layoutSubviews (can happen multiple times)
12. drawRect:
UIView 에서 실제 사이즈가 잡히는 시간 테스트 결과값
- (void)didMoveToSuperview {
[super didMoveToSuperview];
NSLog(@"didMoveToSuperview : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)awakeFromNib {
[super awakeFromNib];
NSLog(@"awakeFromNib : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)willMoveToWindow:(UIWindow *)newWindow {
[super willMoveToWindow:newWindow];
NSLog(@"willMoveToWindow : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)didMoveToWindow {
[super didMoveToWindow];
NSLog(@"didMoveToWindow : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)updateConstraints {
[super updateConstraints];
NSLog(@"updateConstraints : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)layoutSubviews {
[super layoutSubviews];
NSLog(@"layoutSubviews : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
NSLog(@"drawRect : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
[super didMoveToSuperview];
NSLog(@"didMoveToSuperview : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)awakeFromNib {
[super awakeFromNib];
NSLog(@"awakeFromNib : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)willMoveToWindow:(UIWindow *)newWindow {
[super willMoveToWindow:newWindow];
NSLog(@"willMoveToWindow : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)didMoveToWindow {
[super didMoveToWindow];
NSLog(@"didMoveToWindow : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)updateConstraints {
[super updateConstraints];
NSLog(@"updateConstraints : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)layoutSubviews {
[super layoutSubviews];
NSLog(@"layoutSubviews : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
NSLog(@"drawRect : %f, %f", _smallView.frame.size.width, _smallView.frame.size.height);
}
2016-05-05 12:28:55.772 test[3673:371030] didMoveToSuperview : 240.000000, 20.000000
2016-05-05 12:28:55.773 test[3673:371030] willMoveToWindow : 240.000000, 20.000000
2016-05-05 12:28:55.774 test[3673:371030] didMoveToWindow : 240.000000, 20.000000
2016-05-05 12:28:55.775 test[3673:371030] updateConstraints : 240.000000, 20.000000
2016-05-05 12:28:55.776 test[3673:371030] layoutSubviews : 240.000000, 20.000000
2016-05-05 12:28:55.776 test[3673:371030] drawRect : 20.000000, 20.000000
참고자료
https://bradbambara.wordpress.com/2015/01/18/object-life-cycle-uiview/
'iOS 개발 > iOS' 카테고리의 다른 글
[iOS9] App Transport Security 대응방법, ATS 안전한 연결 조건 (0) | 2016.07.24 |
---|---|
iPhone 초기화, Simulator Path, Sandbox 추출 (0) | 2016.07.24 |
ViewController LifeCycle (0) | 2016.07.24 |
Application LifeCycle (0) | 2016.07.24 |
int, NSInteger, NSNumber의 차이 (0) | 2016.07.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- NSManagedObject
- string
- ios
- UIView
- coredata
- CIImage
- AWS
- Swift 3.0
- 읽기 좋은 코드가 좋은 코드다
- RunLoop
- CGImage
- HTTP
- set
- Swift 3
- delegate
- EffectiveObjectiveC
- optional
- Arc
- NSManagedObjectModel
- docker
- NSManagedObjectContext
- Swift
- applicationWillResignActive
- workerThread
- Swift3
- dictionary
- Swfit
- 꺼내먹어요
- thread
- Block
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함