Costume doll:
Wardrobe:
Costume doll change:
The code:
//
// iPhoneCDoll3ViewController.h
// iPhoneCDoll3
//
// Created by Monika Denk on 26.04.11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface iPhoneCDoll3ViewController : UIViewController <UIScrollViewDelegate> {
IBOutlet UIView *home;
IBOutlet UIView *costumedoll1;
IBOutlet UIView *costumedoll2;
IBOutlet UIView *costumedoll3;
IBOutlet UIView *wardrobe1;
IBOutlet UIView *wardrobe1a;
IBOutlet UIView *wardrobe2;
IBOutlet UIView *detail1;
IBOutlet UIView *detail1a;
IBOutlet UIView *detail2;
IBOutlet UIView *detail2a;
IBOutlet UIView *detail3;
IBOutlet UIView *detail3a;
UIPageControl *pageControl;
UIScrollView *scroller;
UIScrollView *scroller2;
UIPageControl *pageControl2;
UIScrollView *scroller3;
UIPageControl *pageControl3;
IBOutlet UIScrollView *scrollerW1;
IBOutlet UIScrollView *scrollerW1a;
IBOutlet UIScrollView *scrollerW2;
}
-(IBAction) showcostumedoll1;
-(IBAction) showcostumdoll2;
-(IBAction) showcostumdoll3;
-(IBAction) showwardrobe1;
-(IBAction) showwardrobe2;
-(IBAction) gohome;
-(IBAction) gocostumedoll1;
-(IBAction) closeshowDetail1;
-(IBAction) closeshowDetail1a;
-(IBAction) closeshowDetail3;
-(IBAction) wardrobewechel1;
@property (nonatomic, retain) IBOutlet UIPageControl *pageControl;
@property (nonatomic, retain) IBOutlet UIScrollView *scroller;
@property (nonatomic, retain) IBOutlet UIPageControl *pageControl2;
@property (nonatomic, retain) IBOutlet UIScrollView *scroller2;
@property (nonatomic, retain) IBOutlet UIPageControl *pageControl3;
@property (nonatomic, retain) IBOutlet UIScrollView *scroller3;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollerW1;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollerW1a;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollerW2;
@end
//
// iPhoneCDoll3ViewController.m
// iPhoneCDoll3
//
// Created by Monika Denk on 26.04.11.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import "iPhoneCDoll3ViewController.h"
@implementation iPhoneCDoll3ViewController
@synthesize pageControl, scroller;
@synthesize pageControl2, scroller2;
@synthesize pageControl3, scroller3;
@synthesize scrollerW1;
@synthesize scrollerW1a;
@synthesize scrollerW2;
-(void) scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
int page = scrollView.contentOffset.x / scrollView.frame.size.width;
pageControl.currentPage = page;
pageControl2.currentPage = page;
pageControl3.currentPage = page;
}
-(IBAction) showcostumedoll1 {
[home addSubview:costumedoll1];
}
-(IBAction) showwardrobe1 {
[costumedoll1 addSubview:wardrobe1];
}
-(IBAction) showwardrobe2 {
[costumedoll2 addSubview:wardrobe2];
}
-(IBAction) showcostumdoll2 {
[wardrobe1 addSubview:costumedoll2];
}
-(IBAction) showcostumdoll3 {
[wardrobe2 addSubview:costumedoll3];
}
-(IBAction) wardrobewechel1 {
[wardrobe1 addSubview:wardrobe1a];
}
-(IBAction) gohome {
[costumedoll1 removeFromSuperview];
}
-(IBAction) gocostumedoll1 {
[wardrobe1 removeFromSuperview];
}
-(IBAction) closeshowDetail1
{
[detail1 removeFromSuperview];
detail2.hidden=NO;
}
-(IBAction) closeshowDetail1a;
{
[detail1a removeFromSuperview];
detail2a.hidden=NO;
}
-(IBAction) closeshowDetail3;
{
[detail3 removeFromSuperview];
detail3a.hidden=NO;
}
//- (void) anzeigen: (id) sender; {
//}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
for (int i = 2; i < 4; i++) {
UIImageView *imagen = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]]];
UIImageView *imagen2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]]];
UIImageView *imagen3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]]];
imagen.frame = CGRectMake((i-1)* 319, 0, 319, 420);
imagen2.frame = CGRectMake((i-1)* 319, 0, 319, 420);
imagen3.frame = CGRectMake((i-1)* 319, 0, 319, 420);
[scroller addSubview: imagen];
[scroller2 addSubview: imagen2];
[scroller3 addSubview: imagen3];
[imagen release];
}
scroller.delegate= self;
scroller.contentSize = CGSizeMake(321*3, 422);
scroller2.delegate= self;
scroller2.contentSize = CGSizeMake(321*3, 422);
scroller3.delegate= self;
scroller3.contentSize = CGSizeMake(321*3, 422);
scrollerW1.contentSize = CGSizeMake(1630, 320);
scrollerW1.showsHorizontalScrollIndicator = NO;
scrollerW1a.contentSize = CGSizeMake(1630, 320);
scrollerW1a.showsHorizontalScrollIndicator = NO;
scrollerW2.contentSize = CGSizeMake(1610, 320);
scrollerW2.showsHorizontalScrollIndicator = NO;
scroller.pagingEnabled = YES;
scroller.showsHorizontalScrollIndicator = NO;
pageControl.numberOfPages=3;
pageControl.currentPage=0;
scroller2.pagingEnabled = YES;
scroller2.showsHorizontalScrollIndicator = NO;
pageControl2.numberOfPages=3;
pageControl2.currentPage=0;
scroller3.pagingEnabled = YES;
scroller3.showsHorizontalScrollIndicator = NO;
pageControl3.numberOfPages=3;
pageControl3.currentPage=0;
}
- (BOOL)touchesShouldCancelInContentView:detail1 {
return NO;
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
[scrollerW1 release];
[scrollerW1a release];
[scrollerW1a release];
}
@end
No comments:
Post a Comment