Friday, 3 August 2012

urldemo 14

//splitviewcontroller with MultipleDetailViews + iphone

https://github.com/grgcombs/IntelligentSplitViewController
https://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html

//For adding the done and cancel button toolbar on textfield keyboard in iPhone
- (void)viewDidLoad
{
    [super viewDidLoad];

    UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
    numberToolbar.barStyle = UIBarStyleBlackTranslucent;
    numberToolbar.items = [NSArray arrayWithObjects:
                         [[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelNumberPad)],
                         [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
                         [[UIBarButtonItem alloc]initWithTitle:@"Apply" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)],
                     nil];
    [numberToolbar sizeToFit];
    numberTextField.inputAccessoryView = numberToolbar;
}

-(void)cancelNumberPad{
    [numberTextField resignFirstResponder];
    numberTextField.text = @"";
}

-(void)doneWithNumberPad{
    NSString *numberFromTheKeyboard = numberTextField.text;
    [numberTextField resignFirstResponder];
}


//For  asynchronous image loading in iPad and iPhone
https://github.com/brendanlim/SDWebImage

//For making the wireframe or design of iPad and iPhone template
http://mockupbuilder.com/
http://www.axure.com
http://iphoneized.com/

//For the customizing the Tabbar image
http://ios-blog.co.uk/articles/tutorials/how-to-customize-the-tab-bar-using-ios-5-appearance-api/
 UIImage* tabBarBackground = [UIImage imageNamed:@"bottom_bar_bg.png"];
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
   
    //[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selection-tab.png"]];
   
  
    UITabBarItem *filterTab = [self.tabBarController.tabBar.items objectAtIndex:0];
    [filterTab setFinishedSelectedImage:[UIImage imageNamed:@"fav_icon_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"fav_icon"]];
   
    filterTab = [self.tabBarController.tabBar.items objectAtIndex:1];
    [filterTab setFinishedSelectedImage:[UIImage imageNamed:@"exp_icon_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"exp_icon"]];
   
    filterTab = [self.tabBarController.tabBar.items objectAtIndex:2];
    [filterTab setFinishedSelectedImage:[UIImage imageNamed:@"user_icon_selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"user_icon"]];


//For animating text into iPhone

 -(void)animateTextLayer {
   
    CGFloat animationDuration = 5;
   
    CATextLayer *textLayer = [CATextLayer layer];
    [textLayer setString:@"Hello World"];
    [textLayer setForegroundColor:[UIColor purpleColor].CGColor];
    [textLayer setFontSize:30];
    [textLayer setFrame:CGRectMake(20, 200, 300, 40)];
    [[self.view layer] addSublayer:textLayer];
   
    CABasicAnimation *colorAnimation = [CABasicAnimation
                                        animationWithKeyPath:@"foregroundColor"];
    colorAnimation.duration = animationDuration;
    colorAnimation.fillMode = kCAFillModeForwards;
    colorAnimation.removedOnCompletion = NO;
    colorAnimation.fromValue = (id)[UIColor purpleColor].CGColor;
    colorAnimation.toValue = (id)[UIColor greenColor].CGColor;
    colorAnimation.timingFunction = [CAMediaTimingFunction
                                     functionWithName:kCAMediaTimingFunctionLinear];
   
    CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation
                                           animationWithKeyPath:@"transform"];
    NSArray *scaleValues = [NSArray arrayWithObjects:
                            [NSValue valueWithCATransform3D:CATransform3DScale(textLayer.transform, 1, 1, 1)],
                            [NSValue valueWithCATransform3D:CATransform3DScale(textLayer.transform, 1.5, 1.5, 1)],
                            [NSValue valueWithCATransform3D:CATransform3DScale(textLayer.transform, 0.5, 0.5, 1)], nil];
    [scaleAnimation setValues:scaleValues];
    scaleAnimation.fillMode = kCAFillModeForwards;
    scaleAnimation.removedOnCompletion = NO;
   
    CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
    animationGroup.duration = animationDuration;
    animationGroup.timingFunction = [CAMediaTimingFunction
                                     functionWithName:kCAMediaTimingFunctionLinear];
    animationGroup.fillMode = kCAFillModeForwards;
    animationGroup.removedOnCompletion = NO;
    animationGroup.animations =
    [NSArray arrayWithObjects:colorAnimation, scaleAnimation, nil];
   
    [textLayer addAnimation:animationGroup forKey:@"animateColorAndScale"];
}