0

to get a ruled line background with UI textview i found a code from here

i used the same code, but according to my need i have added a margin figure in the code and the figure looks as followsenter image description here

Now i want the text to be places next to the margin line and in the first line of every paragraph i want to show some spaces from the margin to the first word. how to do this please guide me

Community
  • 1
  • 1
Siva K
  • 4,968
  • 14
  • 82
  • 161

1 Answers1

0

When the padding view was added as subview it worked as a fine margin for me.

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]; 
Manali
  • 577
  • 4
  • 11