Monday, 31 December 2012

Parsing the json objects in iphone

//
//  ServiceProxyBase.h


#import <Foundation/Foundation.h>

#define kErrorMessage @"ErrorMessage"
#define kResponseValue @"ResponseValue"
#define kResult @"Result"

@interface ServiceProxyBase : NSObject
{
@protected
    NSString *baseUrlString;
    NSString *serviceUrlName;
}

+ (id)proxy;

- (id)init;

- (BOOL)isValidResult:(NSDictionary *)json;

- (NSArray *)executeServiceWithName:(NSString const *)serviceName parameters:(NSArray *)params;

- (NSArray *)extractResults:(NSData *)jsonData;

@end



//  ServiceProxyBase.m



#import "ServiceProxyBase.h"
#import "NSString+Helpers.h"
#import "Logger.h"
#import "Constants.h"


@implementation ServiceProxyBase

+ (id)proxy
{
    return nil;
}

- (id)init
{
    self = [super init];

    if (self)
    {
        baseUrlString = [[NSUserDefaults standardUserDefaults] objectForKey:BaseUrlKey];
    }

    return self;
}

- (NSURL *)constructUrlForFunctionWithName:(const NSString *)functionName andParameters:(NSArray *)params
{
    if ([baseUrlString isEmpty] || [functionName isEmpty])
    {
        NSLog(NSLocalizedString(@"ErrorBaseUrlMissing", @"Missing component(s) to construct url"));
        return nil;
    }

    if (![baseUrlString hasSuffix:@"/"])
        baseUrlString = [baseUrlString stringByAppendingString:@"/"];

    if (![serviceUrlName hasSuffix:@"/"])
        serviceUrlName = [serviceUrlName stringByAppendingString:@"/"];

    NSMutableString *paramString = nil;
    if (params && params.count > 0)
    {
        paramString = [NSMutableString string];
        for (NSString *value in params)
        {
            [paramString appendFormat:@"/%@", value];
        }
        paramString = [NSMutableString stringWithString:[paramString substringToIndex:paramString.length]];
    }

    NSMutableString *urlString =
            [NSMutableString stringWithFormat:@"%@%@%@%@", baseUrlString, serviceUrlName, functionName,
                                              paramString ? paramString : @""];

    return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}

- (BOOL)isValidResult:(NSDictionary *)json
{
    return [[json objectForKey:kErrorMessage] isKindOfClass:[NSNull class]];
}

- (NSArray *)executeServiceWithName:(NSString const *)serviceName parameters:(NSArray *)params
{
    NSURL *url = [self constructUrlForFunctionWithName:serviceName
                                         andParameters:params];

    NSLog(@"executing url %@", url.absoluteString);
    NSURLRequest *request = [NSURLRequest requestWithURL:url
                                             cachePolicy:NSURLRequestReloadIgnoringCacheData
                                         timeoutInterval:15];
    NSURLResponse *response;
    NSError *error;
    NSData *data = [NSURLConnection sendSynchronousRequest:request
                                         returningResponse:&response
                                                     error:&error];

    if (error)
    {
        [Logger logMessage:error.localizedDescription ofType:LogMessageTypeError];
        return nil;
    }

    if (!data)
    {
        NSString *message =
                [NSString stringWithFormat:@"No data is returned for url %@", url];
        [Logger logMessage:message ofType:LogMessageTypeError];
        return nil;
    }

    return [self extractResults:data];
}

- (NSArray *)extractResults:(NSData *)jsonData
{
    NSError *error;
    NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData
                                                               options:NSJSONReadingAllowFragments
                                                                 error:&error];

    if (error)
    {
        NSDictionary *userInfo = @{kResponseValue : [[NSString alloc] initWithData:jsonData
                                                                          encoding:NSUTF8StringEncoding]};
        [Logger logMessage:error.localizedDescription ofType:LogMessageTypeError additionalInfo:userInfo];
        return nil;
    }

    return [[jsonObject objectForKey:kResult] isKindOfClass:[NSNull class]] ? nil : [jsonObject objectForKey:kResult];
}

@end

//Logger.h
#import <Foundation/Foundation.h>

typedef enum
{
    LogMessageTypeInfo,
    LogMessageTypeWarn,
    LogMessageTypeError
} LogMessageType;

@interface Logger : NSObject

+ (void)logMessage:(NSString *)message ofType:(LogMessageType)type;

+ (void)logMessage:(NSString *)message ofType:(LogMessageType)type additionalInfo:(NSDictionary *)userInfo;

@end
//Logger.m

#import "Logger.h"


@implementation Logger
{

}

// TODO: expand this to service calls
+ (void)logMessage:(NSString *)message ofType:(LogMessageType)type
{
    NSString *typeString = [self stringFromMessageType:type];
    NSLog(@"%@: %@", typeString, message);
}

+ (void)logMessage:(NSString *)message ofType:(LogMessageType)type additionalInfo:(NSDictionary *)userInfo
{
    NSLog(@"%@: %@, additional information = <%@>", [self stringFromMessageType:type], message, userInfo);
}

#pragma mark - helper

+ (NSString *)stringFromMessageType:(LogMessageType)type
{
    NSString *typeString;
    switch (type)
    {
        case LogMessageTypeError:
            typeString = @"Error";
            break;
        case LogMessageTypeInfo:
            typeString = @"Info";
            break;
        case LogMessageTypeWarn:
            typeString = @"Warning";
            break;
    }
    return typeString;
}

@end

//NSString+Helpers.h
#import <Foundation/Foundation.h>

@interface NSString (Helpers)

- (BOOL)isEmpty;

+ (NSString *)stringFromBool:(BOOL)b;
@end

//NSString+Helpers.m
#import "NSString+Helpers.h"

@implementation NSString (Helpers)

- (BOOL)isEmpty
{
    return self.length == 0;
}

+ (NSString *)stringFromBool:(BOOL)b
{
    return b ? @"true" : @"false";
}

