Mishal Awan Mishal Awan - 2 years ago 110
Objective-C Question

position of UITextfield not setting properly

I am making an app i want to set my position of

. but i am stuck in it, it is setting only
vertical position
horizontal position
. below is my code and screen shot

CGRect frame = CGRectMake(100,100,10,100);
UILabel * leftView = [[UILabel alloc] initWithFrame:frame];
leftView.backgroundColor = [UIColor clearColor];
self.Msgtextfield.leftView = leftView;
self.Msgtextfield.leftViewMode = UITextFieldViewModeAlways;
self.Msgtextfield.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;

i want the text starting from the topleft corner of uitextfield

Answer Source

use CATransform3DMakeTranslation don't forget to import Quartzcore framework

 self.Msgtextfield.layer.sublayerTransform=CATransform3DMakeTranslation(5, 0, 0);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download