Password validation in UITextField in iOS

This is how I would do it. The validation should be done at the end when the user has typed in the password and not in between.I will not be using NSRegularExpression. -(void)textFieldDidEndEditing:(UITextField *)textField{ int numberofCharacters = 0; BOOL lowerCaseLetter,upperCaseLetter,digit,specialCharacter = 0; if([textField.text length] >= 10) { for (int i = 0; i < [textfield.text … Read more

Core Data’s NSPrivateQueueConcurrencyType and sharing objects between threads

When you use NSPrivateQueueConcurrencyType you need to do anything that touches that context or any object belonging to that context inside the -performBlock: method. Your code above is illegal since you’re passing those objects back to the main queue. The new API helps you in solving this, though: You create one context that’s associated with … Read more

Application windows are expected to have a root view controller at the end of application launch warning

It’s odd to be setting your window’s rootViewController in application:didFinishLaunchingWithOptions: if you have a MainWindow.xib. Usually a project follows one of three templates: Some projects have a MainWindow.xib. The target’s “Main Interface” is set to “MainWindow” in the target’s Summary tab (or in its Info.plist). This xib’s File’s Owner is UIApplication. The xib contains an … Read more

How to create custom modal segue in 4.2 Xcode using storyboard [closed]

This custom seque pops back to the root of a navigation stack. Use a normal pop instead of “popToViewController” if you want to go back one level. I just love the name of this method. header: #import <UIKit/UIKit.h> @interface FlipTopPopToRoot : UIStoryboardSegue @end implementation: #import “FlipTopPopToRoot.h” @implementation FlipTopPopToRoot – (void) perform { UIViewController *src = … Read more