+ (NSString *)stringFromPaymentType:(PaymentType)type
{
    switch (type)
    {
        case PaymentTypeCash:
            return @"PaymentTypeCash";
        case PaymentTypeCard:
            return @"PaymentTypeCard";
    }

    return nil;
}
@end

//Constact.h
#define MainApp @"AppMain"
#define BaseUrlKey @"baseUrl"
#define Login @"Login"
#define LoggedIn @"LoggedIn"
#define StoreID @"1"


//Call the above service
 NSArray *result = [self executeServiceWithName:serviceName
                                        parameters:itemDetailArray];
    or

 dispatch_queue_t queue = dispatch_queue_create("au.com.estrado.productServices.SaveTransaction", NULL);
   
        NSMutableArray *transactionDetailsArray=[[NSMutableArray alloc] initWithArray:self.items];

    dispatch_async(queue, ^
    {
        //TODO: remove hard coding of customer and staff IDs
        //TODO: check the state of the execution, if it fails then do not clear the transaction
        NSLog(@"%@",transactionDetailsArray);
        [[ItemDataController dataController] processTransactionWithDetails:transactionDetailsArray
                                                         forCustomerWithId:1
                                                       servedByStaffWithId:2
                                                           withPaymentType:paymentType
                                                                  isRefund:isRefund];
    });

Thursday, 20 December 2012

Passbook example for the iPhone

http://blogs.captechconsulting.com/blog/jonathan-tang/ios-6-tutorial-integrating-passbook-your-applications
https://github.com/tschoffelen/PHP-PKPass
apps.tomttb.com/pkpass/full_sample/
www.raywenderlich.com/20734/beginning-passbook-part-1
www.raywenderlich.com/20785/beginning-passbook-in-ios-6-part-22
http://blogs.captechconsulting.com/blog/jonathan-tang/ios-6-tutorial-integrating-passbook-your-applications
https://github.com/tomasmcguinness/dotnet-passbook
https://www.passslot.com/developer/api/start
https://www.passslot.com/developer/api/start

Mapview streaching like foursquare iPhone app + Ios

http://www.cocoacontrols.com/platforms/ios/controls/a3parallaxscrollview

For creating the html apps for iPhone,android free

- http://publisher.mobileappwizard.com/design/10554
- appgenerator
-mobileappwizard

For display status message to the button of the iPhone

https://github.com/zacaltman/ZAActivityBar

Customized colorful alertview in iphone

https://github.com/m1entus/WCAlertView

Tetris game for iPhone in cocos2d

https://github.com/joshvera/iPhone-Tetris

Gemerate the web app free websites for iPhone, android etc…

http://www.appypie.com/
http://www.appgenerate.com/

Screen recorder & audio recorder for iPhone & iPad

http://www.subfurther.com/blog/category/avfoundation/

Side bar like the iOS Facebook apps in iPhone

http://bitly.com/bundles/o_27ukkruo5l/1


Reordering the collection view items positions in ios

https://github.com/lxcid/LXReorderableCollectionViewFlowLayout

Tuesday, 27 November 2012

Managing the repository or svn in iphone

code-and-coffee.blogspot.in/2012/06/xcode-source-code-management-with-git.html

Gridview + tableview in iphone and ipad

http://code4app.net/ios/MMGridView/4fb1ac376803fa5543000000
https://github.com/provideal/MMGridView

Camera fun with fire in iPhone

http://code4app.net/ios/Camera-Gun/4f8ecf2a06f6e7ee7b000001

Different types of controls in iPhone, iPad, iOS

http://code4app.net/ios/FTUtils/4fb9e32b6803fac606000000
http://www.theiphonedev.com/SourceCode/tabid/143/Default.aspx
http://iosmix.com/tags/twitter?page=1

Delete the apps like iPhone controls in iPhone

https://github.com/sarperdag/SESpringBoard

Detect the installed app in iphone

https://github.com/danielamitay/iHasApp

Sharing on facbook, twitter and email in iPhone

https://github.com/FuerteInternational/FTShare

For the distribution of app to any number of device without the app store approval

Enter price edition certificate was required.
http://www.foraker.com/ios-app-distribution-options/

Tuesday, 6 November 2012

remove the background color from search bar in iPhone

for (UIView *subview in [searchBar subviews]) {
    if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
    {
        [subview removeFromSuperview];
    }
}

for (UIView *subview in [searchBar subviews]) {
        NSLog(@"%@", [subview class]);
}

Customizing the search bar textfield in iPhone

http://caydenliew.com/2012/01/customize-uisearchbar-background-image/
for (UIView *subview in [searchBar subviews]) {
        if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
        {
            [d

        if ([subview isKindOfClass:NSClassFromString(@"UISearchBarTextField")]) {
            [(UITextField *)subview setBackground:[UIImage imageNamed:@"searchboxbg.png"]];
        }
    }

Changing the search bar textfield left search icon in iPhone

 UITextField *textfield=(UITextField*)[[searchBar subviews] objectAtIndex:0];
            UIImage *image = [UIImage imageNamed: @"searchbtn.png"];
            UIImageView *iView = [[UIImageView alloc] initWithImage:image];
            textfield.leftView=iView;

Checking device compatibilty comparision parameter in iphone

iPhone 1G
iPhone 3G
iPhone 3GS
iPhone 4
Verizon iPhone 4
iPhone 4S
iPad
iPad 2 (GSM)
iPad 2 (CDMA)
iPad-3G (4G)

Image color operation in iphone

https://github.com/tomsoft1/StackBluriOS
CIImage

Collection view in iOS 6 with Xcode 4.5 in iPhone

https://github.com/RomanN2/CollectionView

Starting to ending for the registering and issuing the certificate for the IOS program.

http://www.raywenderlich.com/8003/how-to-submit-your-app-to-apple-from-no-account-to-app-store-part-1

Not reloaded issue with the CellforTowAtIndexPath + tableview + iphone

http://blog.d-17.com/2009/10/combining-multiple-uitextfields-and-a-uitableview-in-a-nice-way-for-an-iphone-app-part-2/

https://github.com/breeno/EditingUITableView

Write down this statement to the cellforrowatindexPath method of tableview and it will work now.
NSString *CellIdentifier = [NSString stringWithFormat: @"Cell%i", indexPath.row];


Example......
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   
    NSString *CellIdentifier = [NSString stringWithFormat: @"Cell%i", indexPath.row];
   
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
        UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(140.0, 12.0,170.0, 25.0)];
        textField.borderStyle = UITextBorderStyleNone;
        //yes strange, but otherwise the textfield won't show up :(
        cell.textLabel.backgroundColor = [UIColor blackColor];
        textField.tag=indexPath.row;
        //textField.text = [NSString stringWithFormat:@"value %i", indexPath.row];
        textField.placeholder= [NSString stringWithFormat:@"value %i", indexPath.row];
        [textField setDelegate:self];       
        //[textField addTarget:self                       action:@selector(textFieldDone:)
        //    forControlEvents:UIControlEventEditingDidEndOnExit];
        [cell.contentView addSubview:textField];
        [textField release];
        cell.textLabel.text = [NSString stringWithFormat:@"Item %i", indexPath.row];//[questionsArray objectAtIndex:indexPath.row];
        textField.returnKeyType=UIReturnKeyNext;
        if (indexPath.row==6) {
            textField.returnKeyType=UIReturnKeyDone;
        }
    }   
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    return cell;// autorelease];
}
 

