Saturday, 2 June 2012

urldemo 12

//For the pushing a subview in UIView
 CATransition *transition = [CATransition animation];
        transition.duration = 0.75;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype =kCATransitionFromRight;
        transition.delegate = self;
        adminView.frame=CGRectMake(0, 0, 322, 748);
        [self.view.layer addAnimation:transition forKey:nil];


//For the paging and scrollview photo gallery in iPhone
- (void)setupDisplayFiltering{
   
    NSArray *subview = [[mainScrollView subviews] copy];
    for (UIView *subview1 in subview) {
        [subview1 removeFromSuperview];
    }
    [subview release];
    
     mainScrollView.delegate = self;
   
    [mainScrollView setBackgroundColor:[UIColor clearColor]];
    [mainScrollView setCanCancelContentTouches:NO];
   
    mainScrollView.clipsToBounds = YES;
    mainScrollView.scrollEnabled = YES;
    mainScrollView.pagingEnabled = YES;
   
    CGFloat cx = 20;
    CGFloat cy = 10;
    CGFloat width=110;
    CGFloat height=110;
    int cnt=1;
    
    int scWidth=0;
   
    int row=0;
    int column=0;
   
    for (int i=0;i<[mainCatImgArray count];i++) {
       
        UIImage *image = [mainCatImgArray objectAtIndex:i];
        UIImageView *tempImg=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"viewBg.png"]];
        CGRect rect = tempImg.frame;
        rect.size.height =  height;
        rect.size.width = width;
        rect.origin.x = cx;
        rect.origin.y = cy;
        tempImg.frame = rect;
        [mainScrollView addSubview:tempImg];
        [tempImg release];
     
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        rect = imageView.frame;
        rect.size.height = height-30;
        rect.size.width = width-10;
        rect.origin.x = cx+5;
        rect.origin.y = cy+5;
        imageView.userInteractionEnabled=YES;
        imageView.frame = rect;
        imageView.tag=i+1;
       
        UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollImgTap:)];
        [tapRecognizer setNumberOfTapsRequired:1];
        [tapRecognizer setDelegate:self];
       
        [imageView addGestureRecognizer:tapRecognizer];
        UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
        longPressGesture.minimumPressDuration=0.2f;
        [imageView addGestureRecognizer:longPressGesture];
        [longPressGesture release];
       
        [mainScrollView addSubview:imageView];
       
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [btn setImage:[UIImage imageNamed:@"close_x.png"] forState:UIControlStateNormal];
        rect.size.height = 40;
        rect.size.width = 40;
        rect.origin.x = cx;
        rect.origin.y = cy+5;
        btn.userInteractionEnabled=YES;
        btn.frame = rect;
        btn.tag=i+1;
        [btn addTarget:self action:@selector(removeImageView:) forControlEvents:UIControlEventTouchUpInside];
       //  btn.hidden=YES;
        [mainScrollView addSubview:btn];   
       
       
        UILabel *tempIbl=[[UILabel alloc] initWithFrame:CGRectMake(cx,height+cy-20,width,25)];
        tempIbl.text=[NSString stringWithFormat:@"%d",imageView.tag];
        tempIbl.backgroundColor=[UIColor whiteColor];   
       
        tempIbl.textColor = [UIColor blackColor];
        tempIbl.textAlignment = UITextAlignmentCenter;
        tempIbl.font = [UIFont fontWithName:@"Arial" size:20.0f];
        tempIbl.lineBreakMode=UILineBreakModeMiddleTruncation;
        [mainScrollView addSubview:tempIbl];
       
        [imageView release];
        [tempIbl release];
        [btn release];
       
        if (column<=5) {
            column+=1;
            cx += tempImg.frame.size.width+20;
            NSLog(@"column %d",column);
            if (column>=5){
                column=0;
                cx=scWidth+20;
                cy+=tempImg.frame.size.height+15;
                row+=1;
                NSLog(@"row %d",row);
                if (row>=5) {
                    scWidth=683*cnt;
                    cx=scWidth+20;
                    cy=10;
                    row=0;
                     cnt+=1;
                }
              
            }
        }
    }
   
    pageControl.currentPage = 0;
    pageControl.numberOfPages=cnt;
    [mainScrollView setContentSize:CGSizeMake(683*cnt, [mainScrollView bounds].size.height)];
}
- (IBAction)changePage {
    // update the scroll view to the appropriate page
    CGRect frame;
    frame.origin.x = mainScrollView.frame.size.width * pageControl.currentPage;
    frame.origin.y = 0;
    frame.size = mainScrollView.frame.size;
    [mainScrollView scrollRectToVisible:frame animated:YES];
}
- (void)scrollViewDidScroll:(UIScrollView *)sender {
    // Update the page when more than 50% of the previous/next page is visible
    CGFloat pageWidth = mainScrollView.frame.size.width;
    int page = floor((mainScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    pageControl.currentPage = page;
    currentPageLbl.text=[NSString stringWithFormat:@"%d",page];
}


//For the printing of image view or image in iPhone
 - (IBAction)printContent  {
        // Obtain the shared UIPrintInteractionController
        UIPrintInteractionController *controller1 = [UIPrintInteractionController sharedPrintController];
        if(!controller1){
            NSLog(@"Couldn't get shared UIPrintInteractionController!");
            return;
        }
       
        // We need a completion handler block for printing.
        UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
            if(completed && error)
                NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code);
        };
       
        // Obtain a printInfo so that we can set our printing defaults.
        UIPrintInfo *printInfo = [UIPrintInfo printInfo];
        UIImage *image = [UIImage imageNamed:@"mainimage1.jpg"];
       
        // This application prints photos. UIKit will pick a paper size and print
        // quality appropriate for this content type.
        printInfo.outputType = UIPrintInfoOutputPhoto;
        // The path to the image may or may not be a good name for our print job
        // but that's all we've got.
        printInfo.jobName = [[imageURL path] lastPathComponent];
       
        // If we are performing drawing of our image for printing we will print
        // landscape photos in a landscape orientation.
        if(!controller1.printingItem && image.size.width > image.size.height)
            printInfo.orientation = UIPrintInfoOrientationLandscape;
       
        // Use this printInfo for this print job.
        controller1.printInfo = printInfo;
       
        //  Since the code below relies on printingItem being zero if it hasn't
        //  already been set, this code sets it to nil.
        controller1.printingItem = nil;
       
       
#if DIRECT_SUBMISSION
        // Use the URL of the image asset.
        if(imageURL && [UIPrintInteractionController canPrintURL:imageURL])
            controller1.printingItem = imageURL;
#endif
       
        // If we aren't doing direct submission of the image or for some reason we don't
        // have an ALAsset or URL for our image, we'll draw it instead.
        if(!controller1.printingItem){
            // Create an instance of our PrintPhotoPageRenderer class for use as the
            // printPageRenderer for the print job.
            PrintPhotoPageRenderer *pageRenderer = [[PrintPhotoPageRenderer alloc]init];
            // The PrintPhotoPageRenderer subclass needs the image to draw. If we were taking
            // this path we use the original image and not the fullScreenImage we obtained from
            // the ALAssetRepresentation.
            pageRenderer.imageToPrint = image;
            controller1.printPageRenderer = pageRenderer;
            [pageRenderer release];
        }
       
        // The method we use presenting the printing UI depends on the type of
        // UI idiom that is currently executing. Once we invoke one of these methods
        // to present the printing UI, our application's direct involvement in printing
        // is complete. Our delegate methods (if any) and page renderer methods (if any)
        // are invoked by UIKit.
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            //[controller presentFromBarButtonItem:self.printButton animated:YES completionHandler:completionHandler];  // iPad
        }else
            [controller1 presentAnimated:YES completionHandler:completionHandler];  // iPhone
       
    }

