JSON IMAGE LINK

15 Jun

http://app.beerworld.ch/webservice/searchkeyword.php

Image Set in Cell

11 Jun

 

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”tblCellarrow.png”]];

cell.accessoryView = imageView;

[imageView release];

return cell;

}

USE NSUserDefaults

11 Jun

– (IBAction)continuewithapp {

NSUserDefaults *userdefault = [NSUserDefaults standardUserDefaults];

[userdefault setValue:@”1″ forKey:@”T&C”];

[userdefault synchronize];

AppDelegate *ObjApp = (AppDelegate *)[[UIApplication sharedApplication] delegate];

if (ObjApp.checkDevice == 1)

{

//        For iPhone

HomeScreen *objectController = [[HomeScreen alloc] initWithNibName:@”HomeScreen” bundle:nil];

[self.navigationController pushViewController:objectController animated:YES];

}

else if (ObjApp.checkDevice == 2)

{

//        For iPad

HomeScreen *objectController = [[HomeScreen alloc] initWithNibName:@”HomeScreen_iPad” bundle:nil];

[self.navigationController pushViewController:objectController animated:YES];

}

}

Change DateFormat

7 Jun

 

NSString *old = object.FingerprintingTime;

[old retain];

NSString *first = @”DATA/ORA: “;

NSDate *dt1 = [[NSDate alloc]init];

dt1=[self parseRFC3339Date:old];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@”dd/MM/yyyy HH:mm:ss”];

NSString *FinalDateString = [dateFormatter stringFromDate:dt1];

 

NSString *combined = [NSString stringWithFormat:@”%@%@”, first, FinalDateString];

//GETTING FINAL NEW DATE IN:-  combined String….

[[cell lblDate] setText:combined];

 

////////////////////////////OR///////////////////////////

 

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];

[dateFormat setDateFormat:@”yyyy-MM-dd’T’HH:mm:sszzz”];

NSDate *date = [dateFormat dateFromString:[object.FingerprintingTime

stringByReplacingCharactersInRange:NSMakeRange(22,1)

withString:@””]];

[dateFormat release];

NSDateFormatter *dateFormat1 = [[NSDateFormatter alloc] init];

[dateFormat1 setDateFormat:@”dd/MM/yyyy HH:mm:ss”];

NSString *date1 = [dateFormat1 stringFromDate:date];

[dateFormat1 release];

NSString *first = @”DATA/ORA:”;

NSString *combined = [NSString stringWithFormat:@”%@%@”, first, date1];

 

iPhone & iPad Retina and non-Retina Size

3 Jun

http://upstageapp.com/resources

 

Apple interface sizes

DESCRIPTION IPHONE / IPOD IPHONE / IPOD RETINA IPAD DIMENSIONS
Screen Dimensions 320 x 480 640 x 960  768 x 1024
1024 x 768
Screen Dimensions – Status bar 320 x 460 640 x 920  768 x 1004
1024 x 748
Status Bar 320 x 20 640 x 40 768 x 20
1024 x 20
Application icon 57 x 57 114 x 114 72 x 72
App Store icon 512 x 512 512 x 512 512 x 512
Small icon for Spotlight search results and Settings 29 x 29 58 x 58 50 x 50 for Spotlight search results
29 x 29 for Settings
Document icon (recommended for custom document types) 22 x 29 44 x 58 64 x 64 & 320 x 320
Web clip icon (recommended for web applications and websites) 57 x 57 114 x 114 72 x 72
Toolbar and navigation bar icon (optional) ~ 20 x 20 ~ 40 x 40 ~ 20 x 20
Tab bar icon (optional) ~ 30 x 30 ~ 60 x 60 ~ 30 x 30
Launch image 320 x 480 640 x 960 768 x 1004
1024 x 748
UINavigation Bar 320 x 44 640 x 88  768 x 44
1024 x 44v

HIDE KEYPAD IN IPHONE CLICK ON TEXTVIEW

30 Apr

– (BOOL)textViewShouldEndEditing:(UITextView *)textView{

return YES;

}

CHECK IPHONE or IPAD

25 Apr

AppDelegate.h

#import <UIKit/UIKit.h>

 

@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) UINavigationController *navigationController;

+(NSString *)resourceFromModel:(NSString *)str;

@end

AppDelegate.m

#import “AppDelegate.h”

#import “FirstViewController.h”

#import “SecondViewController.h”

 

@implementation AppDelegate

 

– (void)dealloc

{

[_window release];

[_navigationController release];

[super dealloc];

}

 

– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

 

FirstViewController *masterViewController = [[[FirstViewController alloc] initWithNibName:[AppDelegate resourceFromModel: @”FirstViewController”] bundle:nil] autorelease];

self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];

self.window.rootViewController = self.navigationController;

[self.window makeKeyAndVisible];

return YES;

}

 

+(BOOL)isIpad {

if ([[UIDevice currentDevice].model rangeOfString:@”iPad”].location == NSNotFound) {

return NO;

}

return YES;

}

 

 

+(NSString *)resourceFromModel:(NSString *)str {

if ([[UIDevice currentDevice].model rangeOfString:@”iPad”].location == NSNotFound) {

return str;

}

else {

return [str stringByAppendingString: @”_iPad”];

 

//        if ([str rangeOfString: @”.”].location == NSNotFound) {

//

//            return [str stringByAppendingString: @”_iPad”];

//        }

//        else {

//

//            return [str stringByReplacingOccurrencesOfString:@”.” withString:@”_iPad.”];

//        }

}

}

 

 

 

– (void)applicationWillResignActive:(UIApplication *)application

{

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}

 

– (void)applicationDidEnterBackground:(UIApplication *)application

{

// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

 

– (void)applicationWillEnterForeground:(UIApplication *)application

{

// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}

 

– (void)applicationDidBecomeActive:(UIApplication *)application

{

// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}

 

– (void)applicationWillTerminate:(UIApplication *)application

{

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

 

/*

// Optional UITabBarControllerDelegate method.

– (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

{

}

*/

 

/*

// Optional UITabBarControllerDelegate method.

– (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed

{

}

*/

@end

 

FirstViewController.h

#import <UIKit/UIKit.h>

 

@interface FirstViewController : UIViewController {

}

 

– (IBAction)next:(id)sender;

@end

 

FirstViewController.m

#import “FirstViewController.h”

#import “SecondViewController.h”

#import “AppDelegate.h”

 

@interface FirstViewController ()

 

@end

 

@implementation FirstViewController

 

– (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

self.title = NSLocalizedString(@”First”, @”First”);

self.tabBarItem.image = [UIImage imageNamed:@”first”];

}

return self;

}

 

– (void)viewDidLoad

{

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

}

 

– (void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

 

– (IBAction)next:(id)sender {

 

SecondViewController *masterViewController = [[[SecondViewController alloc] initWithNibName:[AppDelegate resourceFromModel: @”SecondViewController”] bundle:nil] autorelease];

[[self navigationController] pushViewController:masterViewController animated:YES];

}

@end