Directly open up the map from the running app in iPhone

NSString* address = @"118 Your Address., City, State, ZIPCODE";
NSString* currentLocation = @"Current Location";
NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%@",[currentLocation stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
   UIApplication *app = [UIApplication sharedApplication];
[app openURL: [NSURL URLWithString: url]];

Tuesday, 16 October 2012

Set the background color to the cclayer in cocos2d + iPhone

//write it inside the init method of cclayer
CCLayerColor* colorLayer = [CCLayerColor layerWithColor:ccc4(128, 0,0, 128)];
[self addChild:colorLayer z:0];

Moving the background image with ccsprite in cocos2d + iPhone

panorama = [CCSprite spriteWithFile: @"blue_drops_2-wallpaper-2048x1152.jpg"];
        panorama.position = ccp( 480/2 , 320/2 );
        [self addChild:panorama];
       
        appendix = [CCSprite spriteWithFile: @"xmas_0020.jpg"];
        appendix.position = ccp( 480/2-1, 320/2 );
        [self addChild:appendix];
       
        // schedule a repeating callback on every frame
        [self schedule:@selector(nextFrame:) interval:.5f];
- (void) nextFrame:(ccTime)dt {
    panorama.position = ccp(panorama.position.x - 100 * dt, panorama.position.y);
    appendix.position = ccp(appendix.position.x - 100 * dt, appendix.position.y);
    if (panorama.position.x < -1709/2) {
        panorama.position = ccp( 1709/2 , panorama.position.y );
        appendix.position = ccp( 1709+480/2-1, appendix.position.y );
    }
}

Scrollview with drag able grid view in iPhone

https://github.com/jaydee3/JDDroppableView

Load json data in lazy loading manner in iphone

- (void)loadDataSource {
    // Request
    NSString *URLPath = [NSString stringWithFormat:@"http://imgur.com/gallery.json"];
    NSURL *URL = [NSURL URLWithString:URLPath];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
   
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
       
        NSInteger responseCode = [(NSHTTPURLResponse *)response statusCode];
       
        if (!error && responseCode == 200) {
            id res = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            if (res && [res isKindOfClass:[NSDictionary class]]) {
                self.items = [res objectForKey:@"gallery"];
                [self dataSourceDidLoad];
            } else {
                [self dataSourceDidError];
            }
        } else {
            [self dataSourceDidError];
        }
    }];
}

Popover view in iPhone and iPad

https://github.com/runway20/PopoverView

different example for the cocoa2d in iPhone

http://www.supersuraccoon-cocos2d.com/2011/09/17/sticky-demo-resource-list-keep-updating/

Cocos2d calendar demo for iPhone

http://www.supersuraccoon-cocos2d.com/2011/06/05/simple-calendar-demo-cocos2d/

Space bubble game in iPhone

http://www.vellios.com/downloads/

Customising the tab bar before the iOS 5 in iPhone

UIImage *tabBackground = [UIImage imageNamed:@"tb1.png"];
self.tabBarController.tabBar.frame=CGRectMake(0,480,320,49);
    imgV=[[UIImageView alloc] initWithImage:tabBackground];
    imgV.frame=CGRectMake(0, 480, 320, 56);
    [self.tabBarController.view addSubview:imgV];
- (BOOL)tabBarController:(UITabBarController *)tabBarController1 shouldSelectViewController:(UIViewController *)viewController{
  switch (index) {
        case 0:
            self.imgV.image=[UIImage imageNamed:@"tb1.png"];
            break;
        case 1:
            self.imgV.image=[UIImage imageNamed:@"tb2.png"];
            break;
        case 2:
            self.imgV.image=[UIImage imageNamed:@"tb3.png"];
            break;
        case 3:
            self.imgV.image=[UIImage imageNamed:@"tb4.png"];
            break;
        case 4:
            self.imgV.image=[UIImage imageNamed:@"tb5.png"];
            break;
        default:
            break;
    }
    return YES;
}

http://stackoverflow.com/questions/1355480/preventing-a-uitabbar-from-applying-a-gradient-to-its-icon-images

Sending any object from anyplace to center in iPhone

[UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.0f];
        [UIView setAnimationCurve:UIUserInterfaceLayoutDirectionLeftToRight];
        [CATransaction setDisableActions:FALSE];
        tempImg.layer.position = self.view.center;
        [UIView commitAnimations];

Randomize the nsmutablearray + iphone

