Category: iPhone

Email validation on textField in iPhone 0

Email validation on textField in iPhone

Use NSPredicate and Regex: – (BOOL)validateEmailWithString:(NSString*)email{    NSString *emailRegex = @”[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}”;     NSPredicate *emailTest = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, emailRegex];     return [emailTest evaluateWithObject:email];}   For a bunch of emails separated by...

Play a audio file in Iphone 0

Play a audio file in Iphone

These are the codes for the Play, Pause, Stop, Resume button for playing a song. appSoundPlayer is a property of AVAudioPlayer declared in h file. Also this example plays a song in the resource...

Creating Basic Buttons 0

Creating Basic Buttons

// Implement loadView to create a view hierarchy programmatically, // without using a nib.- (void)loadView {          //allocate the view  self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];         ...

Add images to bar button item of toolbar in iphone 0

Add images to bar button item of toolbar in iphone

Set the button type as custom. UIButton *button =  [UIButton buttonWithType:UIButtonTypeCustom];[button setImage:[UIImage imageNamed:@”myImage.png”]  forState:UIControlStateNormal];[button addTarget:self action:@selector(blah)  forControlEvents:UIControlEventTouchUpInside];[button setFrame:CGRectMake(0, 0, 32, 32)];self.navigationItem.rightBarButtonItem =   [[UIBarButtonItem alloc] initWithCustomView:button];

programmatically create TABBAR 0

programmatically create TABBAR

tabBars = [[UITabBarController alloc] init];NSMutableArray *localViewControllersArray =  [[NSMutableArray alloc] initWithCapacity:4];HomeTabViewController *ptr_homeTab;ptr_homeTab = [[HomeTabViewController alloc]  initWithNibName:@”HomeTabViewController” bundle:nil];UINavigationController *homeNavBar=[[UINavigationController alloc]  initWithRootViewController:ptr_homeTab];homeNavBar.tabBarItem.title=@”Home”;homeNavBar.tabBarItem.image=[UIImage imageNamed:@”home.png”];[ptr_homeTab release];myHospitalviewController=[[MyHospitalViewController alloc]  initWithNibName:@”MyHospitalViewController” bundle:nil];UINavigationController *myHospitalNavBar=[[UINavigationController alloc]  initWithRootViewController:myHospitalviewController];myHospitalNavBar.title=@”My Hospital”;myHospitalNavBar.tabBarItem.image=[UIImage imageNamed:@”myhospital.png”];[myHospitalviewController release];viewController = [[TreatMentiViewController alloc]  initWithNibName:@”TreatMentiViewController”...