Skip to content

Instantly share code, notes, and snippets.

@hunk
Created February 21, 2012 21:21
Show Gist options
  • Save hunk/1879040 to your computer and use it in GitHub Desktop.
Save hunk/1879040 to your computer and use it in GitHub Desktop.
//
// ViewController.m
// sale
//
// Created by Edgar Garcia on 2/21/12.
// Copyright (c) 2012 E. All rights reserved.
//
#import "ViewController.h"
@implementation ViewController
@synthesize carousel;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect f;
f.size.height = 200;
f.size.width = 200;
f.origin.x = 10;
f.origin.y = 10;
carousel = [[UIViewCarousel alloc] initWithFrame:f];
carousel.backgroundColor = [UIColor whiteColor];
carousel.dataSource = self;
[self.view addSubview:carousel];
// Do any additional setup after loading the view, typically from a nib.
}
- (int)numberOfViewsInViewCarousel:(UIViewCarousel *)viewCarousel{
NSLog(@"dede");
return 4;
}
- (UIView *)viewCarousel:(UIViewCarousel *)viewCarousel viewAtIndex:(int)index {
UIView *view = [viewCarousel dequeueReuseableViewWithClass:[UIView class]];
NSLog(@"dededee");
if (view == nil) {
view = [[[UIView alloc] init] autorelease];
}
//view.titleLabel.text = @"some text";
view.backgroundColor = [UIColor redColor];
return view;
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
@end
//
// ViewController.h
// sale
//
// Created by Edgar Garcia on 2/21/12.
// Copyright (c) 2012 E. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIViewCarousel.h"
@interface ViewController : UIViewController<UIViewCarouselDataSource>{
UIViewCarousel *carousel;
}
@property (nonatomic, retain) UIViewCarousel *carousel;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment