我想製作一個按鈕,將圖像向上移動一幀高度,如果再次按下該按鈕,則將圖像移回一幀高度。製作一個移動圖像的按鈕
http://imageshack.us/photo/my-images/140/72197925.png/ (溶液的插圖)
我嘗試使用盡可能少的代碼越好。
UIImage *image = [UIImage imageNamed:@"01bear.png"];
imageView = [[UIImageView alloc] initWithImage:image];
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:applicationFrame];
scrollView.contentSize = CGSizeMake(5760, 1);
[scrollView addSubview:imageView];
[window addSubview:scrollView];
[window makeKeyAndVisible];
scrollView.delegate = self;
scrollView.pagingEnabled = YES;