Ser*_*yov 6 iphone cocoa-touch objective-c uilabel ios
我正在尝试在我的应用中实现以下内容:
themeLabel = [[UILabel alloc] init];
themeLabel.backgroundColor = [UIColor redColor];
themeLabel.text = themeString;
[themeLabel sizeThatFits:CGSizeMake(274, 274)];
themeLabel.numberOfLines = 0;
[topThemeView addSubview:themeLabel];
NSLog(@"Height is %f ", themeLabel.frame.size.height);
[themeLabel setFrame:CGRectMake(leftMargin, mainScrollView.frame.origin.y + topPadding, 274, themeLabel.frame.size.height)];
Run Code Online (Sandbox Code Playgroud)
而我最终得到的Label's高度0.0.有什么想法吗?
themeLabel = [[UILabel alloc] init];
themeLabel.backgroundColor = [UIColor redColor];
themeLabel.text = themeString;
themeLabel.numberOfLines = 0;
CGRect labelFrame = CGRectMake(leftMargin, mainScrollView.frame.origin.y + topPadding, 0.0, 0.0);
labelFrame.size = [themeLabel sizeThatFits:CGSizeMake(274, 274)];
[themeLabel setFrame:labelFrame];
[topThemeView addSubview:themeLabel];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9094 次 |
| 最近记录: |