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];
Thursday, April 22, 2010
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”
Monday, March 8, 2010
Earn smile and kcard Magic with new looks is now available on App store
Hi guys
kCard magic is now released with new look. and After new look, in first day downloads is more than 250.


last week earn smile is also released on the app store.

downloads
Friday, February 19, 2010
kTrivia Geography and ithishome released.
hi Guys,
Past 2 weeks great for me. My developed two more applications release on the itune store.
Hope fully by end of this month, we will release two more games on itune store.
Thanks
kTrivia Georaphy

ithishome

Subscribe to:
Posts (Atom)