//For the reflecting image in iPhone
https://github.com/ipalmer/CKReflectionImage

//For the Custom Progressbar in iPhone
https://github.com/appdesignvault/ADVProgressBar

//For the Different Theme for Scrolling tableview in iPhone
https://github.com/applidium/ADLivelyTableView

//For setting the tab bar background image in iPhone
http://blog.theanalogguy.be/2011/09/14/custom-colored-uitabbar-icons-an-update/

 UIImage *tabBackground = [[UIImage imageNamed:@"tab_bg"]
                              resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [[UITabBar appearance] setBackgroundImage:tabBackground];
    [[UITabBar appearance] setSelectionIndicatorImage:
     [UIImage imageNamed:@"tab_select_indicator"]];
https://github.com/NOUSguide/NGTabBarController

//For different kind of demo for iPhone

http://cocoacontrols.com/controls?page=2&platform_id=ios&sort=date

http://www.ogokilearning.com/native-language-app-code/

http://esramkumar.wordpress.com/tutorial-projects/

http://www.scoop.it/t/iphone-and-ipad-development?page=2

//For the pull to refresh of tableview in iPhone
https://github.com/enormego/EGOTableViewPullRefresh

//For the different kind of photo view and video  viewer in iPhone and also useful for Paint in iPhone
https://github.com/BradLarson/GPUImage

//For the continuous Tableview in iPhone
https://github.com/stephenjames/ContinuousTableview

//For the Different kind of Api for iPhone
http://www.subfurther.com/blog/category/speaking/page/3/


//For the Calendar Demo in iPhone
https://github.com/klazuka/Kal
http://developinginthedark.com/posts/iphone-tapku-calendar-markers

//For Top Tabbar in iphone
https://github.com/hollance/MHTabBarController
https://github.com/jasonmorrissey/JMTabView

//For the Custome AlertView and ActionSheet in iPhone
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets

//For the Delete like the iPhone application.
https://github.com/heikomaass/HMLauncherView

No comments:

Post a Comment