0
自分のコンテンツに合ったUIViewを作成したいと思います。内容は、ダイナミックテキストのUILabelです。コンテンツに応じた適応可能な高さのUIView - Objective-c
UIView *myview = [ [UIView alloc ] initWithFrame:CGRectMake(10.0, 10.0, 700.0, 100.0)];
myview.backgroundColor = [UIColor redColor];
[self.view addSubview:myview];
UILabel *myLabel = [ [UILabel alloc ] initWithFrame:CGRectMake(10.0, 10.0, 500.0, 43.0) ];
myLabel.textAlignment = UITextAlignmentLeft;
myLabel.textColor = [UIColor whiteColor];
myLabel.backgroundColor = [UIColor blackColor];
myLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(36.0)];
[myView addSubview:myLabel];
myLabel.numberOfLines = 0;
myLabel.text = @"This is an UILabel. This is an UILabel. This is an UILabel. This is an UILabel. This is an UILabel. This is an UILabel. This is an UILabel. ";
[myLabel sizeToFit];
私はスクリーンショットを添付:
ほぼ!これは問題ありませんが、マージンは維持されません。 Look:http://i54.tinypic.com/15gpmy8.png – HispaJavi
これは解決策ではないと思います。私はこれの下に別のラベルを貼る必要があります。 – HispaJavi
さて、私はそれをやった。ありがとうございました。 – HispaJavi