Pages

Subscribe:

Ads 468x60px

Featured Posts

Thursday, 19 April 2012

How To change the Tabbaritem Images dynamically In Iphone App






 Plz use above images.

 And u need to create three classes
tabbar.h
tabbar.m
tabbar.xib




//  tabbars.h
#import <UIKit/UIKit.h>
@interface tabbars : UIViewController <UITabBarControllerDelegate, UITabBarDelegate, UINavigationControllerDelegate>
{    UITabBarController        *mytabBarController;
    UITabBar                *tabBar;
    NSArray                    *tabBarConfig;   
}
- (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur;
@end





//  tabbars.m
//
//  Created by Deepak Singh Rawat
//

#import "tabbars.h"
// classe i used to call on tab
#import "CallViewController.h"
#import "ContactViewController.h"
#import "RecordViewController.h"
#import "SettingViewController.h"
#import "AboutViewController.h"
// create and import classes according to your classes
@interface UITabBarItem (Private)
@property(retain, nonatomic) UIImage *selectedImage;
- (void)_updateView;
@end
@implementation UITabBar (ColorExtensions)
- (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur
{
    CGColorRef cgColor = [color CGColor];
    CGColorRef cgShadowColor = [shadowColor CGColor];
    for (UITabBarItem *item in [self items])
        if ([item respondsToSelector:@selector(selectedImage)] &&
            [item respondsToSelector:@selector(setSelectedImage:)] &&
            [item respondsToSelector:@selector(_updateView)])
        {
            CGRect contextRect;
            contextRect.origin.x = 0.0f;
            contextRect.origin.y = 0.0f;
            contextRect.size = [[item selectedImage] size];
            // Retrieve source image and begin image context
            UIImage *itemImage = [item image];
            CGSize itemImageSize = [itemImage size];
            CGPoint itemImagePosition;
            itemImagePosition.x = ceilf((contextRect.size.width - itemImageSize.width) / 2);
            itemImagePosition.y = ceilf((contextRect.size.height - itemImageSize.height) / 2);
            UIGraphicsBeginImageContext(contextRect.size);
            CGContextRef c = UIGraphicsGetCurrentContext();
            // Setup shadow
            CGContextSetShadowWithColor(c, shadowOffset, shadowBlur, cgShadowColor);
           
            // Setup transparency layer and clip to mask
            CGContextBeginTransparencyLayer(c, NULL);
            CGContextScaleCTM(c, 1.0, -1.0);
            CGContextClipToMask(c, CGRectMake(itemImagePosition.x, -itemImagePosition.y, itemImageSize.width, -itemImageSize.height), [itemImage CGImage]);
           
            //Setup the gradient...   
            //CGFloat components[8] = {0.0,0.4,1.0,0.2,0.0,0.6,1.0,1.0};
            //CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 
            //CGGradientRef colorGradient = CGGradientCreateWithColorComponents(colorSpace, components, NULL, 2);
            //CGContextDrawLinearGradient(c, colorGradient,CGPointZero,CGPointMake(0,contextRect.size.height),0);
            // Fill and end the transparency layer
            CGContextSetFillColorWithColor(c, cgColor);
            contextRect.size.height = -contextRect.size.height;
            CGContextFillRect(c, contextRect);
            CGContextEndTransparencyLayer(c);
            // Set selected image and end context
            [item setSelectedImage:UIGraphicsGetImageFromCurrentImageContext()];
            UIGraphicsEndImageContext();
            // Update the view
            [item _updateView];
        }
}
@end
@implementation tabbars
// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {   
    mytabBarController = [[UITabBarController alloc] init];
    mytabBarController.delegate = self;
    NSMutableArray *controllerArray = [[[NSMutableArray alloc] initWithCapacity:[tabBarConfig count]] autorelease];
    CallViewController *aboutUsController = [[CallViewController alloc] init];
    aboutUsController.title = @"Call";
    //aboutUsController.tabBarItem.title = @"hhhhh";
    aboutUsController.tabBarItem.image = [UIImage imageNamed:@"ic1-blue.png"];
    UINavigationController *abtUsNavController = [[[UINavigationController alloc] initWithRootViewController:aboutUsController] autorelease];
    aboutUsController.navigationController.navigationBar.hidden=YES;
    [controllerArray addObject:abtUsNavController];
    [aboutUsController release];
    ContactViewController *contactUsController = [[ContactViewController alloc] init];
    contactUsController.title = @"Contact";
    //contactUsController.tabBarItem.title  = @"";
    contactUsController.tabBarItem.image = [UIImage imageNamed:@"ic2-blue.png"];
    UINavigationController *cntctUsNavController = [[[UINavigationController alloc] initWithRootViewController:contactUsController] autorelease];
    contactUsController.navigationController.navigationBar.hidden=YES;
    [controllerArray addObject:cntctUsNavController];
    [cntctUsNavController release];
    RecordViewController *homeController1 = [[RecordViewController alloc] init];
    homeController1.title = @"Record";
    //homeController.tabBarItem.title = @"Home";
    homeController1.tabBarItem.image = [UIImage imageNamed:@"ic3-blue.png"];
    UINavigationController *homeNavController1 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
    homeController1.navigationController.navigationBar.hidden=YES;
    [controllerArray addObject:homeNavController1];
    [homeController1 release];
    //added here
    SettingViewController *homeController2 = [[SettingViewController alloc] init];
    homeController2.title = @"Setting";
    //homeController.tabBarItem.title = @"Home";
    homeController2.tabBarItem.image = [UIImage imageNamed:@"ic4-blue.png"];
    UINavigationController *homeNavController2 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
    homeController2.navigationController.navigationBar.hidden=YES;
    [controllerArray addObject:homeController2];
    [homeController2 release];
    AboutViewController *homeController3 = [[AboutViewController alloc] init];
    homeController3.title = @"About";
    //homeController.tabBarItem.title = @"Home";
    homeController3.tabBarItem.image = [UIImage imageNamed:@"ic5-blue.png"];
    UINavigationController *homeNavController3 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
    homeController3.navigationController.navigationBar.hidden=YES;
    [controllerArray addObject:homeController3];
    [homeController3 release];
    //added here
    mytabBarController.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    mytabBarController.moreNavigationController.delegate = self;
    mytabBarController.delegate = self;
    mytabBarController.viewControllers = controllerArray;
    mytabBarController.hidesBottomBarWhenPushed = YES;
    mytabBarController.customizableViewControllers = controllerArray;
    //mytabBarController.view.backgroundColor = [UIColor redColor];
    [[mytabBarController tabBar] recolorItemsWithColor:[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"12.png"]] shadowColor:[UIColor clearColor] shadowOffset:CGSizeMake(0.0f, -1.0f) shadowBlur:3.0f];
    [self.navigationController pushViewController:mytabBarController animated:NO];
    [self.navigationController setNavigationBarHidden:YES];
    [super viewDidLoad];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning]; 
    // Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}
- (void)dealloc {
    [super dealloc];
}
@end

Here its the output screen pic

Thursday, 5 April 2012

Installing an Ad Hoc Distribution

Installing an Ad Hoc Distribution


What is Ad Hoc Distribution?

Ad Hoc Distribution allows you to try an application before it’s available in the iTunes App Store. This is how we distribute iPhone applications to beta customers.

These instructions assume you have a .zip file. 

 What You’ll Need

Before beginning the installation process you’ll need:

The .zip file for the application (usually AppName.app.AdHoc.zip)
The .mobileprovision file for the application (usually Ad_Hoc_Distribution_Profile.mobileprovision)
Your Device: the iPhone or iPod Touch whose UDID you emailed us previously.
The computer you normally sync with your Device
We usually send the .zip and .mobileprovision files to you via email.

Installing the Application - Windows XP

If you have the .zip and .mobileprovision files in an email, save them to a convenient location, such as your Desktop.
Drag-and-drop the .mobileprovision file onto Library → Applications in iTunes. On the Mac, you can just drag it to the iTunes icon in your dock.
Extract the .zip file. To do this, right-click the .zip file and select Extract All… . Step through the wizard and accept the defaults by clicking Next.
WINDOWS VISTA USERS: The built-in “Extract All…” command corrupts the application so that it cannot be installed. You should try using a different zip program like WinZip or WinRar to extract the Zip file. Better yet, ask the application developer to send you the application as a .ipa file instead of a .zip file, then you don’t have to unzip it.
Find the .app folder (usually AppName.app).
Drag-and-drop the whole .app folder onto Library → Applications in iTunes. On the Mac, you can just drag it onto the iTunes icon in the dock.
Verify that the application shows up in Library → Applications. Note that it will not have its normal icon.
In iTunes, select your Device under Devices, choose the Application tab, and make sure that the new application is checked.
Sync your Device and try out the new app!

Friday, 2 March 2012

How to customize imagepicker frame?

How to customize imagepicker frame?
in CustompickerViewController.h file // file where you want to add image picker @interface CustompickerViewController :UIViewController { //custom picker IBOutlet UIView *custompicker; } -(IBAction)custompickerBTNaction; @property(nonatomic,retain)IBOutlet UIView *custompicker; @end in CustompickerViewController.m file // -(IBAction)custompickerBTNaction { if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { UIImagePickerController *picker= [[UIImagePickerController alloc]init]; CGRect frame =CGRectMake(0,0 , 320, 480); frame.origin.y = 200; frame.size.height = 500; picker.view.frame = frame; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated:YES]; [picker release]; } } -(void) navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { CGRect frame1 =CGRectMake(0,0 , 320, 20); navigationController.view.frame=frame1; CGRect frame = [[navigationController view] frame]; frame.size.height = 400; [[navigationController view] setFrame:frame]; // Add button here } -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo { imageView.image = image; [picker dismissModalViewControllerAnimated:YES]; custompicker.frame = CGRectMake(0,0 , 320, 400); } -(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker { [picker dismissModalViewControllerAnimated:YES]; custompicker.frame = CGRectMake(0,0 , 320, 400); } in xib file connect File manger with custompicker frame

