Saturday, October 5, 2013

UIButton not display title

 

btn1 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[Btn1 setTitle: @ "OK" forState: UIControlStateNormal];
[Btn1 setFrame: CGRectMake (10, 10, 100, 50)];
[Self.view addSubview: btn1];
[Btn1 release];



This is the source, why run, Button's title can not display it?
Reply:
Remove [btn1 release];
Reply:
quote 1 floor reply:
remove [btn1 release];


Useful, but why the release Button have problems? title is set up well before release
Reply:

Only the init UIButton only need to release.
Reply:
You did not give button alloc memory ah, release button, there is no future.

No comments:

Post a Comment