if I code these:
UIView *topView = [UIView new];
for (int i = 0; i < 100; i++) {
UIView *childView = [UIView new];
[topView addSubview:childView]
}
Does topView redraw every time when I called the “addSubview” function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No,
topViewdoes not redraw every time. It is simply flagged as “needs display” each time, which is a cheap operation. When you return to the run loop, the run loop will telltopViewto actually redraw itself and clear the “needs display” flag.