- (void)shuffle{
    static BOOL seeded = NO;
    if(!seeded)    {
        seeded = YES;
        srandom(time(NULL));
    }
    for (int i = 0; i < [cardsArray count]; ++i) {
        //Select a random element between i and end of array to swap with.
        int nElements = [cardsArray count]-i;
        int n = (random() % nElements) + i;
        [cardsArray exchangeObjectAtIndex:i withObjectAtIndex:n];
    }
    NSLog(@"%@",cardsArray);
}

http://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray

Access the iPhone as the internet access

https://github.com/tcurdt/iProxy

Mobile website of company in iphone

oxagile
http://itunes.apple.com/us/app/oxagile/id360148159?mt=8

mc solutions
http://itunes.apple.com/in/app/mc-solutions/id362032657?mt=8
INSITE MOBILE App
http://itunes.apple.com/us/app/insite-mobile-app/id479510187?mt=8

Flip half of the image animation in iPhone

https://github.com/mpospese/EnterTheMatrix

Display the gif animated image in iPhone

https://github.com/jamesu/glgif

Showing the ping for the particular lat long in iPhone

NSMutableArray *locs = [[NSMutableArray alloc] init];
    for (id <MKAnnotation> annot in [mapView annotations]){
        if ( [annot isKindOfClass:[ MKUserLocation class]] ) {
        }
        else {
         

    }
    [mapView removeAnnotations:locs];
    [locs release];
    locs = nil;
 CLLocationCoordinate2D annotationCoord;
    MKCoordinateRegion region;
    MKCoordinateSpan span;
   
    annotationCoord.latitude  = 42.270354;
    annotationCoord.longitude = -88.998159;
  
    span.latitudeDelta = 0.02;
    span.longitudeDelta = 0.02;
   
    region.span = span;
    region.center = annotationCoord;
   
    [mapView setRegion:region animated:YES];
    [mapView regionThatFits:region];
   
   
    MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
    annotationPoint.coordinate = annotationCoord;
    annotationPoint.title=@"Maulik";
    annotationPoint.subtitle=@"keshod,gujarat";
    [mapView addAnnotation:annotationPoint];
    [mapView selectAnnotation:annotationPoint animated:FALSE];

Setting image to any controls without stretchable in iPhone

UIImage *buttonImage = [[UIImage imageNamed:@"lbl_rightcut_small"]
             resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)];
[whichCatBtn setBackgroundImage:buttonImage forState:UIControlStateNormal];
    [

Setting the color with HexaCode in iPhone

+ (UIColor *)colorWithHex:(UInt32)col {
    unsigned char r, g, b;
    b = col & 0xFF;
    g = (col >> 8) & 0xFF;
    r = (col >> 16) & 0xFF;
    return [UIColor colorWithRed:(double)r/255.0f green:(double)g/255.0f blue:(double)b/255.0f alpha:1];
}

Zbar reader with no controls & without the bottom bar. + iphone

reader = [ZBarReaderViewController new];
           
            UIView * infoButton = [[[[[reader.view.subviews objectAtIndex:1] subviews] objectAtIndex:0] subviews] objectAtIndex:2];
            [infoButton setHidden:YES];
            reader.readerDelegate = self; reader.wantsFullScreenLayout=YES;
            reader.hidesBottomBarWhenPushed = YES;
            reader.showsZBarControls = NO;
           
            if (fromInterfaceOrientation==UIInterfaceOrientationLandscapeLeft) {
                fromInterfaceOrientation=UIInterfaceOrientationLandscapeRight;
            }
            else{
                fromInterfaceOrientation=UIInterfaceOrientationLandscapeLeft;
            }
            reader.supportedOrientationsMask = ZBarOrientationMask(fromInterfaceOrientation);
            ZBarImageScanner *scanner = reader.scanner;
            //TODO: (optional) additional reader configuration here
            //EXAMPLE: disable rarely used I2/5 to improve performance
            [scanner setSymbology: ZBAR_I25
                           config: ZBAR_CFG_ENABLE
                               to: 0];
            [scanCameraView addSubview:reader.view];
         
            reader.view.frame=CGRectMake(0, 0, scanCameraView.frame.size.width, scanCameraView.frame.size.height);
            reader.readerView.frame=reader.view.frame;
            [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

Setting any kind of image to UIButton without streaching in iPhone

UIButton *sampleButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [sampleButton setFrame:CGRectMake(10, 10, 500, 30)];
    [sampleButton setTitle:@"Button" forState:UIControlStateNormal];
    [sampleButton setFont:[UIFont boldSystemFontOfSize:15]];
    [sampleButton setTag:1];
    UIImage *buttonImage = [[UIImage imageNamed:@"lbl_rightcut_small"]
                            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 16, 0, 16)];
    [sampleButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
    [self.view addSubview:sampleButton]; 

For the pdf reader full access in iphone

https://github.com/mobfarm/FastPdfKit

Wednesday, 5 September 2012

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"];
}

For animating text into iPhone


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 making the wireframe or design of iPad and iPhone template

http://mockupbuilder.com/
http://www.axure.com
http://iphoneized.com/

For asynchronous image loading in iPad and iPhone

https://github.com/brendanlim/SDWebImage

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];
}

splitviewcontroller with MultipleDetailViews + iphone

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

Swipe a view like off some and push or pop in iPhone with pan gesture.

UIPanGestureRecognizer *panGesture = nil;
    panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panViewWithGestureRecognizer:)];
   
    [panGesture setMaximumNumberOfTouches:2];
    [panGesture setDelegate:self];
   
    [adminView addGestureRecognizer:panGesture];
    [panGesture release];
