2011-10-17 2 views
0

은 내가 동일한 코드를 사용UITextView는

here에서 코드를 발견 텍스트 뷰 UI와 지배 라인 배경을 얻을 수있는 텍스트로 조정할 수 라인을 지배하지만, 내 필요에 따라 난의 마진 그림을 추가 한 코드 및 그림은 다음과 같습니다. enter image description here

이제 텍스트를 여백 줄 옆에 놓고 모든 단락의 첫 줄에 여백에서 첫 번째 단어까지 공백을 표시하고 싶습니다. 어떻게하는지 안내해주세요.

답변

0

패딩 뷰가 서브 뷰로 추가되면, 그것은 저에게 좋은 마진으로 작용했습니다.

UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];  
textView.backgroundColor = [UIColor redColor]; 
textView.text = @"SomeText"; 

UIView *paddingView = [[[UIView alloc] 
initWithFrame:CGRectMake(0, 0, 50, 200)] autorelease]; 
paddingView.backgroundColor = [UIColor whiteColor]; 

[textView addSubview:paddingView]; 
[self.view addSubview:textView]; 
관련 문제