There is a UITextField with 2 elements (rightView and leftView):
label.text = @"Ваш пол"; clientGender.leftViewMode = UITextFieldViewModeAlways; clientGender.leftView = label; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]]; clientGender.rightViewMode = UITextFieldViewModeAlways; clientGender.rightView = imageView; Question: how to indent for the text field, since leftView (the inscription "Your floor") - fits on the textview
UPD. The issue is resolved by creating a subclass for UITextField with such a perversion: /
- (id)initWithCoder:(NSCoder*)coder { self = [super initWithCoder:coder]; if (self) { self.clipsToBounds = YES; [self setRightViewMode:UITextFieldViewModeUnlessEditing]; [self setLeftViewMode:UITextFieldViewModeUnlessEditing]; //self.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"textfield_edit_icon.png"]]; } return self; } - (CGRect) rightViewRectForBounds:(CGRect)bounds { CGRect textRect = [super rightViewRectForBounds:bounds]; textRect.origin.x -= 10; return textRect; } - (CGRect) leftViewRectForBounds:(CGRect)bounds { CGRect textRect = [super leftViewRectForBounds:bounds]; textRect.origin.x += 10; return textRect; } - (CGRect)textRectForBounds:(CGRect)bounds{ CGRect textRect = [super textRectForBounds:bounds]; textRect.origin.x += 0; textRect.size.width -= 10; return textRect; }