Reputation: 1595
How can I add a button in textview? for example..
textView.text=@"text here\n\n text also here\n\n text here aswell";
How can I add a button after each "\n\n" or along the text?
Upvotes: 2
Views: 1523
Reputation: 1440
so your \n\n creates a paragraphs
You can do it without static text just split your text in separate textviews by \n\n, add them to your scrollview. You have to measure your text paragraphs height to set the right frame for textviews and leave gaps for buttons. I would rather use tableview so you dont have to worry about that. Add buttons in between, it is doable.
you may reconsider adding buttons along the text this way (you can but it is really convoluted way of doing things), use webview for that as already stated here by others
Upvotes: 0
Reputation: 9740
You can create a object of UIButton
and add it as subview to yout textview
.
You need to preset the frame of the button So the text must be statis and you must know the position of the button in advance.
Upvotes: 1