hey
I found that beginner face problem in my previous post related to the pdf file reading on the iphone / ipad. so I upload a sample application and you can download from here.
PDFReader.zip
please ask feel freely any thing regarding iphone/ipad programming
Thursday, June 3, 2010
Thursday, May 6, 2010
Colored UITabBar / Custom Color to UITabBar
hi friends
there is a simple way to set color of your UITabBar
CGRect frame = CGRectMake(0.0, 0, 320.0, 48);
UIView *v = [[UIView alloc] initWithFrame:frame];
[v setBackgroundColor:[[UIColor alloc] initWithRed:1.0 green:1.0 blue:0.0 alpha:0.6]];
[tabBar insertSubview:v atIndex:0]; //tabBar is object of your UITabBar
there is a simple way to set color of your UITabBar
CGRect frame = CGRectMake(0.0, 0, 320.0, 48);
UIView *v = [[UIView alloc] initWithFrame:frame];
[v setBackgroundColor:[[UIColor alloc] initWithRed:1.0 green:1.0 blue:0.0 alpha:0.6]];
[tabBar insertSubview:v atIndex:0]; //tabBar is object of your UITabBar
Thursday, April 22, 2010
How to show PDF document/file on iphone / ipad.
Hi Guys.
Simple way to show pdf file on UIView. You just use the following class and alloc your UIView with PDFView class.
PDFView.h
#import
@interface PDFView : UIView {
CGPDFDocumentRef pdf1;
int pageNo;
}
-(void)drawInContext:(CGContextRef)context pno:(int)pageNo;
-(int)numberOfPages;
@end
PDFView.m
#import "PDFView.h"
@implementation PDFView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("iphoneos.pdf"), NULL, NULL);
pdf1 = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
self.backgroundColor = [UIColor whiteColor];
self.opaque = YES;
}
return self;
}
- (void)drawRect:(CGRect)rect {
[self drawInContext:UIGraphicsGetCurrentContext()];
}
-(int)incrementPage :(int)no{
pageNo =no;
return pageNo;
}
- (void)dealloc {
[super dealloc];
}
-(void)drawInContext:(CGContextRef)context{
// before we start drawing.
CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
// Grab the first PDF page
CGPDFPageRef page = CGPDFDocumentGetPage(pdf1, pageNo);
// We're about to modify the context CTM to draw the PDF page where we want it, so save the graphics state in case we want to do more drawing
CGContextSaveGState(context);
// CGPDFPageGetDrawingTransform provides an easy way to get the transform for a PDF page. It will scale down to fit, including any
// base rotations necessary to display the PDF page correctly.
CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, self.bounds, 0, true);
// And apply the transform.
CGContextConcatCTM(context, pdfTransform);
// Finally, we draw the page and restore the graphics state for further manipulations!
CGContextDrawPDFPage(context, page);
CGContextRestoreGState(context);
}
//Returns Number of Pages
-(int)numberOfPages{
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("iphoneos.pdf"), NULL, NULL);
pdf1 = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
int noOfPage =CGPDFDocumentGetNumberOfPages((CFURLRef)pdf1);
return noOfPage;
}
@end
And your Viewcontroller class, just implement the following code
UIView *myView=[[PDFView alloc]initWithFrame:rect];
int totalpage = [myView numberOfPages];
[myView drawRect:CGRectMake(0, 0, rect.size.width, rect.size.height)];
[self.view addSubView:myView];
Simple way to show pdf file on UIView. You just use the following class and alloc your UIView with PDFView class.
PDFView.h
#import
@interface PDFView : UIView {
CGPDFDocumentRef pdf1;
int pageNo;
}
-(void)drawInContext:(CGContextRef)context pno:(int)pageNo;
-(int)numberOfPages;
@end
PDFView.m
#import "PDFView.h"
@implementation PDFView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("iphoneos.pdf"), NULL, NULL);
pdf1 = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
self.backgroundColor = [UIColor whiteColor];
self.opaque = YES;
}
return self;
}
- (void)drawRect:(CGRect)rect {
[self drawInContext:UIGraphicsGetCurrentContext()];
}
-(int)incrementPage :(int)no{
pageNo =no;
return pageNo;
}
- (void)dealloc {
[super dealloc];
}
-(void)drawInContext:(CGContextRef)context{
// before we start drawing.
CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
// Grab the first PDF page
CGPDFPageRef page = CGPDFDocumentGetPage(pdf1, pageNo);
// We're about to modify the context CTM to draw the PDF page where we want it, so save the graphics state in case we want to do more drawing
CGContextSaveGState(context);
// CGPDFPageGetDrawingTransform provides an easy way to get the transform for a PDF page. It will scale down to fit, including any
// base rotations necessary to display the PDF page correctly.
CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, self.bounds, 0, true);
// And apply the transform.
CGContextConcatCTM(context, pdfTransform);
// Finally, we draw the page and restore the graphics state for further manipulations!
CGContextDrawPDFPage(context, page);
CGContextRestoreGState(context);
}
//Returns Number of Pages
-(int)numberOfPages{
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("iphoneos.pdf"), NULL, NULL);
pdf1 = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
int noOfPage =CGPDFDocumentGetNumberOfPages((CFURLRef)pdf1);
return noOfPage;
}
@end
And your Viewcontroller class, just implement the following code
UIView *myView=[[PDFView alloc]initWithFrame:rect];
int totalpage = [myView numberOfPages];
[myView drawRect:CGRectMake(0, 0, rect.size.width, rect.size.height)];
[self.view addSubView:myView];
Monday, April 5, 2010
Transparent Background on iPhone UIWebView
Simple solution to creating a UIWebView with a transparent background:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 310,450)]; self.bounds.size.height-60)];
[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];
[self.view addSubview:webView];
cheers
- set your background color of the UIWebView to clear
- set the css for the body to background-color: transparent
- here's the bugger... set the opaque property of the UIWebView to NO
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 310,450)]; self.bounds.size.height-60)];
[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];
[self.view addSubview:webView];
cheers
Japji Sahib on iphone
Past week, i upload new application on the app store. Japji Sahib reader.


http://itunes.apple.com/in/app/japji-sahib-punjabi/id364602780?mt=8

http://itunes.apple.com/in/app/japji-sahib-punjabi/id364602780?mt=8
Monday, March 22, 2010
Last Week another release on itunes
Last friday, me and amit did release the you and me 'nought & cross' on the itunes stores.

As amit came in team, the speed of development should accelerate.


Wednesday, March 17, 2010
How to get Iphone device id for Provisioning.
First Way
1) Connect your iPhone/iPod Touch to your computer if it isn’t already connected
2) Launch iTunes
3) Click on the text “Serial Number:” in the “iPhone” section of the Summary tab.
4) The serial number will be replaced with the Identifier.
5) And U will get the 40 digit Identifier.
Second Way
1) Install the iPhone Configuration Utility if it is not already installed. [http://www.apple.com/support/iphone/enterprise/]
2) Connect your iPhone/iPod Touch to your computer if it isn’t already connected
3) Launch the iPhone Configuration Utility
4) If your iPhone/iPod Touch is not automatically selected – click on it’s entry at the bottom of the left-hand column
5) At the top of the screen, click on the “Export” button
6) In the save dialog box that opens, change the “Export type:” to “Device UDIDs”
Subscribe to:
Posts (Atom)