- (void)panViewWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
{   
   
    CGPoint velocity = [gestureRecognizer velocityInView:adminView];
   
    if(velocity.x > 0)
    {
        NSLog(@"gesture went right");
        if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged){
            if (adminView.frame.origin.x <= -10) {
                CGPoint translation = [gestureRecognizer translationInView:[adminView superview]];
                [adminView setCenter:CGPointMake([adminView center].x + translation.x, [adminView center].y)];
                [gestureRecognizer setTranslation:CGPointZero inView:[adminView superview]];
            }
        }
        else{
            if (adminView.frame.origin.x > -100) {
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5f];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(0, 0, 322, 748);
                [UIView commitAnimations];
            }
            else{
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(-295, 0, 322, 748);
                [UIView commitAnimations];
            }
        }
    }
    else
    {
        NSLog(@"gesture went left");
        if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged){
            if (adminView.frame.origin.x > -200) {
                CGPoint translation = [gestureRecognizer translationInView:[adminView superview]];
                [adminView setCenter:CGPointMake([adminView center].x + translation.x, [adminView center].y)];
                [gestureRecognizer setTranslation:CGPointZero inView:[adminView superview]];
            }
        }
        else{
            if (adminView.frame.origin.x > -250) {
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5f];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(-295, 0, 322, 748);
                [UIView commitAnimations];
            }
            else{
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(0, 0, 322, 748);
                [UIView commitAnimations];
            }
        }
    }
}

Random an Array in iPhone

NSInteger randomize(id num1, id num2, void *context)
{
    int rand = arc4random() %2;
    if (rand)
        return NSOrderedAscending;
    else
        return NSOrderedDescending;
}
NSMutableArray *temp=[[NSMutableArray alloc] init];
    for ( int i=0; i<=10; i++) {
        [temp addObject:[NSString stringWithFormat:@"%d",i]];
    }
[temp sortUsingFunction:randomize context:NULL];
NSLog(@"%@",temp);

Randomize the Uiimage color in iPhone

https://github.com/OmidH/Filtrr

Viewing hidden files on a Mac

//Viewing hidden files on a Mac
defaults write com.apple.finder AppleShowAllFiles -bool true

//hide  files on a Mac
defaults write com.apple.finder AppleShowAllFiles -bool false

Scroll Tableview to the Bottom in iPhone

 CGRect sectionRect = [self.tableView rectForSection: sectionIndexForNewFolder];
    // Try to get a full-height rect which is centred on the sectionRect
    // This produces a very similar effect to UITableViewScrollPositionMiddle.
    CGFloat extraHeightToAdd = sectionRect.size.height - self.tableView.frame.size.height;
    sectionRect.origin.y -= extraHeightToAdd * 0.5f;
    sectionRect.size.height += extraHeightToAdd;
    [self.tableView scrollRectToVisible:sectionRect animated:YES];

For get the time zone in standard time + iPhone

-(NSString *)getStandardTimeZone{
    NSTimeZone *timeZone=[NSTimeZone defaultTimeZone];
    NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
    NSString *timeZoneId = [timeZone localizedName:NSTimeZoneNameStyleStandard locale:locale];
    return timeZoneId;
}

Monday, 3 September 2012

For the Delete like the iPhone application.

For the Delete like the iPhone application.
https://github.com/heikomaass/HMLauncherView

For the Custome AlertView and ActionSheet in iPhone

For the Custome AlertView and ActionSheet in iPhone
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets

For Top Tabbar in iphone

For Top Tabbar in iphone
https://github.com/hollance/MHTabBarController
https://github.com/jasonmorrissey/JMTabView

For the Calendar Demo in iPhone

For the Calendar Demo in iPhone
https://github.com/klazuka/Kal
http://developinginthedark.com/posts/iphone-tapku-calendar-markers

For the Different kind of Api for iPhone

For the Different kind of Api for iPhone
http://www.subfurther.com/blog/category/speaking/page/3/

For the continuous Tableview in iPhone

For the continuous Tableview in iPhone
https://github.com/stephenjames/ContinuousTableview

For the different kind of photo view and video viewer in iPhone and also useful for Paint in iPhone

For the different kind of photo view and video  viewer in iPhone and also useful for Paint in iPhone
https://github.com/BradLarson/GPUImage

For the pull to refresh of tableview in iPhone

For the pull to refresh of tableview in iPhone
https://github.com/enormego/EGOTableViewPullRefresh

For different kind of demo for iPhone

For different kind of demo for iPhone

http://cocoacontrols.com/controls?page=2&platform_id=ios&sort=date

http://www.ogokilearning.com/native-language-app-code/

http://esramkumar.wordpress.com/tutorial-projects/

http://www.scoop.it/t/iphone-and-ipad-development?page=2

For setting the tab bar background image in iPhone

For setting the tab bar background image in iPhone
http://blog.theanalogguy.be/2011/09/14/custom-colored-uitabbar-icons-an-update/

 UIImage *tabBackground = [[UIImage imageNamed:@"tab_bg"]
                              resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [[UITabBar appearance] setBackgroundImage:tabBackground];
    [[UITabBar appearance] setSelectionIndicatorImage:
     [UIImage imageNamed:@"tab_select_indicator"]];
https://github.com/NOUSguide/NGTabBarController

For the Different Theme for Scrolling tableview in iPhone

For the Different Theme for Scrolling tableview in iPhone
https://github.com/applidium/ADLivelyTableView

For the Custom Progressbar in iPhone

For the Custom Progressbar in iPhone
https://github.com/appdesignvault/ADVProgressBar

For the reflecting image in iPhone

For the reflecting image in iPhone
https://github.com/ipalmer/CKReflectionImage

For the printing of image view or image in iPhone

For the printing of image view or image in iPhone
 - (IBAction)printContent  {
        // Obtain the shared UIPrintInteractionController
        UIPrintInteractionController *controller1 = [UIPrintInteractionController sharedPrintController];
        if(!controller1){
            NSLog(@"Couldn't get shared UIPrintInteractionController!");
            return;
        }
       
        // We need a completion handler block for printing.
        UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
            if(completed && error)
                NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code);
        };
       
        // Obtain a printInfo so that we can set our printing defaults.
        UIPrintInfo *printInfo = [UIPrintInfo printInfo];
        UIImage *image = [UIImage imageNamed:@"mainimage1.jpg"];
       
        // This application prints photos. UIKit will pick a paper size and print
        // quality appropriate for this content type.
        printInfo.outputType = UIPrintInfoOutputPhoto;
        // The path to the image may or may not be a good name for our print job
        // but that's all we've got.
        printInfo.jobName = [[imageURL path] lastPathComponent];
       
        // If we are performing drawing of our image for printing we will print
        // landscape photos in a landscape orientation.
        if(!controller1.printingItem && image.size.width > image.size.height)
            printInfo.orientation = UIPrintInfoOrientationLandscape;
       
        // Use this printInfo for this print job.
        controller1.printInfo = printInfo;
       
        //  Since the code below relies on printingItem being zero if it hasn't
        //  already been set, this code sets it to nil.
        controller1.printingItem = nil;
       
       
