言語選択オプションのsegmentedControlである次のコードがあります。ケース0は英語用で、ケース1はギリシャ語用で、その後に渡されますUITextView
。問題は、ケース1または0のボタンを押すたびに、テーブルビューコントローラーである前のビューコントローラーに戻り、正しい言語を表示するために「detailViewController」に戻る必要があることです。ビューコントローラ間を行ったり来たりせずにこれを行う方法はありますか?小さなアニメーションや、の更新または再読み込みメソッドのようなものUITextView
。
int a;
- (IBAction)languageSeg:(id)sender {
switch (((UISegmentedControl *)sender).selectedSegmentIndex) {
case 0:
a=0;
break;
case 1:
a=1;
break;
default:
break;
}
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
UIImage *saladImage = [UIImage imageNamed:@"salad.jpg"];
UIImage *fishImage = [UIImage imageNamed:@"fish.jpg"];
[textDetail setScrollEnabled:YES];
[textDetail setContentSize:CGSizeMake(320, 190)];
//Switch the UIImages and UILabel based on item
switch (itemNumber) {
case 0:
itemName.text = @"Salad";
itemPic.image = saladImage;
self.title = @"Salads";
if (a==0){
textDetail.text = @"description in english";
}
if (a==1){
textDetail.text = @"description in greek";
}
break;
case 1:
// etc.