Sunday, 5 February 2012

Sample for textfield clear while tying or placeholder use in Textfield








if we want, it would clear automatic then place "enter email in place holder through xib.
Now Check…
wow..
its works…

Thursday, 2 February 2012

cant open .xib file in xcode









Problem in opening Xib while installing xcode in my macbook..

answer unsolved…..

check the way u can do that......


its works fine
but problem in opening sib??
lets check
now set for iphone..
its works fine….

but what if it don't work???


lets do this...





just open

create a sample apps using Xcode.
while you are trying to open its Xib…if its don't open then
do this steps….

OPEN FINDER:-

Macintosh HD-> Developer-> Application->interface builder…

once you open it


then close it
now open iterfacebuilder again..
from the dock..

go to file menu then open

your xcode project xib file with it…

once it open

it will work fine for all project…

means now you can easily open your xib in projects too..



Wednesday, 28 December 2011

How to add TAB BAR using objective C code





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


@interface TabBarViewController : UIViewController  <UITabBarControllerDelegate, UITabBarDelegate, UINavigationControllerDelegate>  {
   
    UITabBarController        *mytabBarController;
    UITabBar                *tabBar;
    NSArray                    *tabBarConfig;

}

@end








-------------------------------------

#import "TabBarViewController.h"


@implementation TabBarViewController

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/

- (id)init {
   
    if (self = [super init]) {
       
    }
   
    return self;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
       
    mytabBarController = [[UITabBarController alloc] init];
    mytabBarController.delegate = self;
   
    NSMutableArray *controllerArray = [[[NSMutableArray alloc] initWithCapacity:[tabBarConfig count]] autorelease];
   
    HomeViewController *homeController = [[HomeViewController alloc] init];
    homeController.title = @"Home";
     homeController.tabBarItem.image = [UIImage imageNamed:@"homeicon.png"];


    UINavigationController *homeNavController = [[[UINavigationController alloc] initWithRootViewController:homeController] autorelease];
    [controllerArray addObject:homeNavController];
    [homeController release];
   
//AboutUsViewController is a class where the tab jumps.

    AboutUsViewController *aboutUsController = [[AboutUsViewController alloc] init];
    aboutUsController.title = @"About Us";
     aboutUsController.tabBarItem.image = [UIImage imageNamed:@"aboutusicon.png"];

    UINavigationController *abtUsNavController = [[[UINavigationController alloc] initWithRootViewController:aboutUsController] autorelease];
    [controllerArray addObject:abtUsNavController];
    [aboutUsController release];
   

//ContectUsViewController is a class where the tab jumps on click contact us tab

    ContactUsViewController *contactUsController = [[ContactUsViewController alloc] init];
    contactUsController.title = @"Contact Us";
     contactUsController.tabBarItem.image = [UIImage imageNamed:@"contactusicon.png"];
    UINavigationController *cntctUsNavController = [[[UINavigationController alloc] initWithRootViewController:contactUsController] autorelease];
    [controllerArray addObject:cntctUsNavController];
    [cntctUsNavController release];
   
    mytabBarController.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    mytabBarController.moreNavigationController.delegate = self;
    mytabBarController.delegate = self;
   
    mytabBarController.viewControllers = controllerArray;
    mytabBarController.hidesBottomBarWhenPushed = YES;
    mytabBarController.customizableViewControllers = controllerArray;
   
    [self.navigationController pushViewController:mytabBarController animated:YES];
    [self.navigationController setNavigationBarHidden:YES];
   
    [super viewDidLoad];

   
   
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
   
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end


Monday, 26 December 2011

Tutorial to add image in alertView Box Button?




-(IBAction)showAboutBoxWithImage {
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"AlertView"
                          message:@"\n"
                          @"\n"
                          @"\n"
                          @"\n"
                          @"\n"
                          @"Created by: \n"
                          @"Deepak Singh Rawat \n"
                          @"http://anscacorona.blogspot.com"
                          delegate:nil
                          cancelButtonTitle:@"Ok"
                          otherButtonTitles:nil];
    UIImageView *logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Icon.png"]];//add Icon.png
    logo.contentMode = UIViewContentModeScaleToFill;
    logo.frame = CGRectMake(90, 40, 100, 120);
    [alert addSubview:logo];
    [logo release];
   
    [alert show];
    [alert release];    
   
}
 

Cross-platform Mobile App Development Showcase

Get Carbon Positive With Ixpo