#if DIRECT_SUBMISSION
        // Use the URL of the image asset.
        if(imageURL && [UIPrintInteractionController canPrintURL:imageURL])
            controller1.printingItem = imageURL;
#endif
       
        // If we aren't doing direct submission of the image or for some reason we don't
        // have an ALAsset or URL for our image, we'll draw it instead.
        if(!controller1.printingItem){
            // Create an instance of our PrintPhotoPageRenderer class for use as the
            // printPageRenderer for the print job.
            PrintPhotoPageRenderer *pageRenderer = [[PrintPhotoPageRenderer alloc]init];
            // The PrintPhotoPageRenderer subclass needs the image to draw. If we were taking
            // this path we use the original image and not the fullScreenImage we obtained from
            // the ALAssetRepresentation.
            pageRenderer.imageToPrint = image;
            controller1.printPageRenderer = pageRenderer;
            [pageRenderer release];
        }
       
        // The method we use presenting the printing UI depends on the type of
        // UI idiom that is currently executing. Once we invoke one of these methods
        // to present the printing UI, our application's direct involvement in printing
        // is complete. Our delegate methods (if any) and page renderer methods (if any)
        // are invoked by UIKit.
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            //[controller presentFromBarButtonItem:self.printButton animated:YES completionHandler:completionHandler];  // iPad
        }else
            [controller1 presentAnimated:YES completionHandler:completionHandler];  // iPhone
       
    }

For the paging and scrollview photo gallery in iPhone

