http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-music-library-access/
Friday, 24 February 2012
urldemo 8
//For the custom Media Player in iphone
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-music-library-access/
//For the different snippet
http://super-mak.blogspot.in/2011/03/create-pdf-file-in-iphone-sdk.html
// For the cocos2d tutorials
http://dev.lethain.com/notes-on-cocos2d-iphone-development/
http://www.iphonegametutorials.com/2010/09/03/getting-started-with-cocos2d/
//For the encryption and decryption
https://gist.github.com/838614
//For the all type of Custom Demo like uitabbar
https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar
//For the rotating the any object round round
CALayer *orbit1 = [CALayer layer];
orbit1.bounds = CGRectMake(0, 0, 200, 200);
orbit1.position = self.view.center;
orbit1.cornerRadius = 100;
orbit1.borderColor = [UIColor clearColor].CGColor;
orbit1.borderWidth = 1.5;
CALayer *planet1 = [CALayer layer];
planet1.bounds = CGRectMake(0, 0, 20, 20);
planet1.position = CGPointMake(100, 0);
planet1.cornerRadius = 10;
planet1.backgroundColor = [UIColor redColor].CGColor;
[orbit1 addSublayer:planet1];
CABasicAnimation *anim1 = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim1.fromValue = [NSNumber numberWithFloat:0];
anim1.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
anim1.repeatCount = HUGE_VALF;
anim1.duration = 8.0;
[orbit1 addAnimation:anim1 forKey:@"transform"];
[self.view.layer addSublayer:orbit1];
//For the Content side of UIScrollView
CGRect contentSize = CGRectZero;
for (UIView *subview in scrollView.subviews) {
contentSize = CGRectUnion(contentSize, subview.frame);
}
scrollView.contentSize = contentSize.size;
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-music-library-access/
//For the different snippet
http://super-mak.blogspot.in/2011/03/create-pdf-file-in-iphone-sdk.html
// For the cocos2d tutorials
http://dev.lethain.com/notes-on-cocos2d-iphone-development/
http://www.iphonegametutorials.com/2010/09/03/getting-started-with-cocos2d/
//For the encryption and decryption
https://gist.github.com/838614
//For the all type of Custom Demo like uitabbar
https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar
//For the rotating the any object round round
CALayer *orbit1 = [CALayer layer];
orbit1.bounds = CGRectMake(0, 0, 200, 200);
orbit1.position = self.view.center;
orbit1.cornerRadius = 100;
orbit1.borderColor = [UIColor clearColor].CGColor;
orbit1.borderWidth = 1.5;
CALayer *planet1 = [CALayer layer];
planet1.bounds = CGRectMake(0, 0, 20, 20);
planet1.position = CGPointMake(100, 0);
planet1.cornerRadius = 10;
planet1.backgroundColor = [UIColor redColor].CGColor;
[orbit1 addSublayer:planet1];
CABasicAnimation *anim1 = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim1.fromValue = [NSNumber numberWithFloat:0];
anim1.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
anim1.repeatCount = HUGE_VALF;
anim1.duration = 8.0;
[orbit1 addAnimation:anim1 forKey:@"transform"];
[self.view.layer addSublayer:orbit1];
//For the Content side of UIScrollView
CGRect contentSize = CGRectZero;
for (UIView *subview in scrollView.subviews) {
contentSize = CGRectUnion(contentSize, subview.frame);
}
scrollView.contentSize = contentSize.size;
Friday, 17 February 2012
urldemo 7
//For Setting images to NSUserDefault
1 ) [[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(image) forKey:@"foo"];
or
1 ) NSData *imageData;
// create NSData-object from image
imageData = UIImagePNGRepresentation([dic objectForKey:[NSString stringWithFormat:@"%d",i]]);
// save NSData-object to UserDefaults
[[NSUserDefaults standardUserDefaults] setObject:imageData forKey:[NSString stringWithFormat:@"%d",i]];
//For Getting images from NSUserDefault
NSData *imageData;
// Load NSData-object from NSUserDefault
imageData = [[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"%d",i]];
// get Image from NSData
[image setObject:[UIImage imageWithData:imageData] forKey:[NSString stringWithFormat:@"%d",i]];
//url Escaping.
$ %24
& %26
+ %2B
, %2C
/ %2F
: %3A
; %3B
= %3D
? %3F
@ %40
- (NSString*)stringWithPercentEscape {
return [(NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)[[self mutableCopy] autorelease], NULL, CFSTR("=,!$&'()*+;@?\n\"<>#\t :/"),kCFStringEncodingUTF8) autorelease];
}
//For the CALayer rotating of ball within center
http://www.2shared.com/file/BaJ18c2U/CALayerAnimTEst.htm
//For the sending and receiving data to the server
http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-receive-data-from-the-server-in-iphone/
//For pop view like push
[self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex: 1] animated: YES];
//For the Wenggling of any things
- (void)startWobble {
resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5));
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse)
animations:^ {
resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5));
}
completion:NULL
];
}
[self startWobble];
- (void)stopWobble {
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear)
animations:^ {
itemView.transform = CGAffineTransformIdentity;
}
completion:NULL
];
}
//For the shake/vibration of unbutton
https://github.com/jonasschnelli/UIView-I7ShakeAnimation
1 ) [[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(image) forKey:@"foo"];
or
1 ) NSData *imageData;
// create NSData-object from image
imageData = UIImagePNGRepresentation([dic objectForKey:[NSString stringWithFormat:@"%d",i]]);
// save NSData-object to UserDefaults
[[NSUserDefaults standardUserDefaults] setObject:imageData forKey:[NSString stringWithFormat:@"%d",i]];
//For Getting images from NSUserDefault
NSData *imageData;
// Load NSData-object from NSUserDefault
imageData = [[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"%d",i]];
// get Image from NSData
[image setObject:[UIImage imageWithData:imageData] forKey:[NSString stringWithFormat:@"%d",i]];
//url Escaping.
$ %24
& %26
+ %2B
, %2C
/ %2F
: %3A
; %3B
= %3D
? %3F
@ %40
- (NSString*)stringWithPercentEscape {
return [(NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)[[self mutableCopy] autorelease], NULL, CFSTR("=,!$&'()*+;@?\n\"<>#\t :/"),kCFStringEncodingUTF8) autorelease];
}
//For the CALayer rotating of ball within center
http://www.2shared.com/file/BaJ18c2U/CALayerAnimTEst.htm
//For the sending and receiving data to the server
http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-receive-data-from-the-server-in-iphone/
//For pop view like push
[self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex: 1] animated: YES];
//For the Wenggling of any things
- (void)startWobble {
resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5));
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse)
animations:^ {
resultImage.transform = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5));
}
completion:NULL
];
}
[self startWobble];
- (void)stopWobble {
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear)
animations:^ {
itemView.transform = CGAffineTransformIdentity;
}
completion:NULL
];
}
//For the shake/vibration of unbutton
https://github.com/jonasschnelli/UIView-I7ShakeAnimation
Saturday, 4 February 2012
urldemo 6
// SKU=Stock Keeping Unit
//For the custom progressView
http://www.obsessivecode.com/projects/ocprogress/
//For the parsing of <img src> tag from the string
- (NSString *)getFirstImage:(NSString *)htmlString{
NSString *urlImage=nil;
NSScanner *theScanner = [NSScanner scannerWithString:htmlString];
// find start of IMG tag
[theScanner scanUpToString:@"<img" intoString:nil];
do {
[theScanner scanUpToString:@"src" intoString:nil];
NSCharacterSet *charset = [NSCharacterSet characterSetWithCharactersInString:@"\"'"];
[theScanner scanUpToCharactersFromSet:charset intoString:nil];
[theScanner scanCharactersFromSet:charset intoString:nil];
[theScanner scanUpToCharactersFromSet:charset intoString:&urlImage];
if([urlImage rangeOfString:@"imagebutton.gif"].location == NSNotFound) return urlImage;
}while (![theScanner isAtEnd] );
if([theScanner isAtEnd]) return nil;
return urlImage;
}
//For Rss links for iPhone themes
http://iphonethemes.net/rss1/Abstract
1 to 26
//creating group
ABAddressBookRef addressBook = ABAddressBookCreate();
CFErrorRef err = nil;
ABRecordRef group = ABGroupCreate();
ABRecordSetValue(group, kABGroupNameProperty, @"MCA", &err);
ABAddressBookRemoveRecord(addressBook,group, &err);
ABAddressBookSave(addressBook, &err);
//Removing group
-(BOOL)removeGroup{
BOOL res;
CFErrorRef error;
ABAddressBookRef ab = ABAddressBookCreate();
NSArray *groups = (NSArray *) ABAddressBookCopyArrayOfAllGroups(ab);
for (id _group in groups)
{
NSString *currentGroupName = [[NSString alloc] init];
currentGroupName = (NSString*) ABRecordCopyValue(_group, kABGroupNameProperty);
if ([@"MCA" isEqualToString:currentGroupName])
{
[currentGroupName release];
res = ABAddressBookRemoveRecord(ab, _group, &error);
ABAddressBookSave(ab, nil);
return res;
}
[currentGroupName release];
}
return NO;
}
//For sending mail from gmail or yahoo account
http://sourceforge.net/projects/nimitparekh/files/mail%20transfer%20using%20GMAIL/mailTransfer.zip/download
//For the weather demo
http://learningiphoneprogramming.com/pages/samplecode.html
///For the converting the contact in the Vcard form
- (NSString *)vCardRepresentation
{
NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
[mutableArray addObject:@"BEGIN:VCARD"];
[mutableArray addObject:@"VERSION:3.0"];
[mutableArray addObject:[NSString stringWithFormat:@"FN:%@", self.name]];
[mutableArray addObject:[NSString stringWithFormat:@"ADR:;;%@",
[self addressWithSeparator:@";"]]];
if (self.phone != nil)
[mutableArray addObject:[NSString stringWithFormat:@"TEL:%@", self.phone]];
[mutableArray addObject:[NSString stringWithFormat:@"GEO:%g;%g",
self.latitudeValue, self.longitudeValue]];
[mutableArray addObject:[NSString stringWithFormat:@"URL:http://%@",
self.website]];
[mutableArray addObject:@"END:VCARD"];
NSString *string = [mutableArray componentsJoinedByString:@"\n"];
[mutableArray release];
return string;
}
For sending mail for vcf file
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
if ([MFMailComposeViewController canSendMail]){
NSData *vCards = (NSData *) ABPersonCreateVCardRepresentationWithPeople(allPeople);
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:@"Contact"];
[mc setMessageBody:@"<p>My message...<p>" isHTML:YES];
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, 1);
// CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
// NSString *contactFirst = [NSString stringWithFormat: @"%@", (NSString *)firstName];
// NSString *label = ([allPeople count] == 1)? (NSString *)ABRecordCopyCompositeName([allPeople objectAtIndex:0]): @"Contacts";
[mc addAttachmentData:vCards mimeType:@"text/x-vcard" fileName:@"All.vcf"];//
[self presentModalViewController:mc animated:YES];
[mc release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Result: canceled");
break;
case MFMailComposeResultSaved:
NSLog(@"Result: saved");
break;
case MFMailComposeResultSent:
NSLog(@"Result: sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not sent");
break;
}
[self becomeFirstResponder];
[controller dismissModalViewControllerAnimated:YES];
}
//For the sending one mail to bulkPeople
- (IBAction)emailBtnPress {
if ([appDel connectedToInternet]==YES) {
if ([MFMailComposeViewController canSendMail] ){
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
NSMutableArray *emailIdArray= [[NSMutableArray alloc] init];
for (int i = 0; i < nPeople; i++) {
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
ABMultiValueRef multiValue = ABRecordCopyValue(ref, kABPersonEmailProperty);
NSLog(@"%@",multiValue);
int count = ABMultiValueGetCount(multiValue);
NSLog(@"%d",count);
int j;
for(j = 0; j < count; j++) {
NSString *label = (NSString *)ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(multiValue, j));
NSString *value = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, j);
NSLog(@"Email for %@: %@", label, value);
[emailIdArray addObject:value];
}
}
NSLog(@"%@",emailIdArray);
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setCcRecipients:emailIdArray];
[mailController setSubject:@"Sending bulk Email"];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
else{
[appDel showAlert:@"!Opps" message:@"Your Device should not configured the mail account."];
}
}
else{
[appDel showAlert:@"!Opps" message:@"Check your network connection."];
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Result: canceled");
break;
case MFMailComposeResultSaved:
NSLog(@"Result: saved");
break;
case MFMailComposeResultSent:
NSLog(@"Result: sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not sent");
break;
}
[self becomeFirstResponder];
[controller dismissModalViewControllerAnimated:YES];
}
//For the custom progressView
http://www.obsessivecode.com/projects/ocprogress/
//For the parsing of <img src> tag from the string
- (NSString *)getFirstImage:(NSString *)htmlString{
NSString *urlImage=nil;
NSScanner *theScanner = [NSScanner scannerWithString:htmlString];
// find start of IMG tag
[theScanner scanUpToString:@"<img" intoString:nil];
do {
[theScanner scanUpToString:@"src" intoString:nil];
NSCharacterSet *charset = [NSCharacterSet characterSetWithCharactersInString:@"\"'"];
[theScanner scanUpToCharactersFromSet:charset intoString:nil];
[theScanner scanCharactersFromSet:charset intoString:nil];
[theScanner scanUpToCharactersFromSet:charset intoString:&urlImage];
if([urlImage rangeOfString:@"imagebutton.gif"].location == NSNotFound) return urlImage;
}while (![theScanner isAtEnd] );
if([theScanner isAtEnd]) return nil;
return urlImage;
}
//For Rss links for iPhone themes
http://iphonethemes.net/rss1/Abstract
1 to 26
//creating group
ABAddressBookRef addressBook = ABAddressBookCreate();
CFErrorRef err = nil;
ABRecordRef group = ABGroupCreate();
ABRecordSetValue(group, kABGroupNameProperty, @"MCA", &err);
ABAddressBookRemoveRecord(addressBook,group, &err);
ABAddressBookSave(addressBook, &err);
//Removing group
-(BOOL)removeGroup{
BOOL res;
CFErrorRef error;
ABAddressBookRef ab = ABAddressBookCreate();
NSArray *groups = (NSArray *) ABAddressBookCopyArrayOfAllGroups(ab);
for (id _group in groups)
{
NSString *currentGroupName = [[NSString alloc] init];
currentGroupName = (NSString*) ABRecordCopyValue(_group, kABGroupNameProperty);
if ([@"MCA" isEqualToString:currentGroupName])
{
[currentGroupName release];
res = ABAddressBookRemoveRecord(ab, _group, &error);
ABAddressBookSave(ab, nil);
return res;
}
[currentGroupName release];
}
return NO;
}
//For sending mail from gmail or yahoo account
http://sourceforge.net/projects/nimitparekh/files/mail%20transfer%20using%20GMAIL/mailTransfer.zip/download
//For the weather demo
http://learningiphoneprogramming.com/pages/samplecode.html
///For the converting the contact in the Vcard form
- (NSString *)vCardRepresentation
{
NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
[mutableArray addObject:@"BEGIN:VCARD"];
[mutableArray addObject:@"VERSION:3.0"];
[mutableArray addObject:[NSString stringWithFormat:@"FN:%@", self.name]];
[mutableArray addObject:[NSString stringWithFormat:@"ADR:;;%@",
[self addressWithSeparator:@";"]]];
if (self.phone != nil)
[mutableArray addObject:[NSString stringWithFormat:@"TEL:%@", self.phone]];
[mutableArray addObject:[NSString stringWithFormat:@"GEO:%g;%g",
self.latitudeValue, self.longitudeValue]];
[mutableArray addObject:[NSString stringWithFormat:@"URL:http://%@",
self.website]];
[mutableArray addObject:@"END:VCARD"];
NSString *string = [mutableArray componentsJoinedByString:@"\n"];
[mutableArray release];
return string;
}
For sending mail for vcf file
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
if ([MFMailComposeViewController canSendMail]){
NSData *vCards = (NSData *) ABPersonCreateVCardRepresentationWithPeople(allPeople);
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:@"Contact"];
[mc setMessageBody:@"<p>My message...<p>" isHTML:YES];
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, 1);
// CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
// NSString *contactFirst = [NSString stringWithFormat: @"%@", (NSString *)firstName];
// NSString *label = ([allPeople count] == 1)? (NSString *)ABRecordCopyCompositeName([allPeople objectAtIndex:0]): @"Contacts";
[mc addAttachmentData:vCards mimeType:@"text/x-vcard" fileName:@"All.vcf"];//
[self presentModalViewController:mc animated:YES];
[mc release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Result: canceled");
break;
case MFMailComposeResultSaved:
NSLog(@"Result: saved");
break;
case MFMailComposeResultSent:
NSLog(@"Result: sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not sent");
break;
}
[self becomeFirstResponder];
[controller dismissModalViewControllerAnimated:YES];
}
//For the sending one mail to bulkPeople
- (IBAction)emailBtnPress {
if ([appDel connectedToInternet]==YES) {
if ([MFMailComposeViewController canSendMail] ){
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
NSMutableArray *emailIdArray= [[NSMutableArray alloc] init];
for (int i = 0; i < nPeople; i++) {
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
ABMultiValueRef multiValue = ABRecordCopyValue(ref, kABPersonEmailProperty);
NSLog(@"%@",multiValue);
int count = ABMultiValueGetCount(multiValue);
NSLog(@"%d",count);
int j;
for(j = 0; j < count; j++) {
NSString *label = (NSString *)ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(multiValue, j));
NSString *value = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, j);
NSLog(@"Email for %@: %@", label, value);
[emailIdArray addObject:value];
}
}
NSLog(@"%@",emailIdArray);
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setCcRecipients:emailIdArray];
[mailController setSubject:@"Sending bulk Email"];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
else{
[appDel showAlert:@"!Opps" message:@"Your Device should not configured the mail account."];
}
}
else{
[appDel showAlert:@"!Opps" message:@"Check your network connection."];
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Result: canceled");
break;
case MFMailComposeResultSaved:
NSLog(@"Result: saved");
break;
case MFMailComposeResultSent:
NSLog(@"Result: sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not sent");
break;
}
[self becomeFirstResponder];
[controller dismissModalViewControllerAnimated:YES];
}
Tuesday, 24 January 2012
urldemo 5
//For the hexa code to UIColor
- (UIColor *) colorWithHexString: (NSString *) hex
{
NSString *cString = [[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6) return [UIColor grayColor];
// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if ([cString length] != 6) return [UIColor grayColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:1.0f];
}
how to use it
[self.view setBackgroundColor: [self colorWithHexString:@"Ff0000"]];
//For the slider to unlock example for slider
altosdesign.com/iphonesdk/SlideToCancel.zip
http://www.altosdesign.com/iphonesdk/SlideToCancel.zip
//For the pop to specific view in iPhone
[self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex: 1] animated: YES];
//For the custom image slider
UIImage *minImage = [UIImage imageNamed:@"grey_track.png"];
UIImage *maxImage = [UIImage imageNamed:@"white_track.png"];
UIImage *tumbImage= [UIImage imageNamed:@"metal_screw.png"];
minImage=[minImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
maxImage=[maxImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
// Setup the FX slider
[maxPriceSlider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[maxPriceSlider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[maxPriceSlider setThumbImage:tumbImage forState:UIControlStateNormal];
//For the sectioned TableView
http://www.mobisoftinfotech.com/blog/iphone/iphone-uitableview-tutorial-grouped-table/
/*<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Photo</key>
<string>mobile.png</string>
<key>Mobile Phones</key>
<array>
<string>GSM Phones</string>
<string>Dual Sim Phones</string>
<string>CDMA Phones</string>
</array>
<key>Smart Phones</key>
<array>
<string>IOS Phones</string>
<string>Android OS Phones</string>
<string>Blackberry Phones</string>
<string>Symbian OS Phones</string>
<string>Tablet Phones</string>
<string>Windows OS Phones</string>
<string>Bada OS Phones</string>
</array>
<key>Mobile Accessories</key>
<array>
<string>Screen Protectors</string>
<string>Memory Card</string>
<string>HeadPhones</string>
<string>CaseMate</string>
<string>Bluetooth Devices</string>
</array>
<key>Landline Phones</key>
<array>
<string>Landline Phones</string>
</array>
</dict>
</plist>
*/
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBarHidden=NO;
self.title=@"Sub Category";
appDel=(AppDelegate *)[[UIApplication sharedApplication]delegate];
NSLog(@"indexValue %@",indexValue);
NSString *getPlist=[[NSBundle mainBundle] pathForResource:indexValue ofType:@"plist"];
NSLog(@"%@",getPlist);
plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:getPlist];
NSLog(@"%@",plistDict);
NSString *getPhoto=[plistDict valueForKey:@"Photo"];
UIImageView *bgImgView=[[UIImageView alloc] initWithFrame:CGRectMake(subCatTableView.frame.origin.x, subCatTableView.frame.origin.y, subCatTableView.frame.size.width, subCatTableView.frame.size.height)];
bgImgView.image=[UIImage imageNamed:getPhoto];
bgImgView.alpha=0.5;
subCatTableView.backgroundView=bgImgView;
[plistDict removeObjectForKey:@"Photo"];
sectionArray=[[NSMutableArray alloc] init];
sectionArray =[[[plistDict allKeys]sortedArrayUsingSelector:@selector(compare:)] mutableCopy];
NSLog(@"%@",sectionArray);
subCatArray=[[NSMutableArray alloc] init];
}
#pragma mark Table Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return [sectionArray count];
}
- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
return [sectionArray objectAtIndex:section];
}
- (NSInteger)tableView:(UITableView *)table
numberOfRowsInSection:(NSInteger)section {
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:section]];
return [listData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:[indexPath section]]];
UITableViewCell * cell = [tableView
dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if(cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
/*cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:SimpleTableIdentifier] autorelease];
*/
}
cell.selectionStyle=UITableViewCellSelectionStyleGray;
NSUInteger row = [indexPath row];
cell.textLabel.text = [listData objectAtIndex:row];
return cell;
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:[indexPath section]]];
NSUInteger row = [indexPath row];
NSString *rowValue = [listData objectAtIndex:row];
NSString *message = [[NSString alloc] initWithFormat:rowValue];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"You selected"
message:message delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
//For the view like the easy out and view like small to big
http://stackoverflow.com/questions/8175367/iphone-uiview-animation-resize-in-like-disappear-in-water-and-comes-back-floatin
CGRect originalFrame = scheduleView.frame;
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
CGRect frame = scheduleView.frame;
frame.origin = scheduleView.center;
frame.size = CGSizeMake( 0, 0 );
scheduleView.frame = frame;
} completion:^(BOOL finished) {
// Do something with the view
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
scheduleView.frame = originalFrame;
} completion:^(BOOL finished) {
return;
}];
return;
}];
//For the paypal library
https://www.x.com/developers/paypal/documentation-tools/sdk
//For the multiselection of row
- (void)viewDidLoad {
[super viewDidLoad];
self.arForTable=[NSArray arrayWithObjects:@"Object-One",@"Object-Two",@"Object-Three",@"Object-Four",@"Object-Five", nil];
self.arForIPs=[NSMutableArray array];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.arForTable count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if([self.arForIPs containsObject:indexPath]){
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
} else {
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
cell.textLabel.text=[self.arForTable objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if([self.arForIPs containsObject:indexPath]){
[self.arForIPs removeObject:indexPath];
} else {
[self.arForIPs addObject:indexPath];
}
[tableView reloadData];
}
//For the different source code
http://projectswithlove.com/projects/
http://osx.hyperjeff.net/Reference/CocoaArticles?cat=52
//For the MPMediaItemArtwork
https://github.com/erica/MPMediaItem-Properties
//For the different demos
http://www.vellios.com/downloads/
//Soap parsing Demos
http://www.devx.com/wireless/Article/43209
http://iphonebyradix.blogspot.com/2011/04/working-with-webservices.html
http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
//To generate the random charter unto limit
NSString *chars = @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
NSMutableString *randomString = [NSMutableString stringWithCapacity: string_length];
for (int i=0; i<string_length; i++)
{
[randomString appendFormat:@"%C", [chars characterAtIndex: arc4random()%[chars length]]];
}
//For the writing to the xml file
NSString *fromNumber;
NSString *toNumber;
NSString *msg;
NSString *tempString = @"<?xml version=""1.0"" encoding=""UTF-8""?>";
NSString *strXmlNode = [[NSString alloc] initWithFormat:@"%@<TwilioResponse><SMSMessage><Sid>AP38503af035184c6a8b9cb9b7c70fb2b4</Sid><DateCreated>Wed, 18 Aug 2010 20:01:40 +0000</DateCreated><DateUpdated>Wed, 18 Aug 2010 20:01:40 +0000</DateUpdated><DateSent/><AccountSid>AC696f8df0c9ca45cfb59b073ad5e3ee02</AccountSid>\n""<To>+919904523387</To>\n"
"<From>+%@</From>\n"
"<Body>%@</Body>\n"
"<Status>queued</Status>\n"
"<Direction>outbound-api</Direction>\n"
"<ApiVersion>2010-04-01</ApiVersion>\n"
"<Price/>\n"
"<Uri>/2010-04-01/Accounts/AP38503af035184c6a8b9cb9b7c70fb2b4/SMS/Messages/AC696f8df0c9ca45cfb59b073ad5e3ee02</Uri>\n"
"</SMSMessage>\n"
"</TwilioResponse>",fromNumber,toNumber,msg];
/* NSData *data = [[NSString stringWithString:strXmlNode] dataUsingEncoding:NSUTF8StringEncoding];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataFilePath = [[documentsDirectory stringByAppendingPathComponent:@"Message.xml"] retain];
[data writeToFile: dataFilePath atomically:YES]; */
- (UIColor *) colorWithHexString: (NSString *) hex
{
NSString *cString = [[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6) return [UIColor grayColor];
// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if ([cString length] != 6) return [UIColor grayColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:1.0f];
}
how to use it
[self.view setBackgroundColor: [self colorWithHexString:@"Ff0000"]];
//For the slider to unlock example for slider
altosdesign.com/iphonesdk/SlideToCancel.zip
http://www.altosdesign.com/iphonesdk/SlideToCancel.zip
//For the pop to specific view in iPhone
[self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex: 1] animated: YES];
//For the custom image slider
UIImage *minImage = [UIImage imageNamed:@"grey_track.png"];
UIImage *maxImage = [UIImage imageNamed:@"white_track.png"];
UIImage *tumbImage= [UIImage imageNamed:@"metal_screw.png"];
minImage=[minImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
maxImage=[maxImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
// Setup the FX slider
[maxPriceSlider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[maxPriceSlider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[maxPriceSlider setThumbImage:tumbImage forState:UIControlStateNormal];
//For the sectioned TableView
http://www.mobisoftinfotech.com/blog/iphone/iphone-uitableview-tutorial-grouped-table/
/*<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Photo</key>
<string>mobile.png</string>
<key>Mobile Phones</key>
<array>
<string>GSM Phones</string>
<string>Dual Sim Phones</string>
<string>CDMA Phones</string>
</array>
<key>Smart Phones</key>
<array>
<string>IOS Phones</string>
<string>Android OS Phones</string>
<string>Blackberry Phones</string>
<string>Symbian OS Phones</string>
<string>Tablet Phones</string>
<string>Windows OS Phones</string>
<string>Bada OS Phones</string>
</array>
<key>Mobile Accessories</key>
<array>
<string>Screen Protectors</string>
<string>Memory Card</string>
<string>HeadPhones</string>
<string>CaseMate</string>
<string>Bluetooth Devices</string>
</array>
<key>Landline Phones</key>
<array>
<string>Landline Phones</string>
</array>
</dict>
</plist>
*/
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBarHidden=NO;
self.title=@"Sub Category";
appDel=(AppDelegate *)[[UIApplication sharedApplication]delegate];
NSLog(@"indexValue %@",indexValue);
NSString *getPlist=[[NSBundle mainBundle] pathForResource:indexValue ofType:@"plist"];
NSLog(@"%@",getPlist);
plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:getPlist];
NSLog(@"%@",plistDict);
NSString *getPhoto=[plistDict valueForKey:@"Photo"];
UIImageView *bgImgView=[[UIImageView alloc] initWithFrame:CGRectMake(subCatTableView.frame.origin.x, subCatTableView.frame.origin.y, subCatTableView.frame.size.width, subCatTableView.frame.size.height)];
bgImgView.image=[UIImage imageNamed:getPhoto];
bgImgView.alpha=0.5;
subCatTableView.backgroundView=bgImgView;
[plistDict removeObjectForKey:@"Photo"];
sectionArray=[[NSMutableArray alloc] init];
sectionArray =[[[plistDict allKeys]sortedArrayUsingSelector:@selector(compare:)] mutableCopy];
NSLog(@"%@",sectionArray);
subCatArray=[[NSMutableArray alloc] init];
}
#pragma mark Table Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return [sectionArray count];
}
- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
return [sectionArray objectAtIndex:section];
}
- (NSInteger)tableView:(UITableView *)table
numberOfRowsInSection:(NSInteger)section {
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:section]];
return [listData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:[indexPath section]]];
UITableViewCell * cell = [tableView
dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if(cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
/*cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:SimpleTableIdentifier] autorelease];
*/
}
cell.selectionStyle=UITableViewCellSelectionStyleGray;
NSUInteger row = [indexPath row];
cell.textLabel.text = [listData objectAtIndex:row];
return cell;
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *listData =[plistDict objectForKey:
[sectionArray objectAtIndex:[indexPath section]]];
NSUInteger row = [indexPath row];
NSString *rowValue = [listData objectAtIndex:row];
NSString *message = [[NSString alloc] initWithFormat:rowValue];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"You selected"
message:message delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
//For the view like the easy out and view like small to big
http://stackoverflow.com/questions/8175367/iphone-uiview-animation-resize-in-like-disappear-in-water-and-comes-back-floatin
CGRect originalFrame = scheduleView.frame;
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
CGRect frame = scheduleView.frame;
frame.origin = scheduleView.center;
frame.size = CGSizeMake( 0, 0 );
scheduleView.frame = frame;
} completion:^(BOOL finished) {
// Do something with the view
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
scheduleView.frame = originalFrame;
} completion:^(BOOL finished) {
return;
}];
return;
}];
//For the paypal library
https://www.x.com/developers/paypal/documentation-tools/sdk
//For the multiselection of row
- (void)viewDidLoad {
[super viewDidLoad];
self.arForTable=[NSArray arrayWithObjects:@"Object-One",@"Object-Two",@"Object-Three",@"Object-Four",@"Object-Five", nil];
self.arForIPs=[NSMutableArray array];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.arForTable count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if([self.arForIPs containsObject:indexPath]){
[cell setAccessoryType:UITableViewCellAccessoryCheckmark];
} else {
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
cell.textLabel.text=[self.arForTable objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if([self.arForIPs containsObject:indexPath]){
[self.arForIPs removeObject:indexPath];
} else {
[self.arForIPs addObject:indexPath];
}
[tableView reloadData];
}
//For the different source code
http://projectswithlove.com/projects/
http://osx.hyperjeff.net/Reference/CocoaArticles?cat=52
//For the MPMediaItemArtwork
https://github.com/erica/MPMediaItem-Properties
//For the different demos
http://www.vellios.com/downloads/
//Soap parsing Demos
http://www.devx.com/wireless/Article/43209
http://iphonebyradix.blogspot.com/2011/04/working-with-webservices.html
http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
//To generate the random charter unto limit
NSString *chars = @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
NSMutableString *randomString = [NSMutableString stringWithCapacity: string_length];
for (int i=0; i<string_length; i++)
{
[randomString appendFormat:@"%C", [chars characterAtIndex: arc4random()%[chars length]]];
}
//For the writing to the xml file
NSString *fromNumber;
NSString *toNumber;
NSString *msg;
NSString *tempString = @"<?xml version=""1.0"" encoding=""UTF-8""?>";
NSString *strXmlNode = [[NSString alloc] initWithFormat:@"%@<TwilioResponse><SMSMessage><Sid>AP38503af035184c6a8b9cb9b7c70fb2b4</Sid><DateCreated>Wed, 18 Aug 2010 20:01:40 +0000</DateCreated><DateUpdated>Wed, 18 Aug 2010 20:01:40 +0000</DateUpdated><DateSent/><AccountSid>AC696f8df0c9ca45cfb59b073ad5e3ee02</AccountSid>\n""<To>+919904523387</To>\n"
"<From>+%@</From>\n"
"<Body>%@</Body>\n"
"<Status>queued</Status>\n"
"<Direction>outbound-api</Direction>\n"
"<ApiVersion>2010-04-01</ApiVersion>\n"
"<Price/>\n"
"<Uri>/2010-04-01/Accounts/AP38503af035184c6a8b9cb9b7c70fb2b4/SMS/Messages/AC696f8df0c9ca45cfb59b073ad5e3ee02</Uri>\n"
"</SMSMessage>\n"
"</TwilioResponse>",fromNumber,toNumber,msg];
/* NSData *data = [[NSString stringWithString:strXmlNode] dataUsingEncoding:NSUTF8StringEncoding];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataFilePath = [[documentsDirectory stringByAppendingPathComponent:@"Message.xml"] retain];
[data writeToFile: dataFilePath atomically:YES]; */
Tuesday, 13 December 2011
UrlDemo 5
URLDemo5
//For the CiFaceDetection
http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/
//For the different example
http://iphonecode.weebly.com/second-page.html
//For the paint app reference
http://itunes.apple.com/us/app/xpaint/id388881325?mt=8
http://itunes.apple.com/us/app/doodle-touch/id398904512?mt=8
//For the Enape and MKStoreManager of the app
http://www.sixtemia.com/journal/2009/08/12/using-store-kit-framework/
//For the different snippet of the iphone
http://borkware.com/quickies/everything-by-date
http://jidh.weebly.com/iphone-development.html
//For the UUID in iphone
CFUUIDRef cfuuid = CFUUIDCreate (kCFAllocatorDefault);
NSString *uuid = (NSString *)CFUUIDCreateString (kCFAllocatorDefault, cfuuid);
CFRelease (cfuuid);
NSLog(@"%@",uuid);
//For the paint demo
http://code.google.com/p/paintboardiphone/downloads/list
http://pastebin.com/9dKPHt6R
http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html
//For the checking of network
-(BOOL)checkNetworkConnection{
NSString *connectingString=[[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://google.com"]];
if ([connectingString length]==0) {
NSLog(@"not connected");
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Error" message:@"Network is not available " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
netWork=YES;
}
else {
netWork=NO;
}
[connectingString release];
return netWork;
}
// For the sorting of array into alphabetic order
wordArray = [[wordArray sortedArrayUsingSelector:
@selector(compare:)] mutableCopy];
//For the pdf demos
http://pspdfkit.com/
//For the line drawing and erasing
write it between the touch moved
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.colorView];
//currentPoint.y -= 20;
if (appDelegate.iphoneIpad==1) {
drawPencil.frame=CGRectMake(currentPoint.x+5,currentPoint.y-30,drawPencil.frame.size.width,drawPencil.frame.size.height);
}
else{
drawPencil.frame=CGRectMake(currentPoint.x+10,currentPoint.y-80,drawPencil.frame.size.width,drawPencil.frame.size.height);
}
if (eraseDrawImg==NO) {
//For Drawing of line....
//drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsBeginImageContext(self.colorView.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(),color);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
else{
//For Erasing of Drawn line....
UIGraphicsBeginImageContext(self.colorView.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(),kCGImageAlphaNone); //kCGImageAlphaPremultipliedLast);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1, 0, 0, 10);
CGContextAddArc(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y, eraseSize, 0.0, 2*M_PI, 0);//, 50, 50, 50, 0.0, 2*M_PI, 0);
CGContextClip(UIGraphicsGetCurrentContext());
CGContextClearRect(UIGraphicsGetCurrentContext(),self.colorView.frame);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectMake(lastPoint.x, lastPoint.y, eraseSize,eraseSize));
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
// NSLog(@"%d",imageTag);
NSLog(@"%@",lineArray);
lastPoint = currentPoint;
mouseMoved++;
if (mouseMoved == 10) {
mouseMoved = 0;
}
}
//For the Bluring to imageview
-(UIImage*)imageWithBlurAroundPoint:(CGPoint)point {
CGRect bnds = CGRectZero;
UIImage* copy = nil;
CGContextRef ctxt = nil;
CGImageRef imag = rgbImg.image.CGImage;
CGRect rect = CGRectZero;
CGAffineTransform tran = CGAffineTransformIdentity;
int indx = 0;
rect.size.width = CGImageGetWidth(imag);
rect.size.height = CGImageGetHeight(imag);
bnds = rect;
UIGraphicsBeginImageContext(bnds.size);
ctxt = UIGraphicsGetCurrentContext();
// Cut out a sample out the image
CGRect fillRect = CGRectMake(point.x - 10, point.y - 10, 20, 20);
CGImageRef sampleImageRef = CGImageCreateWithImageInRect(rgbImg.image.CGImage, fillRect);
// Flip the image right side up & draw
CGContextSaveGState(ctxt);
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextTranslateCTM(ctxt, 0.0, -rect.size.height);
CGContextConcatCTM(ctxt, tran);
CGContextDrawImage(UIGraphicsGetCurrentContext(), rect, imag);
// Restore the context so that the coordinate system is restored
CGContextRestoreGState(ctxt);
// Cut out a sample image and redraw it over the source rect
// several times, shifting the opacity and the positioning slightly
// to produce a blurred effect
for (indx = 0; indx < 5; indx++) {
CGRect myRect = CGRectOffset(fillRect, 0.5 * indx, 0.5 * indx);
CGContextSetAlpha(ctxt, 0.2 * indx);
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextDrawImage(ctxt, myRect, sampleImageRef);
}
copy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return copy;
}
//For the soap parsing demo
http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
//For the page curl effect from left to right & vice versa
https://github.com/jemmons/PageCurl
//For the glow of the line
/*float glowWidth = 10.0;
float colorValues[] = { 0, 0, 1, 1.0 };
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef glowColor = CGColorCreate( colorSpace, colorValues );
CGContextSetShadowWithColor( c, CGSizeMake( 0.0, 0.0 ), glowWidth, glowColor );*/
//touch and erase in uiimageview in iphone
http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html
//For the CiFaceDetection
http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/
//For the different example
http://iphonecode.weebly.com/second-page.html
//For the paint app reference
http://itunes.apple.com/us/app/xpaint/id388881325?mt=8
http://itunes.apple.com/us/app/doodle-touch/id398904512?mt=8
//For the Enape and MKStoreManager of the app
http://www.sixtemia.com/journal/2009/08/12/using-store-kit-framework/
//For the different snippet of the iphone
http://borkware.com/quickies/everything-by-date
http://jidh.weebly.com/iphone-development.html
//For the UUID in iphone
CFUUIDRef cfuuid = CFUUIDCreate (kCFAllocatorDefault);
NSString *uuid = (NSString *)CFUUIDCreateString (kCFAllocatorDefault, cfuuid);
CFRelease (cfuuid);
NSLog(@"%@",uuid);
//For the paint demo
http://code.google.com/p/paintboardiphone/downloads/list
http://pastebin.com/9dKPHt6R
http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html
//For the checking of network
-(BOOL)checkNetworkConnection{
NSString *connectingString=[[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://google.com"]];
if ([connectingString length]==0) {
NSLog(@"not connected");
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Error" message:@"Network is not available " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
netWork=YES;
}
else {
netWork=NO;
}
[connectingString release];
return netWork;
}
// For the sorting of array into alphabetic order
wordArray = [[wordArray sortedArrayUsingSelector:
@selector(compare:)] mutableCopy];
//For the pdf demos
http://pspdfkit.com/
//For the line drawing and erasing
write it between the touch moved
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.colorView];
//currentPoint.y -= 20;
if (appDelegate.iphoneIpad==1) {
drawPencil.frame=CGRectMake(currentPoint.x+5,currentPoint.y-30,drawPencil.frame.size.width,drawPencil.frame.size.height);
}
else{
drawPencil.frame=CGRectMake(currentPoint.x+10,currentPoint.y-80,drawPencil.frame.size.width,drawPencil.frame.size.height);
}
if (eraseDrawImg==NO) {
//For Drawing of line....
//drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsBeginImageContext(self.colorView.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(),color);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
else{
//For Erasing of Drawn line....
UIGraphicsBeginImageContext(self.colorView.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(),kCGImageAlphaNone); //kCGImageAlphaPremultipliedLast);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1, 0, 0, 10);
CGContextAddArc(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y, eraseSize, 0.0, 2*M_PI, 0);//, 50, 50, 50, 0.0, 2*M_PI, 0);
CGContextClip(UIGraphicsGetCurrentContext());
CGContextClearRect(UIGraphicsGetCurrentContext(),self.colorView.frame);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectMake(lastPoint.x, lastPoint.y, eraseSize,eraseSize));
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
// NSLog(@"%d",imageTag);
NSLog(@"%@",lineArray);
lastPoint = currentPoint;
mouseMoved++;
if (mouseMoved == 10) {
mouseMoved = 0;
}
}
//For the Bluring to imageview
-(UIImage*)imageWithBlurAroundPoint:(CGPoint)point {
CGRect bnds = CGRectZero;
UIImage* copy = nil;
CGContextRef ctxt = nil;
CGImageRef imag = rgbImg.image.CGImage;
CGRect rect = CGRectZero;
CGAffineTransform tran = CGAffineTransformIdentity;
int indx = 0;
rect.size.width = CGImageGetWidth(imag);
rect.size.height = CGImageGetHeight(imag);
bnds = rect;
UIGraphicsBeginImageContext(bnds.size);
ctxt = UIGraphicsGetCurrentContext();
// Cut out a sample out the image
CGRect fillRect = CGRectMake(point.x - 10, point.y - 10, 20, 20);
CGImageRef sampleImageRef = CGImageCreateWithImageInRect(rgbImg.image.CGImage, fillRect);
// Flip the image right side up & draw
CGContextSaveGState(ctxt);
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextTranslateCTM(ctxt, 0.0, -rect.size.height);
CGContextConcatCTM(ctxt, tran);
CGContextDrawImage(UIGraphicsGetCurrentContext(), rect, imag);
// Restore the context so that the coordinate system is restored
CGContextRestoreGState(ctxt);
// Cut out a sample image and redraw it over the source rect
// several times, shifting the opacity and the positioning slightly
// to produce a blurred effect
for (indx = 0; indx < 5; indx++) {
CGRect myRect = CGRectOffset(fillRect, 0.5 * indx, 0.5 * indx);
CGContextSetAlpha(ctxt, 0.2 * indx);
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextDrawImage(ctxt, myRect, sampleImageRef);
}
copy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return copy;
}
//For the soap parsing demo
http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
//For the page curl effect from left to right & vice versa
https://github.com/jemmons/PageCurl
//For the glow of the line
/*float glowWidth = 10.0;
float colorValues[] = { 0, 0, 1, 1.0 };
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef glowColor = CGColorCreate( colorSpace, colorValues );
CGContextSetShadowWithColor( c, CGSizeMake( 0.0, 0.0 ), glowWidth, glowColor );*/
//touch and erase in uiimageview in iphone
http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html
Subscribe to:
Posts (Atom)