0
試圖將默認值傳遞給ViewController對象的實例。代碼編譯時沒有警告,我逐步查看了值,但是,當應用程序啓動UI上的值回到零時。就好像我創建了兩個不同的實例,但是對於我來說,無法確定爲什麼初始化值不是啓動的應用程序的一部分。這裏是實現和main.m代碼。任何幫助表示讚賞。UI不顯示來自初始化程序的值
#import "AppDelegate.h"
#import <UIKit/UIKit.h>
#import "ViewController.h"
int main(int argc, char *argv[]) {
//NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {
ViewController *viewController;
viewController = [[ViewController alloc]initWithBinauralFrequencyLeft:82.4
binauralFreqRight:82.4
octaveValue:1
baseScaleSetting:82.4
binauralBaseVolume:800
globalBaseSongCount:0];
int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
//[pool release];
return retVal;
}
}
-(id)initWithBinauralFrequencyLeft:(double)binauralFreqL
binauralFreqRight:(double)binauralFreqR
octaveValue:(double)octaveVal
baseScaleSetting:(double)baseScaleSet
binauralBaseVolume:(int)binauralVolume
globalBaseSongCount:(int)globalSongCount;
{
self = [super init];
if (self){
[self setBinauralFreqL:82.4];
[self setBinauralFreqR:82.4];
[self setOctaveVal:1];
[self setBaseScaleSet:82.4];
[self setBinauralVolume:800];
[self setGlobalSongCount:0];
}
return self;
}
-(id)init
{
return [self initWithBinauralFrequencyLeft:82.4 binauralFreqRight:82.4 octaveValue:1 baseScaleSetting:82.4 binauralBaseVolume:800 globalBaseSongCount:0];
}
好的。我認爲這可能是一個序列的事情。我將研究AppDelegate方法。謝謝! – Mickey