asd

//

//  PXLViewController.m

//  mytest

//

//  Created by CloudPOS_user002 on 2014/02/27.

//  Copyright (c) 2014 tptest. All rights reserved.

//


#import "PXLViewController.h"

#import "ReflectionView.h"

#import "PXLInputAudioViewController.h"

#import "PXLInputTextViewController.h"

#import "PXLInputPictureViewController.h"

#import "PXLDrawViewController.h"

#import "PXLDiyViewController.h"

#import "PXLMaterialListViewController.h"

#import "Consts.h"

#import "PXLDbMaterialObjects.h"

#import "PXLUtils.h"

#import "PXLDbOperation.h"

#import "PXLMagBookViewController.h"


@interface PXLViewController()


@end


@implementation PXLViewController


@synthesize leftCarousel;

@synthesize rightCarousel;



- (BOOL) shouldAutorotateToInterfaceOrientation:

(UIInterfaceOrientation)toInterfaceOrientation {

    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);

}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait;

}



- (void)viewDidLoad

{

    CGRect rect = [[UIScreen mainScreen] bounds];

    CGSize size = rect.size;

    CGFloat width = size.width;

    CGFloat height = size.height;

    

    [Consts sharedInstance].screenWidth = width;

    [Consts sharedInstance].screenHeight = height;

    [Consts sharedInstance].screenScalc = height / 480.0;

    

    [super viewDidLoad];

    

    float topheight = [Consts sharedInstance].screenHeight - 82 - 10 - 177;

    

    self.view.backgroundColor = [UIColor blackColor];

    

    leftArray = [[NSArray alloc] init];

    rightArray = [[NSArray alloc] init];

    

    

    leftCarousel = [[iCarousel alloc] initWithFrame:CGRectMake(0, 0, 160, 177)];

leftCarousel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    leftCarousel.type = iCarouselTypeRotary;

leftCarousel.delegate = self;

leftCarousel.dataSource = self;

    

    

    rightCarousel = [[iCarousel alloc] initWithFrame:CGRectMake(0, 0, 160, 177)];

rightCarousel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    rightCarousel.type = iCarouselTypeRotary;

rightCarousel.delegate = self;

rightCarousel.dataSource = self;

    

    

    //

    

    //

    UIView *top = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, topheight)];

    UIImageView *toolbar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 75)];

    toolbar.image = [UIImage imageNamed:@"bg3"];

    

    //top.backgroundColor = [UIColor grayColor];

    UIButton *cam = [UIButton buttonWithType:UIButtonTypeCustom];

    UIButton *diy = [UIButton buttonWithType:UIButtonTypeCustom];

    

    cam.frame = CGRectMake(170, 1, 73, 73);

    diy.frame = CGRectMake(245, 1, 73, 73);

    

    [cam setImage:[UIImage imageNamed:@"icon1"] forState:UIControlStateNormal];

    [diy setImage:[UIImage imageNamed:@"icon2"] forState:UIControlStateNormal];


    diy.tag = 4000;

    [diy addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchDown];

    

    toolbar.userInteractionEnabled = YES;

    top.userInteractionEnabled = YES;

    

    [toolbar addSubview:cam];

    [toolbar addSubview:diy];

    

    UIImageView *topBottom = [[UIImageView alloc] initWithFrame:CGRectMake(0, topheight - 29, 320, 29)];

    

    topBottom.image = [UIImage imageNamed:@"chubanwu"];

    

    [top addSubview:topBottom];

    [top addSubview:toolbar];

    

    

    UIImageView *left = [[UIImageView alloc] initWithFrame:CGRectMake(0, topheight, 160, 177)];

    UIImageView *right = [[UIImageView alloc] initWithFrame:CGRectMake(160, topheight, 160, 177)];

    

    left.image = [UIImage imageNamed:@"fen"];

    right.image = [UIImage imageNamed:@"lan"];

    

    [left addSubview:leftCarousel];

    [right addSubview:rightCarousel];

    

    UIImageView *bottom = [[UIImageView alloc] initWithFrame:CGRectMake(0, [Consts sharedInstance].screenHeight - 82, 320, 82)];

    bottom.image = [UIImage imageNamed:@"bgme"];

    

    UIButton *me = [UIButton buttonWithType:UIButtonTypeCustom];

    

    float r = 70;

    me.frame = CGRectMake((320 - r) / 2.0f, 0, r, r);

    [bottom addSubview:me];

    me.tag = 4001;

    [me addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchDown];

    

    bottom.userInteractionEnabled = YES;

    

    [self.view addSubview:top];

    [self.view addSubview:left];

    [self.view addSubview:right];

    [self.view addSubview:bottom];

   

}


- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


- (void)viewDidUnload

{

    [super viewDidUnload];

    leftCarousel = nil;

    rightCarousel = nil;

}


- (void)dealloc

{

    leftCarousel.delegate = nil;

    leftCarousel.dataSource = nil;

    rightCarousel.delegate = nil;

    rightCarousel.dataSource = nil;

    

}



-(NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel

{

    return [leftArray count];

}


- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(ReflectionView *)view

{


    return view;

}


- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform

{

    transform = CATransform3DRotate(transform, M_PI / 8.0f, 0.0f, 1.0f, 0.0f);

    return CATransform3DTranslate(transform, 0.0f, 0.0f, offset * carousel.itemWidth);

}


-(IBAction)btnclick :(id)inSender {

    

    UIButton *btn = (UIButton *) inSender;

    if (btn.tag == 4000) {

        PXLDiyViewController *controller = [[[PXLDiyViewController alloc] init] autorelease];

        //controller.flashDelegate = self;

        [self presentModalViewController:controller animated:YES];

    } else  if (btn.tag == 4001) {

        NSLog(@"-----");

        

    }

}


- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value

{

    //customize carousel display

    switch (option)

    {

        case iCarouselOptionWrap:

        {

            //normally you would hard-code this to YES or NO

            return YES;

        }

        case iCarouselOptionSpacing:

        {

            //add a bit of spacing between the item views

            return value * 1.05f;

        }

        case iCarouselOptionFadeMax:

        {

            if (carousel.type == iCarouselTypeCustom)

            {

                //set opacity based on distance from camera

                return 0.0f;

            }

            return value;

        }

        default:

        {

            return value;

        }

    }

}


-(void) carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index

{

    

}


@end


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值