I tried to find out the answer what I want but I couldn't. I just wonder what will be happened if when I call the method several times but just passing meaningless value For example
in .h file
UIViewController * v;
in .m file
-(void) A:(UIViewController*) viewcontroller{
v = viewcontroller;
}
-(void) B{
[self A:nil];
}
-(void) C{
[self A:nil];
}
-(void) D{
[self A:nil];
}
in this case A always get nil.
if this action repeat again and again is it okay? or is it bad for memory? if it's bad for memory then how it affects memory?
No, there is no bad effect on memory because you only have one instance of UIViewController
in your .h file and you are setting nil
value to same object.
If you have some looping and inside that you will create some UIControl
s repeatedly and adding them to your main view or subviews then it may cause memory issues if you have not destroyed/release them properly when you don't need it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.