received memory warning. level 1

前端 未结 3 1554

I am new to iPhone development. I am creating an application in which i need to create buttons and labels programmatically.
So I am doing this in .h file



        
3条回答
  •  生来不讨喜
    2021-01-07 16:20

    Since you alloced memory, you need to release it as well. Anytime you use alloc, copy or new, remember to always release. Its not a good idea to release everything only at dealloc. Release objects when you are done with them. For example:

     setchallange = [[NSString alloc] initWithFormat:@"%@" , challange];//Memory leak here
     Challengetext.text = setchallange;
     [setchallange release]
    

    Also checkout out the iOS memory management guide. I'm sure it will help.

提交回复
热议问题