Code Is Poetry

Life is Binary

Objective c

Adding padding to uitextfield

Following code will help you to add padding to the textfield.   UITextField *myTextField = [[UITextField alloc]initWithFrame:CGRectMake(10, 10, 200, 35)]; myTextField.delegate = self; myTextField.placeholder = @"Placeholder"; [myTextField setFont:[UIFont systemFontOfSize:14]]; myTextField.returnKeyType = UIReturnKeyDone; myTextField.keyboardType = UIKeyboardTypeDefault; UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 20)]; myTextField.leftView =...

Read more

View control redirect from custom view

http://stackoverflow.com/questions/15622736/using-presentviewcontroller-from-uiview UIViewController *currentTopVC = [self currentTopViewController]; currentTopVC.presentViewController......... - (UIViewController *)currentTopViewController { UIViewController *topVC = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; while (topVC.presentedViewController) { topVC = topVC.presentedViewController; } return topVC; }

Read more

Adding constraints to Auto Layout programmatically

- views have array of contrstaints- can be built with visual format- can also be built with class method on NSLayoutConstraintConstraints with visual formattext based visual format describes constaints  V:[bigBlueView]-55-[caption]:   <------------------------- V indicates vertical constraint, meaning caption should be 55 points below bigBlueView  V:|-49-[bigBlueView]: | indicates the superview, meaning bigBlueView should be 49 points from the top of the...

Read more