This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void doExit() { | |
| AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this); | |
| ab.setMessage("Are you sure you want to exit?") | |
| .setPositiveButton("Yes", dialogClickListener) | |
| .setNegativeButton("No", dialogClickListener).show(); | |
| } | |
| private DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { | |
| @Override | |
| public void onClick(DialogInterface dialog, int which) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize { | |
| //UIGraphicsBeginImageContext(newSize); | |
| UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0); | |
| [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return newImage; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage*) drawText:(NSString*)text inImage:(UIImage*)bgImage atPoint:(CGPoint)point withSize:(CGFloat)size withColor:(UIColor*) color { | |
| UIGraphicsBeginImageContextWithOptions(bgImage.size, FALSE, 0.0); | |
| [bgImage drawInRect:CGRectMake( 0, 0, bgImage.size.width, bgImage.size.height)]; | |
| UIFont *font = [UIFont boldSystemFontOfSize:size]; | |
| CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(ctx, color.CGColor); | |
| [text drawAtPoint:point withFont:font]; | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [UIFont boldSystemFontOfSize:17.0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage*) drawImage:(UIImage*) fgImage inImage:(UIImage*) bgImage atPoint:(CGPoint) point { | |
| UIGraphicsBeginImageContextWithOptions(bgImage.size, FALSE, 0.0); | |
| [bgImage drawInRect:CGRectMake( 0, 0, bgImage.size.width, bgImage.size.height)]; | |
| [fgImage drawInRect:CGRectMake( point.x, point.y, fgImage.size.width, fgImage.size.height)]; | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return newImage; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSString *url = @"http://www.developerfeed.com/search.jsp?params=Java Developer"; | |
| NSString* encodedUrl = [url stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding]; | |
| NSLog(@"Encoded URL %@",encodedUrl); | |
| // output will be | |
| //http://www.developerfeed.com/search.jsp?params=Java%20Developer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSString *string1 = @"This is"; | |
| NSString *string2 = @" a test."; | |
| NSString *string3 = [string1 stringByAppendingString:string2]; | |
| // string3 is now @"This is a test." string1 and string2 are unchanged. | |
| //You can also assign the new string back to string1: | |
| NSString *string1 = @"This is"; | |
| NSString *string2 = @" a test."; | |
| string1 = [string1 stringByAppendingString:string2]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| button.titleLabel.textAlignment = NSTextAlignmentCenter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSArray *items = [dataDictionary objectForKey:@"items"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [self.tableView reloadData]; |