2011-10-17 22 views
0

獲得劃線背景UI的TextView我發現了一個代碼hereUITextView的格線與文字

我用同樣的代碼進行調整,但根據我的需要我添加的保證金人物代碼和數字看起來如下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];