これは、次のコードの助けを借りて行うことができます。私はあなたがScrollview
のために行うことができ、テキストフィールドの助けを借りて
NSString *cellText = "Text Of Your Text-Field";
UIFont *cellFont = [UIFont fontWithName:@"Your Font Name" size:FONT_SIZE];//UIFont *cellFont = [UIFont fontWithName:@"Helvetica-Bold" size:13.0];
CGSize constraintSize = CGSizeMake(@"Width Of Your Text-Field", MAXFLOAT);//CGSize constraintSize = CGSizeMake(220.0f, MAXFLOAT);
CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
int height = labelSize.height;
frame.origin.x = Starting Position of X;
frame.origin.y = Starting Position of Y;
frame.size.width = Width Of Your TextField;
frame.size.height = height;
UILabel *lblName = [[[UILabel alloc] initWithFrame:frame] autorelease];
lblName.numberOfLines = 0;
lblName.lineBreakMode = UILineBreakModeWordWrap;
lblName.textAlignment = UITextAlignmentLeft;
lblName.textColor = [UIColor whiteColor];
lblName.backgroundColor = [UIColor clearColor];
lblName.font = [UIFont boldSystemFontOfSize:13.0];
と同じようにそのラベルとあなたがすることができるのと同じ方法のためにそのコードを行っていた
そのスクロールビューのフレームを設定するだけで完了です。
ありがとう......ここ25
出典
2011-08-30 03:51:20
SJS
UITextViewは編集可能ですか? – jin