My problem is that I have created a textfield which has leftviewmode as an image and the placeholder is in somewhere middle of textfield where the text editing should get start when user starts typing. So how to get my text started from middle of textfield just where the placeholder is. I cannot set the leftviewmode in imageview because I already added image there. What should I do?
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"a_point30"]];
image.frame = CGRectMake(0, 0, image.image.size.width, image.image.size.height-10);
self.enterSource.leftViewMode = UITextFieldViewModeAlways; self.enterSource.leftView = image;
You can do something like this,
UIImageView *imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imgName]]; imgView.frame = CGRectMake(0.0, 0.0, dropDown.image.size.width+10.0, dropDown.image.size.height); imgView.contentMode = UIViewContentModeLeft; textField.leftView = imgView; textField.leftViewMode = UITextFieldViewModeAlways;