码迷,mamicode.com
首页 > 移动开发 > 详细

iOS中willMoveToSuperview:方法

时间:2015-04-27 18:21:47      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

直接看代码:

#import "CMoveView.h"

@interface CMoveView ()

//记录上一次父视图

@property (nonatomic, strong) UIView* oldSuperview;

@end

@implementation CMoveView

 

//当自己重写一个UIView的时候有可能用到这个方法,当本视图的父类视图改变的时候,系统会自动的执行这个方法.newSuperview是本视图的新父类视图.newSuperview有可能是nil.

- (void)willMoveToSuperview:(UIView *)newSuperview {

    [super willMoveToSuperview:newSuperview];

    NSLog(@"oldSuperview=%@,newSuperview=%@",self.oldSuperview,newSuperview);

      self.oldSuperview = newSuperview;

    NSLog(@"%s",__func__);

}

@end

iOS中willMoveToSuperview:方法

标签:

原文地址:http://www.cnblogs.com/iOS771722918/p/4460744.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!