Tuesday, February 26, 2013

how to change Xcode Project name in Xcode 4


For Xcode 4 or later:
  • Open a project
  • Select Project Navigator
  • Highlight project name
  • Single click on project name
    enter image description here

Friday, February 22, 2013

iTellAFriend Feature IOS



What is iTellAFriend?

iTellAFriend is an iOS toolkit for displaying a preconfigued mail composer with a "Tell a Friend" template in ios apps.

Installation

To install iTellAFriend into your app, drag the iTellAFriend.h, .m into your project.
To enable iTellAFriend in your application you need to initialize iTellAFriend before the app has finished launching. The easiest way to do this is to add the iTellAFriend configuration code in your AppDelegate's, like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

  [iTellAFriend sharedInstance].appStoreID = 408981381;

  return YES;
}
To present the iTellAFriend controller, use:
if ([[iTellAFriend sharedInstance] canTellAFriend]) {
  UINavigationController* tellAFriendController = [[iTellAFriend sharedInstance] tellAFriendController];
  [self presentModalViewController:tellAFriendController animated:YES];
}

 
 


Source From :- http://buysourcecode.info/?m=201205

Get Random Number between any two numbers


int RandomNumber = (arc4random()%(toNumber-fromNumber+1))+fromNumber;


Get Random Number from range (Like  50-100)...

Wednesday, January 23, 2013

LocalNotifications in iPhone



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [NSThread detachNewThreadSelector:@selector(fireLocalNotifications) toTarget:self withObject:nil];
 
}

-(void) fireLocalNotifications
{

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    for (int i = 0; i < 60; i++)
    {

        UILocalNotification *localNotification = [[UILocalNotification alloc] init];

        if (localNotification == nil){

            return;
}

        NSDate *notifyDate = [[NSDate date] dateByAddingTimeInterval:i * 60];

        localNotification.fireDate = notifyDate     
     
        localNotification.timeZone = [NSTimeZone defaultTimeZone];

        localNotification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"This is local notification %i"), i];

        localNotification f.alertAction = NSLocalizedString(@"My Details", nil);

        localNotification.soundName = UILocalNotificationDefaultSoundName;

        localNotification.applicationIconBadgeNumber = 1;

        [[UIApplication sharedApplication] scheduleLocalNotification: localNotification];
       
        [localNotification release];

    }

    [pool release];
}

Wednesday, January 16, 2013

moving Image in UIView using UIPanGesture


- (void)viewDidLoad{

    YOURIMAGEVIEW = [[UIImageView alloc]initWithFrame:CGRectMake(130350100100)];
    YOURIMAGEVIEW.image = [UIImage imageNamed:@"image.png"];
    [self.view addSubview: YOURIMAGEVIEW];
    YOURIMAGEVIEW.userInteractionEnabled = YES;
    [self.view bringSubviewToFront: YOURIMAGEVIEW];
  
    panRecognizer = [[UIPanGestureRecognizer allocinitWithTarget:self action:@selector(handlePanFrom:)];
    [panRecognizer setMinimumNumberOfTouches:1];
    [panRecognizer setMaximumNumberOfTouches:1];
    [panRecognizer setDelegate:self];
    [self. YOURIMAGEVIEW addGestureRecognizer:panRecognizer];    

}


- (void)handlePanFrom:(UIPanGestureRecognizer*)recognizer {
    
    CGPoint translation = [recognizer translationInView:recognizer.view];
    CGPoint velocity = [recognizer velocityInView:recognizer.view];
    
    if (recognizer.state == UIGestureRecognizerStateBegan) {
    } else if (recognizer.state == UIGestureRecognizerStateChanged) {
      
    } else if (recognizer.state == UIGestureRecognizerStateEnded) {
       // <animate to final position>
        [UIView animateWithDuration:2.0 delay:0  options:UIViewAnimationOptionCurveEaseOut   animations:^ { self.YOURIMAGEVIEW.center = CGPointMake(velocity.x, velocity.y);} completion:NULL];

    }
}
}

Thursday, December 13, 2012

Write contents of array to a text file in Document Directory iPhone


NSString *stringToWrite=[[NSString alloc]init];
    
    for (int i=0; i<[arrayToReloadRightTableData count]; i++)
        
    {
        stringToWrite=[stringToWrite stringByAppendingString:[NSString stringWithFormat:@"%@ ",[arrayToReloadRightTableData objectAtIndex:i]]];
        
    }
    
    [stringToWrite writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
    

Tuesday, December 11, 2012

default first row on the tableview selected


  [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone];