首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

UIButton没法显示title

2012-09-13 
UIButton无法显示titleC/C++ codebtn1[UIButton buttonWithType:UIButtonTypeRoundedRect][btn1 setTitl

UIButton无法显示title

C/C++ code
    btn1=[UIButton buttonWithType:UIButtonTypeRoundedRect];    [btn1 setTitle:@"OK" forState:UIControlStateNormal];    [btn1 setFrame:CGRectMake(10, 10, 100, 50)];    [self.view addSubview:btn1];    [btn1 release];


这是源码,为什么运行后,Button的title没法显示呢?

[解决办法]
去掉[btn1 release];
[解决办法]

只有init的UIButton才需要release。
[解决办法]
你没有给button alloc内存啊,release以后button就没有了。

热点排行