다음 코드를 사용하여이를 수행 할 수 있습니다.
난 당신이 텍스트 필드의 도움을 당신이있는 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];
과 같은 방법으로 그렇게 할 수 라벨과 같은 방법에 대한 해당 코드를했던 그냥 scrollview의 프레임을 설정해야하며 완료되었습니다.
고맙습니다 ...... 여기서 25
출처
2011-08-30 03:51:20
SJS
UITextView를 편집 할 수 있습니까? – jin