For the paging and scrollview photo gallery in iPhone
- (void)setupDisplayFiltering{
   
    NSArray *subview = [[mainScrollView subviews] copy];
    for (UIView *subview1 in subview) {
        [subview1 removeFromSuperview];
    }
    [subview release];
    
     mainScrollView.delegate = self;
   
    [mainScrollView setBackgroundColor:[UIColor clearColor]];
    [mainScrollView setCanCancelContentTouches:NO];
   
    mainScrollView.clipsToBounds = YES;
    mainScrollView.scrollEnabled = YES;
    mainScrollView.pagingEnabled = YES;
   
    CGFloat cx = 20;
    CGFloat cy = 10;
    CGFloat width=110;
    CGFloat height=110;
    int cnt=1;
    
    int scWidth=0;
   
    int row=0;
    int column=0;
   
    for (int i=0;i<[mainCatImgArray count];i++) {
       
        UIImage *image = [mainCatImgArray objectAtIndex:i];
        UIImageView *tempImg=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"viewBg.png"]];
        CGRect rect = tempImg.frame;
        rect.size.height =  height;
        rect.size.width = width;
        rect.origin.x = cx;
        rect.origin.y = cy;
        tempImg.frame = rect;
        [mainScrollView addSubview:tempImg];
        [tempImg release];
     
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        rect = imageView.frame;
        rect.size.height = height-30;
        rect.size.width = width-10;
        rect.origin.x = cx+5;
        rect.origin.y = cy+5;
        imageView.userInteractionEnabled=YES;
        imageView.frame = rect;
        imageView.tag=i+1;
       
        UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollImgTap:)];
        [tapRecognizer setNumberOfTapsRequired:1];
        [tapRecognizer setDelegate:self];
       
        [imageView addGestureRecognizer:tapRecognizer];
        UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
        longPressGesture.minimumPressDuration=0.2f;
        [imageView addGestureRecognizer:longPressGesture];
        [longPressGesture release];
       
        [mainScrollView addSubview:imageView];
       
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [btn setImage:[UIImage imageNamed:@"close_x.png"] forState:UIControlStateNormal];
        rect.size.height = 40;
        rect.size.width = 40;
        rect.origin.x = cx;
        rect.origin.y = cy+5;
        btn.userInteractionEnabled=YES;
        btn.frame = rect;
        btn.tag=i+1;
        [btn addTarget:self action:@selector(removeImageView:) forControlEvents:UIControlEventTouchUpInside];
       //  btn.hidden=YES;
        [mainScrollView addSubview:btn];   
       
       
        UILabel *tempIbl=[[UILabel alloc] initWithFrame:CGRectMake(cx,height+cy-20,width,25)];
        tempIbl.text=[NSString stringWithFormat:@"%d",imageView.tag];
        tempIbl.backgroundColor=[UIColor whiteColor];   
       
        tempIbl.textColor = [UIColor blackColor];
        tempIbl.textAlignment = UITextAlignmentCenter;
        tempIbl.font = [UIFont fontWithName:@"Arial" size:20.0f];
        tempIbl.lineBreakMode=UILineBreakModeMiddleTruncation;
        [mainScrollView addSubview:tempIbl];
       
        [imageView release];
        [tempIbl release];
        [btn release];
       
        if (column<=5) {
            column+=1;
            cx += tempImg.frame.size.width+20;
            NSLog(@"column %d",column);
            if (column>=5){
                column=0;
                cx=scWidth+20;
                cy+=tempImg.frame.size.height+15;
                row+=1;
                NSLog(@"row %d",row);
                if (row>=5) {
                    scWidth=683*cnt;
                    cx=scWidth+20;
                    cy=10;
                    row=0;
                     cnt+=1;
                }
              
            }
        }
    }
   
    pageControl.currentPage = 0;
    pageControl.numberOfPages=cnt;
    [mainScrollView setContentSize:CGSizeMake(683*cnt, [mainScrollView bounds].size.height)];
}
- (IBAction)changePage {
    // update the scroll view to the appropriate page
    CGRect frame;
    frame.origin.x = mainScrollView.frame.size.width * pageControl.currentPage;
    frame.origin.y = 0;
    frame.size = mainScrollView.frame.size;
    [mainScrollView scrollRectToVisible:frame animated:YES];
}
- (void)scrollViewDidScroll:(UIScrollView *)sender {
    // Update the page when more than 50% of the previous/next page is visible
    CGFloat pageWidth = mainScrollView.frame.size.width;
    int page = floor((mainScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    pageControl.currentPage = page;
    currentPageLbl.text=[NSString stringWithFormat:@"%d",page];
}

For the pushing a subview in UIView


 CATransition *transition = [CATransition animation];
        transition.duration = 0.75;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype =kCATransitionFromRight;
        transition.delegate = self;
        adminView.frame=CGRectMake(0, 0, 322, 748);
        [self.view.layer addAnimation:transition forKey:nil];

For the setting the color to the tab bar in iPhone

For the setting the color to the tab bar in iPhone
 // customize the tab bar background
    CGRect frame = CGRectMake(0, 0, 320, 49);
    UIView *viewBackround = [[UIView alloc] initWithFrame:frame];
    UIImage *imgBackground = [UIImage imageNamed:@"tabBg.png"];
    UIColor *colorPattern = [[UIColor alloc] initWithPatternImage:imgBackground];
    viewBackround.backgroundColor = colorPattern;
    [colorPattern release];
    [[self.tabBarController tabBar] insertSubview:viewBackround atIndex:1];
    [viewBackround release];

For the face detection by third party in iPhone


http://developers.face.com/download/
https://github.com/sergiomtzlosa/faceWrapper-iphone

For the pop view like the crossdissolve in iphone

For the pop view like the crossdissolve in iphone
https://github.com/jerometonnelier/LeveyPopListView
- (void)fadeIn
{
    self.transform = CGAffineTransformMakeScale(1.3, 1.3);
    self.alpha = 0;
    [UIView animateWithDuration:.35 animations:^{
        self.alpha = 1;
        self.transform = CGAffineTransformMakeScale(1, 1);
    }];

}
- (void)fadeOut
{
    [UIView animateWithDuration:.35 animations:^{
        self.transform = CGAffineTransformMakeScale(1.3, 1.3);
        self.alpha = 0.0;
    } completion:^(BOOL finished) {
        if (finished) {
            [self removeFromSuperview];
        }
    }];
}

For the all kind of demo for the Mono touch application for iPhone

For the all kind of demo for the Mono touch application for iPhone
http://samples.xamarin.com/Samples

For the different example of iPhone

For the different example of iPhone
http://kshitizghimire.com.np/lazy-loading-custom-uitableviewcell/

For the different example of iPhone

For the different example of iPhone
http://kshitizghimire.com.np/lazy-loading-custom-uitableviewcell/

For the loading more no of row in tableview in iPhone

For the loading more no of row in tableview in iPhone
http://useyourloaf.com/blog/2010/10/2/dynamically-loading-new-rows-into-a-table.html

For the searching in search bar or array in iPhone

For the searching in search bar or array in iPhone
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF BEGINSWITH [cd] %@)", savedSearchTerm];
        [searchResults addObjectsFromArray: [states filteredArrayUsingPredicate:predicate]];
   

For the searching in search bar or array in iPhone

For the searching in search bar or array in iPhone
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF BEGINSWITH [cd] %@)", savedSearchTerm];
        [searchResults addObjectsFromArray: [states filteredArrayUsingPredicate:predicate]];
   

For the barcode api for iPhone

For the barcode api for iPhone
http://www.mashape.com/index
maulik
iball@1910
http://www.upcdatabase.com/item/0016000660601

For the tag cloud for the iPhone

For the tag cloud for the iPhone
https://github.com/cezarsignori/SphereView/

For the best coverflow example for iPhone

For the best coverflow example for iPhone
https://github.com/nicklockwood/icarousel

For the best coverflow example for iPhone

For the best coverflow example for iPhone
https://github.com/nicklockwood/icarousel

For the poptextview demo in iPhone

For the poptextview demo in iPhone
https://github.com/inamiy/YIPopupTextView

For the different kind of demo for iPhone

For the different kind of demo for iPhone
http://highwaystech.com/index.php/source-code/ios.html

For the rotating the like a wheel control in iPhone

For the rotating the like a wheel control in iPhone
https://github.com/funkyboy/How-To-Create-a-Rotating-Wheel-Control-with-UIKit

For the different kind of animation in iPhone

For the different kind of animation in iPhone
https://github.com/bobmccune/Core-Animation-Demos

For the resuming the app after call ended in iPhone

For the resuming the app after call ended in iPhone
NSString *strPhoneNo = @"9904523387";
    UIWebView *phoneCallWebview = [[UIWebView alloc] init];
    NSURL *callURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", strPhoneNo]];
    [phoneCallWebview loadRequest:[NSURLRequest requestWithURL:callURL ]];

For changing the color of the UITabBarItem text in iphone



[[UITabBarItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor blackColor], UITextAttributeTextColor,
      [UIColor grayColor], UITextAttributeTextShadowColor,
      [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
      [UIFont fontWithName:@"AmericanTypewriter" size:0.0], UITextAttributeFont,
      nil]
                                             forState:UIControlStateNormal];

For changing the color of the UITabBarItem text in iphone



[[UITabBarItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor blackColor], UITextAttributeTextColor,
      [UIColor grayColor], UITextAttributeTextShadowColor,
      [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
      [UIFont fontWithName:@"AmericanTypewriter" size:0.0], UITextAttributeFont,
      nil]
                                             forState:UIControlStateNormal];

