iphone - UILabel 属性转储

标签 iphone ios objective-c xcode uilabel

我有一个 UILabel,其属性设置在 IB 中(如自定义字体、阴影颜色、文本颜色等)。我想打印此 UILabel 的所有属性,以使我能够在 UITableViewCell textLabel 属性内的不同屏幕上使用同一组属性.如何打印我在第一个屏幕中设置的所有属性,以便将其与 UITableViewCell 中的 textLabel 属性一起使用?

最佳答案

创建一个函数来设置第一个屏幕上标签的属性。

-(void) setLabelProperties: (UILabel *) myLabel{
myLabel.textColor = [UIColor redColor];
//set other properties
}

在你的

上调用相同的方法
- (UITableViewCell*)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

setLabelProperties(cell.textLabel);
}

关于iphone - UILabel 属性转储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14252825/

相关文章:

iOS:从 Crashlytics 了解 SIGABRT 崩溃

iphone - 适用于 BlackBerry 和 iPhone 的测试自动化工具

ios - 如何使用 alamofire 图像检查分段上传是否成功

ios7 : Custom Push segue pre iOS7 style almost working

iphone - 将 UIView 转换为 UITableView

objective-c - 如何防止 OS X 文本布局引擎自动使用从右到左的文本 "flipping"行?

ios - 将移除 navigationBar 边框转换为 swift

ios - 如何解决此错误,例如 Invalid `Podfile` file : [! ] Unsupported options `{:exclusive=>true}` for target

iphone - 如何获取iphone通讯录中所有联系人的家庭住址

iOS - 无法部署到 iOS 6.1 模拟器或将部署目标设置为 iOS 6.1