Sunday, 29 September 2013

HomeViewController.h

#import <UIKit/UIKit.h>
#import "AddEmiViewController.h"
#import "ContactUsViewController.h"
#import "FindProductViewController.h"
#import "WebViewController.h"
@interface HomeViewController : UIViewController
{
    UIImageView *myLogo,*myBackground,*infoImageView;
    
    UIButton *everyMonthIncomeButton,*everyMonthExpenditureButton,*everyDayExpenditureButton,*viewSpndingsButton,*mywebsiteButton,*contactUsButton,*termsAndConditionsButton,*findProductButton,*infoButton;
    UILabel *everyMonthIncomeLabel,*everyMonthExpenditureLabel,*everyDayExpenditureLabel,*viewSpndingsLabel,*mywebsiteLabel,*contactUsLabel,*termsAndConditionsLabel,*findProductLabel;

    UIImage *everyMonthIncomeImage,*everyMonthExpenditureImage,*everyDayExpenditureImage,*viewSpndingsImage,*mywebsiteImage,*contactUsImage,*termsAndConditionsImage,*findProductImage,*infoImage;
    UIBarButtonItem *logoutButton;
    
}
-(void)everyMonthIncomeButtonClicked;
-(void)everyMonthExpenditureButtonClicked;
-(void)everyDayExpenditureButtonClicked;
-(void)viewSpndingsButtonClicked;
-(void)mywebsiteButtonClicked;
-(void)contactUsButtonClicked;
-(void)termsAndConditionsButtonClicked;
-(void)findProductButtonClicked;



@end

HomeViewController.m


#import "HomeViewController.h"

@interface HomeViewController ()

@end

@implementation HomeViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    logoutButton=[[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleBordered target:self action:@selector(logoutClicked)];
    self.navigationItem.rightBarButtonItem=logoutButton;
    
    
    UIImage *myImage,*myBackgroundImage;
    myBackgroundImage=[UIImage imageNamed:@"skyblue.jpg"];
    myBackground=[[UIImageView alloc] initWithImage:myBackgroundImage];
    [myBackground setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:myBackground];
        
    myImage=[UIImage imageNamed:@"mylogo.png"];
    myLogo=[[UIImageView alloc] initWithImage:myImage];
    [myLogo setFrame:CGRectMake(60, 20, 200, 60)];
    [self.view addSubview:myLogo];
    
    everyMonthIncomeImage=[UIImage imageNamed:@"income.jpeg"];
    
    everyMonthIncomeButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [everyMonthIncomeButton setFrame:CGRectMake(30, 110, 70, 60)];
    [everyMonthIncomeButton setBackgroundImage:everyMonthIncomeImage forState:UIControlStateNormal];                        
    [everyMonthIncomeButton addTarget:self action:@selector(everyMonthIncomeButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:everyMonthIncomeButton];
    
    
everyMonthExpenditureImage=[UIImage imageNamed:@"expenditure3.jpg"];
    
    everyMonthExpenditureButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [everyMonthExpenditureButton setFrame:CGRectMake(120, 110, 70, 60)];
    [everyMonthExpenditureButton setBackgroundImage:everyMonthExpenditureImage forState:UIControlStateNormal];
    
    [self.view addSubview:everyMonthExpenditureButton];
    
    everyDayExpenditureImage=[UIImage imageNamed:@"expenditure4.jpg"];
    
    everyDayExpenditureButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [everyDayExpenditureButton setFrame:CGRectMake(210, 110, 70, 60)];
    [everyDayExpenditureButton setBackgroundImage:everyDayExpenditureImage forState:UIControlStateNormal];
    
    [self.view addSubview:everyDayExpenditureButton];
    
    everyMonthIncomeLabel=[[UILabel alloc] initWithFrame:CGRectMake(30, 180, 70, 60)];

    [everyMonthIncomeLabel setText:@"Every Month Income"];
    [everyMonthIncomeLabel setNumberOfLines:3];
    [everyMonthIncomeLabel setBackgroundColor:[UIColor clearColor]];
    [everyMonthIncomeLabel setFont:[UIFont systemFontOfSize:11]];
   [everyMonthIncomeLabel setTextAlignment:NSTextAlignmentCenter];
    [everyMonthIncomeLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:everyMonthIncomeLabel];
    
    
    everyMonthExpenditureLabel=[[UILabel alloc] initWithFrame:CGRectMake(120, 180, 70, 60)];
    
    [everyMonthExpenditureLabel setText:@"Every Month Expenditure"];
    [everyMonthExpenditureLabel setNumberOfLines:3];
    [everyMonthExpenditureLabel setBackgroundColor:[UIColor clearColor]];
    [everyMonthExpenditureLabel setFont:[UIFont systemFontOfSize:11]];
    [everyMonthExpenditureLabel setTextAlignment:NSTextAlignmentCenter];
    [everyMonthExpenditureLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:everyMonthExpenditureLabel];
    
    everyDayExpenditureLabel=[[UILabel alloc] initWithFrame:CGRectMake(210, 180, 70, 60)];
    
    [everyDayExpenditureLabel setText:@"Every Day Expenditure"];
    [everyDayExpenditureLabel setNumberOfLines:3];
    [everyDayExpenditureLabel setBackgroundColor:[UIColor clearColor]];
    [everyDayExpenditureLabel setFont:[UIFont systemFontOfSize:11]];
    [everyDayExpenditureLabel setTextAlignment:NSTextAlignmentCenter];
    [everyDayExpenditureLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:everyDayExpenditureLabel];
    
    
    viewSpndingsImage=[UIImage imageNamed:@"viewspendings.jpg"];
    
    viewSpndingsButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [viewSpndingsButton  setFrame:CGRectMake(30, 250, 70, 60)];
    [viewSpndingsButton setBackgroundImage:viewSpndingsImage forState:UIControlStateNormal];
    
    [self.view addSubview:viewSpndingsButton];
    
    
    mywebsiteImage=[UIImage imageNamed:@"mywebsite2.jpg"];
    
    mywebsiteButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [mywebsiteButton  setFrame:CGRectMake(120, 250, 70, 60)];
    [mywebsiteButton setBackgroundImage:mywebsiteImage forState:UIControlStateNormal];
    [mywebsiteButton addTarget:self action:@selector(mywebsiteButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    
    
    [self.view addSubview:mywebsiteButton];
    
    
    contactUsImage=[UIImage imageNamed:@"contactus.jpg"];
    
    contactUsButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [contactUsButton  setFrame:CGRectMake(210, 250, 70, 60)];
    [contactUsButton setBackgroundImage:contactUsImage forState:UIControlStateNormal];
    [contactUsButton addTarget:self action:@selector(contactUsButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:contactUsButton];
    
    
    viewSpndingsLabel=[[UILabel alloc] initWithFrame:CGRectMake(30, 320, 70, 60)];
    
    [viewSpndingsLabel setText:@"View Spendings"];
    [viewSpndingsLabel setNumberOfLines:2];
    [viewSpndingsLabel setBackgroundColor:[UIColor clearColor]];
    [viewSpndingsLabel setFont:[UIFont systemFontOfSize:11]];
    [viewSpndingsLabel setTextAlignment:NSTextAlignmentCenter];
    [viewSpndingsLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:viewSpndingsLabel];
    
    mywebsiteLabel=[[UILabel alloc] initWithFrame:CGRectMake(120, 320, 70, 60)];
    
    [mywebsiteLabel setText:@"My Website"];
    [mywebsiteLabel setNumberOfLines:2];
    [mywebsiteLabel setBackgroundColor:[UIColor clearColor]];
    [mywebsiteLabel setFont:[UIFont systemFontOfSize:11]];
    [mywebsiteLabel setTextAlignment:NSTextAlignmentCenter];
    [mywebsiteLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:mywebsiteLabel];
    
    contactUsLabel=[[UILabel alloc] initWithFrame:CGRectMake(210, 320, 70, 60)];
    
    [contactUsLabel setText:@"Contact Us"];
    [contactUsLabel setNumberOfLines:2];
    [contactUsLabel setBackgroundColor:[UIColor clearColor]];
    [contactUsLabel setFont:[UIFont systemFontOfSize:11]];
    [contactUsLabel setTextAlignment:NSTextAlignmentCenter];
    [contactUsLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:contactUsLabel];
    
    
    termsAndConditionsImage=[UIImage imageNamed:@"t&c.jpg"];
    
    termsAndConditionsButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [termsAndConditionsButton setFrame:CGRectMake(30, 390, 70, 60)];
    [termsAndConditionsButton setBackgroundImage:termsAndConditionsImage forState:UIControlStateNormal];
    
    [self.view addSubview:termsAndConditionsButton];
    
    
    
    findProductImage=[UIImage imageNamed:@"findproduct.jpg"];
    
    findProductButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [findProductButton setFrame:CGRectMake(120, 390, 70, 60)];
    [findProductButton setBackgroundImage:findProductImage forState:UIControlStateNormal];
    [findProductButton addTarget:self action:@selector(findProductButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:findProductButton];
    
    
    termsAndConditionsLabel=[[UILabel alloc] initWithFrame:CGRectMake(30, 450, 70, 60)];
    
    [termsAndConditionsLabel setText:@"Terms and Conditions"];
    [termsAndConditionsLabel setNumberOfLines:2];
    [termsAndConditionsLabel setBackgroundColor:[UIColor clearColor]];
    [termsAndConditionsLabel setFont:[UIFont systemFontOfSize:11]];
    [termsAndConditionsLabel setTextAlignment:NSTextAlignmentCenter];
    [termsAndConditionsLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:termsAndConditionsLabel];

    findProductLabel=[[UILabel alloc] initWithFrame:CGRectMake(120, 450, 70, 60)];
    
    [findProductLabel setText:@"Find Product"];
    [findProductLabel setNumberOfLines:2];
    [findProductLabel setBackgroundColor:[UIColor clearColor]];
    [findProductLabel setFont:[UIFont systemFontOfSize:11]];
    //  [findProductLabel setTextColor:[UIColor magentaColor ]];
    [findProductLabel setTextAlignment:NSTextAlignmentCenter];
    [findProductLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [self.view addSubview:findProductLabel];
    
    infoImage=[UIImage imageNamed:@"info.jpg"];
    //infoImageView=[[UIImageView alloc] initWithImage:infoImage];
    infoButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [infoButton setImage:infoImage forState:UIControlStateNormal];
    [infoButton setFrame:CGRectMake(250, 470, 50, 30)];
    [self.view addSubview:infoButton];
    
    self.title=@"Home";
    
    
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)everyMonthIncomeButtonClicked{
    AddEmiViewController *objAddEmi=[[AddEmiViewController alloc] init];
    [self.navigationController pushViewController:objAddEmi animated:YES];
    


}
-(void)everyMonthExpenditureButtonClicked{


}
-(void)everyDayExpenditureButtonClicked{



}

-(void)viewSpndingsButtonClicked{


}
-(void)mywebsiteButtonClicked{
    
    WebViewController *objWeb=[[WebViewController alloc] init];
    [self.navigationController pushViewController:objWeb animated:YES];


}
-(void)contactUsButtonClicked{
    
    ContactUsViewController *objcontact=[[ContactUsViewController alloc] init];
    [self.navigationController pushViewController:objcontact animated:YES];


}

-(void)termsAndConditionsButtonClicked{


}
-(void)findProductButtonClicked{

    FindProductViewController *objFindProduct=[[FindProductViewController alloc] init];
    [self.navigationController pushViewController:objFindProduct animated:YES];
    

}
-(void) logoutClicked{
    [self.navigationController popToRootViewControllerAnimated:YES];

}


@end

loginViewController.h

#import <UIKit/UIKit.h>
#import "HomeViewController.h"
#import "RegisterViewController.h"
#import "ForgotPasswordViewController.h"

@interface loginViewController : UIViewController
{
    UIButton *registerNewUserButton,*canotAccessAccountButton,*logInButton;

    UILabel *userNameLabel,*passwordLabel,*rememberMeSwitchLabel;
    UIImageView *backgroundImageView,*logoImageview;
    UIImage *backgroundImage,*logoImage;
    UISwitch *rememberMeSwitch;
}
@property(nonatomic,retain) UITextField *userNameTextField;
@property(nonatomic,retain) UITextField *passwordTextField;

-(void)loginDatasubmited;
-(void)remembermeSelected;
-(void)canotAccessMyAccount;
-(void)RegisterNewUser;
-(void)removeKeyBoard;


@end

loginViewController.m


#import "loginViewController.h"

@interface loginViewController ()

@end

@implementation loginViewController
@synthesize userNameTextField,passwordTextField;

- (void)viewDidLoad
{
    [super viewDidLoad];
    backgroundImage=[UIImage imageNamed:@"skyblue.jpg"];
    backgroundImageView=[[UIImageView alloc] initWithImage:backgroundImage];
    [backgroundImageView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:backgroundImageView];
    logoImage=[UIImage imageNamed:@"mylogo.png"];
    logoImageview=[[UIImageView alloc] initWithImage:logoImage];
    [logoImageview setFrame:CGRectMake(70, 20, 150, 50)];
    [self.view addSubview:logoImageview];
// Do any additional setup after loading the view, typically from a nib.
    registerNewUserButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [registerNewUserButton setFrame:CGRectMake(100, 100, 200, 30)];
    [registerNewUserButton setBackgroundColor:[UIColor clearColor]];
    [registerNewUserButton setTitle:@"Register New User" forState:UIControlStateNormal];
    [registerNewUserButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [registerNewUserButton addTarget:self action:@selector(RegisterNewUser) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:registerNewUserButton];
    
    userNameLabel=[[UILabel alloc] initWithFrame:CGRectMake(40, 150, 250, 20)];
    [userNameLabel setBackgroundColor:[UIColor clearColor]];
    [userNameLabel setText:@"User Name"];
    //[FirstNameLabel setTextAlignment:NSTextAlignmentCenter];
    [userNameLabel setFont:[UIFont boldSystemFontOfSize:13]];
    [self.view addSubview:userNameLabel];
    
    
    userNameTextField=[[UITextField alloc] initWithFrame:CGRectMake(30, 172, 250, 30)];
    [userNameTextField setPlaceholder:@"Enter User Name"];
    [userNameTextField setBorderStyle:UITextBorderStyleRoundedRect];
    [userNameTextField setTextAlignment:NSTextAlignmentLeft];
    [userNameTextField setFont:[UIFont systemFontOfSize:14]];
    [userNameTextField setBackgroundColor:[UIColor whiteColor]];
    [userNameTextField addTarget:self action:@selector(removeKeyBoard) forControlEvents:UIControlEventEditingDidEndOnExit];
    [self.view addSubview:userNameTextField];
    
    
    passwordLabel=[[UILabel alloc] initWithFrame:CGRectMake(40, 215, 250, 20)];
    [passwordLabel setBackgroundColor:[UIColor clearColor]];
    [passwordLabel setText:@"Password"];
    //[FirstNameLabel setTextAlignment:NSTextAlignmentCenter];
    [passwordLabel setFont:[UIFont boldSystemFontOfSize:13]];
    [self.view addSubview:passwordLabel];
    
    
    passwordTextField=[[UITextField alloc] initWithFrame:CGRectMake(30, 240, 250, 30)];
    [passwordTextField setPlaceholder:@"Enter Password"];
    [passwordTextField setBorderStyle:UITextBorderStyleRoundedRect];
    [passwordTextField setTextAlignment:NSTextAlignmentLeft];
    [passwordTextField setFont:[UIFont systemFontOfSize:14]];
    [passwordTextField setBackgroundColor:[UIColor whiteColor]];
    [passwordTextField addTarget:self action:@selector(removeKeyBoard) forControlEvents:UIControlEventEditingDidEndOnExit];
    [self.view addSubview:passwordTextField];
    
    rememberMeSwitch=[[UISwitch alloc] initWithFrame:CGRectMake(40, 290, 60, 10)];
    [self.view addSubview:rememberMeSwitch];
    
    rememberMeSwitchLabel=[[UILabel alloc] initWithFrame:CGRectMake(120, 290, 150, 20)];
    [rememberMeSwitchLabel setBackgroundColor:[UIColor clearColor]];
    [rememberMeSwitchLabel setText:@"Remember Me"];
    [rememberMeSwitchLabel setTextColor:[UIColor greenColor]];
       //[FirstNameLabel setTextAlignment:NSTextAlignmentCenter];
    [rememberMeSwitchLabel setFont:[UIFont boldSystemFontOfSize:13]];
    [self.view addSubview:rememberMeSwitchLabel];
    
    
    
    logInButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [logInButton setFrame:CGRectMake(100, 350, 80, 30)];
    [logInButton setTitle:@"LogIn" forState:UIControlStateNormal];
    [logInButton setBackgroundColor:[UIColor blueColor]];
    [logInButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [logInButton addTarget:self action:@selector(loginDatasubmited) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:logInButton];
    
    
    canotAccessAccountButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [canotAccessAccountButton setFrame:CGRectMake(10,410,250,30)];
    [canotAccessAccountButton setBackgroundColor:[UIColor clearColor]];
    [canotAccessAccountButton setTitle:@"Canot Access my account" forState:UIControlStateNormal];
    [canotAccessAccountButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [canotAccessAccountButton addTarget:self action:@selector(canotAccessMyAccount) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:canotAccessAccountButton];  

      self.title=@"Log IN";


    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)loginDatasubmited{
   
    HomeViewController *objHome=[[HomeViewController alloc] init];
    [self.navigationController pushViewController:objHome animated:YES];
    
    


}
-(void)remembermeSelected{




}
-(void)canotAccessMyAccount{
    
    ForgotPasswordViewController *objForgotPassword=[[ForgotPasswordViewController alloc] init];
    [self.navigationController pushViewController:objForgotPassword animated:YES];
    


}
-(void)RegisterNewUser{
    
    RegisterViewController *objreg=[[RegisterViewController alloc] init];
    [self.navigationController pushViewController:objreg animated:YES];


}

-(void)removeKeyBoard{
    [userNameTextField resignFirstResponder];
    [passwordTextField resignFirstResponder];

}

@end

MY Budget Project Code

For This Project I took empty view application in xcode project.
And then added Navigation controller between NaAppDelegate Class and LoginViewController Class

NavAppDelegate.h

#import <UIKit/UIKit.h>
#import "loginViewController.h"

@interface NavAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic,retain) UINavigationController *myNavigationController;
@property (nonatomic,retain) loginViewController *loginController;

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;


@end

NavAppDelegate.m

#import "NavAppDelegate.h"
#import "loginViewController.h"

@implementation NavAppDelegate

@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    loginViewController *objlogin=[[loginViewController alloc] init];
    self.myNavigationController=[[UINavigationController alloc] initWithRootViewController:objlogin];
    self.window.rootViewController=self.myNavigationController;
    
        [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Saves changes in the application's managed object context before the application terminates.
    [self saveContext];
}

- (void)saveContext
{
    NSError *error = nil;
    NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
    if (managedObjectContext != nil) {
        if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
             // Replace this implementation with code to handle the error appropriately.
             // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            abort();
        } 
    }
}

#pragma mark - Core Data stack

// Returns the managed object context for the application.
// If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
- (NSManagedObjectContext *)managedObjectContext
{
    if (_managedObjectContext != nil) {
        return _managedObjectContext;
    }
    
    NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
    if (coordinator != nil) {
        _managedObjectContext = [[NSManagedObjectContext alloc] init];
        [_managedObjectContext setPersistentStoreCoordinator:coordinator];
    }
    return _managedObjectContext;
}

// Returns the managed object model for the application.
// If the model doesn't already exist, it is created from the application's model.
- (NSManagedObjectModel *)managedObjectModel
{
    if (_managedObjectModel != nil) {
        return _managedObjectModel;
    }
    NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyBudget" withExtension:@"momd"];
    _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
    return _managedObjectModel;
}

// Returns the persistent store coordinator for the application.
// If the coordinator doesn't already exist, it is created and the application's store added to it.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
    if (_persistentStoreCoordinator != nil) {
        return _persistentStoreCoordinator;
    }
    
    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"MyBudget.sqlite"];
    
    NSError *error = nil;
    _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
    if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
        /*
         Replace this implementation with code to handle the error appropriately.
         
         abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 
         
         Typical reasons for an error here include:
         * The persistent store is not accessible;
         * The schema for the persistent store is incompatible with current managed object model.
         Check the error message to determine what the actual problem was.
         
         
         If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
         
         If you encounter schema incompatibility errors during development, you can reduce their frequency by:
         * Simply deleting the existing store:
         [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
         
         * Performing automatic lightweight migration by passing the following dictionary as the options parameter:
         @{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}
         
         Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
         
         */
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }    
    
    return _persistentStoreCoordinator;
}

#pragma mark - Application's Documents directory

// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

@end



Monday, 23 September 2013

Frequently asking HR interview questions for experienced persons in software field

1. What makes you interested in this job?

If you can’t add any value to the company, the interviewer will not be very interested in knowing how this job can offer you a career progression and how much you enjoy taking up new challenges. The best way is to keep the focus of your answer on how your skills, experience and personal qualities fit into the requirements of this particular position.




2. Why do you think should we take you for this job?
Analyse the requirements of the job profile well before you go for the interview. Relate your skills, experience and qualification with the and these are reasons why they should consider you for this position.
If there are any new things that you are expected to perform in the new job you can say that every new job needs a person to do something new and you have an ability to grasp new things quickly. Back this up with an example from your last job.


3. What is the motivating factor for you at work?
You can say that competition and new challenges motivate you at work.


4. Why do you want to leave your present job?
The reasons for switching the job could be numerous. The best answer to offer for this question is to say, “for better prospects”.
Now they can ask you another question, what do you mean by better prospects? To this you can say, better prospects in terms of experience, and exposure.
If you have been made redundant, put your words across very carefully. Your wrong words can give an impression that only you were the one whose position was made redundant, which hardly might be the case.
May be you can say something like, “Over last 8 months a lot of restructuring was going on in the company and 40 positions became surplus. One of them was mine but I have learnt a lot during my tenure at XYZ company and I am sure I can add a lot of value to a position like the one we are discussing about”.   



5. What is your greatest achievement?
Find an answer to this question from the recent past and focus on the qualities that were required to achieve it.


6. What qualities would you look for, if you were recruiting someone for this position?
The purpose of this question is to estimate your understanding of the position. Make sure that you have analysed the requirements of the role before appearing for the interview. Focus your answer on the skills, personal qualities and experience you would seek in a person for this position.



7. You seem to be working with the same company since a long time. - Why?
Staying with the same company for too long may be considered as lack of ambition in the candidate.
You can put this negative thought to rest by telling the interviewer how you were adding value to yourself being in the same company. Discuss some different kinds of assignments you handled and their importance to the company.




8. You seem to have switched many jobs-why?
Too much job hopping gives an impression that the candidate is unstable and unreliable. If you have switched jobs very often you can say that you did it to broaden your experience.




9. You do not have all the experience we are seeking for this position.
The answer to this question lies in your analysis of the requirements for this role. If you have most of the qualities required for the role, you can highlight that and say that you understand every new job needs a person to learn new things and you are pretty capable to picking up new things quickly.Back this up with an example about the new things you learnt at your last job.



10. How did you manage to attend this interview during your working hours?
Interviewer knows that you won’t ask for a permission in office to attend the interview. You can say that you took an off  from  the office to attend this interview.