Skip to content

Instantly share code, notes, and snippets.

@jhonsore
Created February 9, 2016 19:48
Show Gist options
  • Save jhonsore/86e2ee516b48ba95e0ef to your computer and use it in GitHub Desktop.
Save jhonsore/86e2ee516b48ba95e0ef to your computer and use it in GitHub Desktop.
Simple input field in ios
NSString *roboto_font = @"Roboto-Regular";
UITextField *input_login = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
input_login.alpha = 0.1f;
input_login.textAlignment = NSTextAlignmentCenter;
input_login.textColor = [UIColor whiteColor];
input_login.layer.shadowColor = [[UIColor blackColor] CGColor];
input_login.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
input_login.layer.shadowOpacity = 1.0f;
input_login.layer.shadowRadius = 1.0f;
input_login.font = [UIFont fontWithName:roboto_font size:15];
input_login.attributedPlaceholder =
[[NSAttributedString alloc] initWithString:value
attributes:@{
NSForegroundColorAttributeName: [UIColor whiteColor],
NSFontAttributeName : [UIFont fontWithName:roboto_font size:15.0]
}
];
[field addSubview:input_login];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment