我想設置一個入門viewController。在我的appDelegate想創建一個,如果條件檢查NSUserDefaults的一個像這樣:從appDelegate推到viewController monoTouch
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
if (NSUserDefaults.StandardUserDefaults.StringForKey ("LaunchWatcher") != null) {
} else {
}
return true;
}
如果LaunchWatcher不爲空,應該的appDelegate推NewTrackTraceViewController。如果爲null,則傳給TrackTraceViewController。我怎樣才能使用C#做到這一點?什麼是正確的代碼推到視圖控制器?
事情是這樣的:
if (NSUserDefaults.StandardUserDefaults.StringForKey ("LaunchWatcher") != null) {
this.PresentViewController(NewTrackTraceViewController, animated, null);
} else {
this.PresentViewController(TrackTraceViewController, animated, null);
}
這就像一個魅力!歡呼的人。 – 2013-03-20 11:25:05