How to set content inset for UITextView in ios

got answer: [atextView setTextContainerInset:UIEdgeInsetsMake(7, 7, 0, 0)]; fixed my problem. And in Swift… @IBOutlet var tv:UITextView! override func awakeFromNib() { super.awakeFromNib() tv.textContainerInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) } UPDATE: another option to do that. UIView *spacerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; [msgtext setLeftViewMode:UITextFieldViewModeAlways]; [msgtext setLeftView:spacerView];

How to make a UITableViewCell with a UITextView inside, that dynamically adjust its height, on the basis of the UITextView?

Looking at this,you need to be somewhat tricky. You need to calculate the height of the textView dynamically and based on the Height of the TextView,you need to return the Height for the cell.. It’s very easy & somewhat Tricky.. This is the code by which you can calculate the size of string…. First get … Read more

How to set font weight as light, regular in Android

Use android:textStyle on a TextView to set the text style like bold, italic or normal. Here is an example of a TextView with a bold text style: <TextView android:id=”@+id/hello_world” android:text=”hello world” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:textStyle=”bold”/> If you want to use light or condensed, you will have to change your font. You can do it like this: … Read more

How to add image and text in UITextView in IOS?

This is absolutely possible now, using + (NSAttributedString *)attributedStringWithAttachment:(NSTextAttachment *)attachment See Apple docs here And this example taken from this other answer: UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0,140,140)]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@”before after”]; NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; textAttachment.image = [UIImage imageNamed:@”sample_image.jpg”]; CGFloat oldWidth = textAttachment.image.size.width; //I’m subtracting 10px to make the … Read more