2 개의보기가 있습니다. 1) ViewController 및 2) ViewController2. 첫 번째 뷰 컨트롤러에서 세그먼트 컨트롤러를 실행할 때 이름이 변경된다는 일부 lablels가 있습니다. 내가하고 싶은 것은 (Viewcontroller2)에서 레이블이있는 곳에서 세그먼트 화 된 컨트롤러가 0 또는 1 인 것을 기반으로 텍스트를 변경할 수 있기를 원합니다. 여기에 제가 가진 것이 있습니다. m 개의 파일에서 다음 세그먼트 제어 - 다른보기에서 레이블 텍스트 변경
// ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
IBOutlet UISegmentedControl *Lang;
IBOutlet UIButton *Run;
IBOutlet UILabel *bet;
}
-(IBAction)ChangeLang:(id)sender;
@end
는 내가이 잘 실행
// ViewController.m
#import "ViewController.h"
#import "ViewController2.h"
@interface ViewController()
@end
@implementation ViewController
-(IBAction)ChangeLang :(id)sender {
if (Lang.selectedSegmentIndex==0)
{
[email protected]"Apple";
[email protected]"Banana";
//not sure here what code to put in order to make the label in viewcontroller2 change.
}
if (Lang.selectedSegmentIndex==1) {
[email protected]"ORANGES";
[email protected]"FRUITS";
//not sure here what code to put in order to make the label in viewcontroller2 change.
}
}
데이터를 ... 변경 다음 한을 heres 나는 M에서의 ViewController 2
// Viewcontroller2.h
#import <UIKit/UIKit.h>
@interface ViewController2 : UIViewController
IBOutlet UILabel *Nextword;
@end
이 무엇인지 컨트롤러 난 그냥이있어
#import "ViewController2.h"
#import "ViewController.h"
@interface ViewController2()
@end
분할 된 컨트롤러를 실행하면 어떻게 ViewController2에서 uilabel 텍스트가 변경됩니까? 누구든지 도와 줄 수 있습니까? 화면이 자동으로 viewcontroller로 이동하는 것을 원하지 않습니다. 그렇게 할 수있었습니다. 내가 텍스트를 변경하려면, 그리고 내가 거기에 가서 슬쩍, 나는 세그먼트 컨트롤러를 기반으로 if 진술에 따라 Viewcontroller2의 텍스트 싶습니다.
는