我无法更改值或更改声明的任何变量或对象。任何人都可以看到有什么问题吗?
在我的应用委托方法中。
- (void)applicationDidEnterBackground:(UIApplication *)application
{
MainPage *mp = [[MainPage alloc]init];
mp.newTime = [[NSDate date] timeIntervalSinceDate:mp.date];
[mp.timer invalidate];
mp.switchT = 1;
mp.playBarButton.enabled = YES;
mp.pauseBarButton.enabled = NO;
mp.stopBarButton.enabled = YES;
[mp.avPlayer pause];
}
以上这些操作均未执行。在我的mainpage.h
文件中,我声明如下:
@property (nonatomic, retain) AVAudioPlayer *avPlayer;
@property (strong, retain) NSTimer *timer;
@property (strong, retain) NSDate *date;
@property (nonatomic) NSTimeInterval newTime;
@property (nonatomic) NSInteger switchT;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *playBarButton;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *pauseBarButton;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *stopBarButton;
当然,在我的实现文件中,这些都是综合的,并且mainpage.m
在我的 appDelegate 文件中没有与我的代码一起工作。任何人都可以看到问题吗?请注意,这是一个功能齐全的应用程序,一切正常,只是无法在我的 applicationDidEnterBackground 方法中执行以下代码,我假设这是我的属性的制作方式?我在应用程序委托中编写的代码也没有错误。