For the Tint in the UITableview in iphone


https://github.com/PaulSolt/WEPopover

For the Popup any view in iPhone


https://github.com/sonsongithub/PopupView

For the Popup any view in iPhone


https://github.com/sonsongithub/PopupView

For the short url of the long url in iPhone


https://github.com/dbloete/bitly-iphone

For the Indexed UITableView in iPhone


http://www.iphonedevcentral.com/indexed-uitableview-tutorial/
https://github.com/kwylez/IndexedTable

For the barcode scanner in iPhone


https://github.com/stefanhafeneger/Barcode

For opening the directly installed app from the iPhone


http://wiki.akosma.com/IPhone_URL_Schemes

For the pull to refresh demo of the UITableView in iPhone

https://github.com/leah/PullToRefresh

For the different types of animation

http://www.cimgf.com/2012/01/11/handling-incoming-json-redux/

For the zip file and parsing the images from server


http://www.touch-code-magazine.com/update-dynamically-your-iphone-app-with-new-content/

For the gallery or grid view for the iPhone

https://github.com/gdavis/FGallery-iPhone

For the rotating an object by center by touch in iPhone

https://github.com/hollance/MHRotaryKnob
http://rdsquared.wordpress.com/

For the different kind of demo for iPhone

http://stackoverflow.com/questions/1939/how-to-articles-for-iphone-development-and-objective-c

For the Encryption and decryption of the url

http://blog.objectgraph.com/index.php/2010/04/20/encrypting-decrypting-base64-encode-decode-in-iphone-objective-c/

For the barcode url parsing

http://searchupc.com/developers/login.aspx

For the emoji icons

http://arashnorouzi.wordpress.com/

For .Net push notifications

https://github.com/arashnorouzi/Moon-APNS

For the Cocos2d game example

http://mobile.tutsplus.com/tutorials/iphone/learn-ios-game-development-by-example-10-projects-to-get-you-started/

For testing the push notification in iPhone

https://github.com/stefanhafeneger/PushMeBaby
https://github.com/Redth/APNS-Sharp

For the Custom Base and Custom button in iPhone


http://www.spaulus.com/2011/04/custombadge-2-0-retina-ready-scalable-light-reflex/?lang=en

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"];
}

Monday, 18 June 2012

urldemo 13

//For get the time zone in standard time + iPhone
-(NSString *)getStandardTimeZone{
    NSTimeZone *timeZone=[NSTimeZone defaultTimeZone];
    NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
    NSString *timeZoneId = [timeZone localizedName:NSTimeZoneNameStyleStandard locale:locale];
    return timeZoneId;
}


//Scroll Tableview to the Bottom in iPhone
 CGRect sectionRect = [self.tableView rectForSection: sectionIndexForNewFolder];
    // Try to get a full-height rect which is centred on the sectionRect
    // This produces a very similar effect to UITableViewScrollPositionMiddle.
    CGFloat extraHeightToAdd = sectionRect.size.height - self.tableView.frame.size.height;
    sectionRect.origin.y -= extraHeightToAdd * 0.5f;
    sectionRect.size.height += extraHeightToAdd;
    [self.tableView scrollRectToVisible:sectionRect animated:YES];


//Viewing hidden files on a Mac
defaults write com.apple.finder AppleShowAllFiles -bool true

//hide  files on a Mac
defaults write com.apple.finder AppleShowAllFiles -bool false

//Randomize the Uiimage color in iPhone
    https://github.com/OmidH/Filtrr

//Random an Array in iPhone
NSInteger randomize(id num1, id num2, void *context)
{
    int rand = arc4random() %2;
    if (rand)
        return NSOrderedAscending;
    else
        return NSOrderedDescending;
}
NSMutableArray *temp=[[NSMutableArray alloc] init];
    for ( int i=0; i<=10; i++) {
        [temp addObject:[NSString stringWithFormat:@"%d",i]];
    }
[temp sortUsingFunction:randomize context:NULL];
NSLog(@"%@",temp);




 //Swipe a view like off some and push or pop in iPhone with pan gesture.

    UIPanGestureRecognizer *panGesture = nil;
    panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panViewWithGestureRecognizer:)];
   
    [panGesture setMaximumNumberOfTouches:2];
    [panGesture setDelegate:self];
   
    [adminView addGestureRecognizer:panGesture];
    [panGesture release];
- (void)panViewWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
{   
   
    CGPoint velocity = [gestureRecognizer velocityInView:adminView];
   
    if(velocity.x > 0)
    {
        NSLog(@"gesture went right");
        if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged){
            if (adminView.frame.origin.x <= -10) {
                CGPoint translation = [gestureRecognizer translationInView:[adminView superview]];
                [adminView setCenter:CGPointMake([adminView center].x + translation.x, [adminView center].y)];
                [gestureRecognizer setTranslation:CGPointZero inView:[adminView superview]];
            }
        }
        else{
            if (adminView.frame.origin.x > -100) {
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5f];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(0, 0, 322, 748);
                [UIView commitAnimations];
            }
            else{
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(-295, 0, 322, 748);
                [UIView commitAnimations];
            }
        }
    }
    else
    {
        NSLog(@"gesture went left");
        if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged){
            if (adminView.frame.origin.x > -200) {
                CGPoint translation = [gestureRecognizer translationInView:[adminView superview]];
                [adminView setCenter:CGPointMake([adminView center].x + translation.x, [adminView center].y)];
                [gestureRecognizer setTranslation:CGPointZero inView:[adminView superview]];
            }
        }
        else{
            if (adminView.frame.origin.x > -250) {
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5f];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(-295, 0, 322, 748);
                [UIView commitAnimations];
            }
            else{
                [UIView beginAnimations:nil context:NULL];
                [UIView setAnimationDuration:0.5];
                [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:adminView cache:YES];
                adminView.frame=CGRectMake(0, 0, 322, 748);
                [UIView commitAnimations];
            }
        }
    }
}