i have NSString value in addViewController and i want to display this value in UILabel of DetailsViewController

前端 未结 5 1255
别跟我提以往
别跟我提以往 2020-12-12 06:45

I am newbie to programming. Any help could be greatly appreciated.

It\'s in AddViewController.

NSLog(@\"Am Currently at %@\",locatedAt);

DetailsOfPe         


        
5条回答
  •  既然无缘
    2020-12-12 07:26

    The issue is due to you are assigning an autoreleased variable. It's released before you display it on the detailView. So you need to retain it. Or You need to allocate the testAddressStr.

    Just replace this line:

    details.testAddressStr=[NSString stringWithFormat:@"%@",locatedAt];
    

    with:

    details.testAddressStr = [[NSString stringWithFormat:@"%@",locatedAt] retain];
    

    or

    details.testAddressStr = [[NSString alloc] initWithString:[NSString stringWithFormat:@"%@",locatedAt]];
    

提交回复
热议问题