UIViewController retain count problem

前端 未结 4 1255
我寻月下人不归
我寻月下人不归 2021-01-25 16:11

I am creating a new UIViewController with the below code

GameViewController *temp = [[GameViewController alloc] initWithNibName:@\"GameViewController\" bundle:ni         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 16:42

    Never use retainCount, it does not work the way you think it does.

    If you need to see where retains, releases and autoreleases occur for an object use instruments:

    Run in instruments, in Allocations set "Record reference counts" on on (you have to stop recording to set the option). Cause the picker to run, stop recording, search for there ivar (datePickerView), drill down and you will be able to see where all retains, releases and autoreleases occurred.

    Example screenshot

提交回复
热议问题