アプリがフォアグラウンドに入ったときにビュー コントローラーのラベルを変更したい....:
SalaryAppV4AppDelegate.h
@interface SalaryAppV4AppDelegate : NSObject {
//----------------------------------------------
NSTimeInterval appEnteredBackground;
NSTimeInterval appEnteredForeground;
NSTimeInterval difference;
NSString *times;
//-----------------------------------------------------
SalaryAppV4AppDelegate.m
- (void)applicationWillEnterForeground:(UIApplication *)アプリケーション
{
//perform -(IBAction)DoThis
FirstViewController* controller = [FirstViewController alloc];
[controller DoThis];
//releasing
[dateFormatter release];
}
//------------------------------------------------ ----------------------
FirstViewController.h
import UIKit/UIKit.h > import "SalaryAppV4AppDelegate.h"
@interface FirstViewController : UIViewController {
IBOutlet UITextField *text1;
IBOutlet UILabel *label;
IBOutlet UILabel *labeltotal;
IBOutlet UILabel *differenceLabel;
int i;
float number1;
NSTimer *timer;
SalaryAppV4AppDelegate *appDelegate;
}
//行動
-(IBAction)リセット:(id)送信者;
-(IBAction)backgroundTouched:(id)送信者;
-(IBAction) beginTimer;
-(無効) DoThis;
//プロパティ
@終わり
//------------------------------------------------ --------------------
FirstViewController.m
-(IBAction) DoThis {
appDelegate = [[[UIApplication sharedApplication] delegate] retain];
//This Doesn't Work :(
label.text = @"IT Has Worked";
//This Works
NSLog(@"%@", appDelegate.times);
}
//------------------------------------------------ --------
私はちょうどlabel.text tiを何かに変更したいだけですが、viewcontrollerの変更は何もしません...