ios - Scroll content in UITextView with limited lines count -


i've problem setting uitextview control work expect. have that:

[textview.textcontainer setmaximumnumberoflines:3]; [tv.textcontainer setlinebreakmode:nslinebreakbywordwrapping]; [textview setuserinteractionenabled:yes]; [textview setscrollenabled:yes]; 

my expected result have editable text view default 1 line height. when put text, control expend 3 lines maximum, , after still able write, content scrollable in 3 lines control.

unfortunately based on above code i'm not able result. when control has 3 lines height, , put more text, cursor disappear , still can write, without possibility scroll entered content.

do have advices or hints how can achieve expected behavior of uitextviewcontroller?

following on comment, here's example of how can control how 'space' uitextview can use , how scrolling set match:

uitextview* _textview = [uitextview new]; // other setup... _textview.textcontainerinset = uiedgeinsetsmake(60, 5, 8, 5); _textview.scrollindicatorinsets = uiedgeinsetsmake(52, 0, 0, 0); 

in example, had _textview taking of it's parent view (using auto layout constraints, amounted whole screen). e.g.

nsarray* constraints; constraints = [nslayoutconstraint constraintswithvisualformat:@"h:|[_textview]|" options:0 metrics:nil views:views]; [self.view addconstraints:constraints];  constraints = [nslayoutconstraint constraintswithvisualformat:@"v:|[_textview]" options:0 metrics:nil views:views]; [self.view addconstraints:constraints]; 

i had custom toolbar @ top of screen, had height of 52. (custom toolbar, not stock uinavigationbar).

so, in case used textcontainerinset property restrict portion of text view used displaying text: top margin relevant, wanted clear height of 52 toolbar , have additional margin (8).

additionally, used scrollindicatorinsets make scroll indicators stop 52 units top (the size of toolbar).

i don't know how textview fits other controls in view... but, control amount of space used text , how scrolling works along that, need more than:

[textview.textcontainer setmaximumnumberoflines:3]; 

does help?


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -