Tuesday, October 25, 2011

custom camera overlay :)

-(void)viewDidLoad{
self.overlayView = [[UIView alloc] init];
    self.overlayView.frame = CGRectMake(0, 0, 320, 480);
   
   
    NSMutableArray *toolButtons = [NSMutableArray arrayWithCapacity:8];
   
    UIBarButtonItem *btn;
   
       
    UIImage *photogallaryBtnImg = [UIImage imageNamed:@"photo-gallery.png"];
    UIBarButtonItem * photogallaryBtn = [[UIBarButtonItem alloc] initWithImage:photogallaryBtnImg style:UIBarButtonItemStylePlain target:self action:@selector(grabImage:)];
    [toolButtons addObject:photogallaryBtn];
    [photogallaryBtn release];
   
    btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    [toolButtons addObject:btn];
    [btn release];
   
   
    UIImage *cameraBtnImg = [UIImage imageNamed:@"camera.png"];
    UIBarButtonItem *cameraBtn = [[UIBarButtonItem alloc] initWithImage:cameraBtnImg style:UIBarButtonItemStylePlain target:self action:@selector(camera:)];
    [toolButtons addObject:cameraBtn];
    [cameraBtn release];
   
    btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    [toolButtons addObject:btn];
    [btn release];
   
    UIImage *flashImg = [UIImage imageNamed:@"flashlight.png"];
    UIBarButtonItem *flashBtn = [[UIBarButtonItem alloc] initWithImage:flashImg style:UIBarButtonItemStylePlain target:self action:@selector(flashLightBtnPressed:)];
    [toolButtons addObject:flashBtn];
    [flashBtn release];
   
    btn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    [toolButtons addObject:btn];
    [btn release];
   
    UIImage *crossImg = [UIImage imageNamed:@"camera-cancel.png"];
    UIBarButtonItem *crossBtn = [[UIBarButtonItem alloc] initWithImage:crossImg style:UIBarButtonItemStylePlain target:self action:@selector(crossBtnClicked:)];
    [toolButtons addObject:crossBtn];
    [crossBtn release];
   
   
    toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0,415, 320, 44)];
    toolBar.items = toolButtons;
    NSLog(@"toolBar.items ...%d",[toolBar.items count]);
    toolBar.barStyle = UIBarStyleDefault;
    [self.overlayView addSubview:toolBar];
    [toolBar release];
   
    UIImageView *footimage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"foot.png"]];
    footimage.frame = CGRectMake(80,0,138 ,333);
   
    [footimage setContentMode:UIViewContentModeScaleToFill];
    footimage.backgroundColor = [UIColor clearColor];
    [self.overlayView addSubview:footimage];
   
    [self performSelector:@selector(takePhoto:) withObject:nil afterDelay:0.1];

}

- (void)takePhoto:(id)sender {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    self.imgPicker = [[UIImagePickerController alloc] init];
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;       
    self.imgPicker.showsCameraControls = NO;
    self.imgPicker.cameraOverlayView = self.overlayView;
    [self presentModalViewController:self.imgPicker animated:YES];
   
    NSLog(@"camera opnnn....");
   
   
}
- (void)camera:(id)sender{
    [self.imgPicker takePicture];
    self.imgPicker.delegate = self;

    NSLog(@"cameraf opnnn....");
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
    image.image = img;   
    NSLog(@"delegate camera");
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

- (IBAction)crossBtnClicked:(id)sender{
    NSLog(@"crossbtn");
    [[self.imgPicker parentViewController] dismissModalViewControllerAnimated:YES];
    [self.tabBarController setSelectedIndex:3];

}
- (IBAction)grabImage:(id)sender  {
    NSLog(@"grabImage");
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    self.imgPicker.delegate = self;       
    [self presentModalViewController:self.imgPicker animated:YES];
}
- (IBAction)flashLightBtnPressed:(id)sender
{
    if (self.imgPicker.cameraFlashMode == UIImagePickerControllerCameraFlashModeOff) {
        [self.imgPicker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];
    }else {
        [self.imgPicker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOff];

    }

}




Wednesday, October 19, 2011

How to create free account on itune....:)

Select a free app to download.  A simple way to do this is to scroll down to the Top Free Apps box on the right side, hover your mouse over the first item, and click on the Free button that appears when you hover over it.
sshot-621
A popup will open asking you to sign in with your Apple ID.  Click “Create New Account”.
sshot-622
Click Continue to create your account.
sshot-623
Check the box to accept the Store Terms and Conditions, and click Continue.
sshot-624
Enter your email address, password, security question, and date of birth, and uncheck the boxes to get email if you don’t want it…then click Continue.
sshot-2010-03-18-[20-42-52]
Now, you will be asked to provide a payment method.  Notice now that the last option says None!  Click that bullet option…
sshot-626
Then enter your billing address.  Simply enter your normal billing address, even though you are not entering a payment method.  Click Continue and your account will be created!
sshot-627
If you get the Address Verification screen just verify your county and click Done.
sshot-2010-03-18-[20-47-26]
An email will be sent to you to verify your account…
sshot-2010-03-18-[20-48-33]
Click on the link in your email to verify your account, iTunes will launch and you’re prompted to enter in the Apple ID and Password you just created.
sshot-2010-03-18-[20-55-24]
Your account is successfully created!
sshot-2010-03-18-[20-56-17]

Tips & Tricks: Installing an iPhone or iPad App with Provisioning Profile

To install an iPhone or iPad application on a limited number of devices, use the method of distribution called “Ad hoc”.


uses iTunes. First connect your iPhone to the computer. When your iPhone it detected by iTunes, click and go to the “Summary” tab.

iphone app development - itunes 1

Then click on “Serial Number”. The field will change to “Login (UDID)”.

iphone app development - itunes 2

You just have to copy the UDID “ + c” in mac or “Ctrl + c” under Windows. Now you can copy it to your e-mail.

Once you have communicated your UDID, just continue with the last two Ad Hoc distribution steps.

STEP 2 – The application is compiled and signed with the distribution profile. It is in this profile that devices authorized to the run application are listed.

STEP 3 - Deploying the application on your device.

Let’s now focus on this last step, where two files are needed:

  • A compressed file containing the provisioning profile (valid for a limited time).

  • A compressed file containing the application.

These two files (once unzipped) should be dragged on the iTunes icon:

iphone app development - itunes 3

Note: iTunes may ask you to replace the existing application or profile.

Once copied, you simply synchronize your device. Please note that a newly installed application will be displayed on the first application screen in on the first available spot, and not on the last application page.