ヘッダー ファイル: SettingsVC.h ViewController.h
実装ファイル: SettingsVC.m ViewController.m
ViewController.m では、上部にあるこのコード行を使用して SettingsVC.h をインポートしました
「SettingsVC.h」をインポートして、別のビューからステッパーから値を取得できるようにします。
SettingsVC.h には、IBOutlet UIStepper *mainStepper; というコード行があります。
ステッパーに割り当てられます。
このmainStepper.valueを実行してViewController.mからステッパーの値にアクセスしようとすると、機能しませんが、Settings.mで機能します助けてくれてありがとう。
バイキングの新要素
設定VC.hファイル
#import <UIKit/UIKit.h>
@interface SettingsVC : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate> {
IBOutlet UILabel *mainTimeShow;
IBOutlet UILabel *armTimeShow;
IBOutlet UILabel *defuseTimeShow;
IBOutlet UIStepper *armStepper;
IBOutlet UIStepper *defuseStepper;
IBOutlet UIStepper *mainStepper;
}
-(IBAction)goToClock;
@property (nonatomic, retain) UIStepper *mainStepper;
-(IBAction)mainTimeStepper;
-(IBAction)armTimeStepper;
-(IBAction)defuseTimeStepper;
@end
設定VC.mファイル
#import "SettingsVC.h"
@interface SettingsVC ()
@end
@implementation SettingsVC
@synthesize mainStepper;
@end
ViewController.m ファイル
#import "ViewController.h"
#import "SettingsVC.h"
@interface ViewController ()
@end
@implementation ViewController
-(void)here {
SettingsVC.mainStepper.value; //Property mainStepper not found on object of type 'SettingsVC'
}
@end