![](/img/trans.png)
[英]TableViewCell, dynamically show Media Player controls iPhone
[英]iPhone + add controls dynamically
我想通过代码(以编程方式)将UILabel控件动态地添加到我的应用程序中,请帮助我
您可以通过一种视图控制器方法通过以下方式进行操作:
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(...)]; // Create UILabel
myLabel.tag = someTag; // set label's tag to access this label in future via [view viewWithTag:someTag];
... // set label's properties like text, background and text color, font size etc (e.g. myLabel.textColor = [UIColor redColor];)
[view addSubView:myLabel]; // add label to your view
[myLabel release]; // view owns the label now so we can release it
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.