私は別のモジュールで構成されたアプリを開発中です。 開始ページから、それらの異なるモジュールにナビゲートすることができます。サブビューから前のビューに戻す方法
1つは画像ピッカーの一種で、いくつかの画像サムネイルをボタンとして表示します。
このサムネイルをクリックすると、ボタンでもある画像全体がサブビューに表示されます。
サムネイルビューに戻るには、画像(ボタン)をもう一度クリックするだけで済みます。
問題は、常に私が別のモジュールの中から選択できる開始ページに戻ることです。ここで
あなたは私のViewControllerに実装を見つける:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
int counter;
int x = 30;
int y = 10;
for (counter = 1; counter < 9 ; counter++) {
UIButton *imageButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
CGRect rect = CGRectMake(x, y, 307, 230);
imageButton.frame = rect;
[imageButton addTarget:self action:@selector(showImage:) forControlEvents:UIControlEventTouchUpInside];
[imageButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"tn%i.jpg",counter]] forState:UIControlStateNormal];
imageButton.tag = counter;
[self.view addSubview:imageButton];
x = x + 327;
if (counter == 3){
x = 30;
y = 260;
}
if (counter ==6){
x = 30;
y = 510;
}
}
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(void)showImage:(id)sender
{
int imageCounter = [sender tag];
UIButton *imageLarge = [UIButton buttonWithType:UIButtonTypeRoundedRect];
CGRect largeRect = CGRectMake(0,0, 1024, 768);
imageLarge.frame = largeRect;
[imageLarge addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
[imageLarge setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%i.jpg",imageCounter]] forState:UIControlStateNormal];
imageLarge.tag = imageCounter;
[self.view addSubview:imageLarge];
}
-(void)back:(id)sender
{
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view.superview cache:YES];
[self.view setHidden:YES];
[UIView commitAnimations];
}
私はここで何をしないのですか?
あなたのタグを編集して、使用している言語を追加できますか?また、より関連性の高いタグが特定の技術に利用可能な場合もあります。 「ボタン」はあなたがここで何をしているのかを説明するのに最適なタグではありません。ありがとう。 – Will