중간 크기의 스토리 보드가있는 앱이 있는데, 너무 복잡하여 너무 복잡하지 않습니다.두 개의 스토리 보드 지원
이 스토리 보드를 복사하고 색 구성표를 변경하고 사용자가 사용할 색 구성표를 선택하게하고 싶습니다.
제 질문은 : 시작할 때 기본적으로 어떤 스토리 보드를 사용할 것인지 프로그래밍 방식으로 선택할 수 있습니까? 그렇다면 어떻게해야합니까?
내가 다소 관련 질문을 보았다 : Storyboards Orientation Support in Xcode 4.5 and iOS 6.x ?
내가 확장 방법을 만들어 그 코드를 기반으로 :
static bool IsStoryboardLoading {get;set;}
public static T ConsiderSwitchingStoryboard<T> (this UIViewController from) where T: UIViewController
{
if (!IsStoryboardLoading && LocalStorage.Instance.IsWhiteScheme && false) {
try {
IsStoryboardLoading = true;
UIStoryboard storyboard = UIStoryboard.FromName ("MainStoryboard_WHITE", NSBundle.MainBundle);
T whiteView = storyboard.InstantiateViewController (typeof(T).Name) as T;
from.PresentViewController (whiteView, false, null);
return whiteView;
} finally {
IsStoryboardLoading = false;
}
}
return null;
}
}
다음 내가 ViewDidAppear
재정에서 사용 :
public override void ViewDidAppear (bool animated)
{
this.ConsiderSwitchingStoryboard<MyViewController>();
}
을 이 코드는 경우에 따라 작동하지만 다른 경우에는 push
부분을 수행 할 때 오류가 발생합니다.
NSGenericException Reason: Could not find a navigation controller for segue 'segSearchResults'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_IntPtr (intptr,intptr,intptr,intptr)
스토리 보드는이 크기를 두 배로 의미, 이미 충분히 바쁘다 (당신이 내 매개 변수를 확인할 수 있음). 게다가 같은 문제가있는 위 코드와 동일한 코드를 사용해야합니다. 정말이 제안의 이점은 없습니다. –
왜 코드에서 색상을 변경할 수 없습니까? UIAppearrance를 사용하면 스토리 보드에서 변경하는 것보다 훨씬 더 나은 후보가 될 수 있습니다. – jonathanpeppers
필자는 필자의 메인 스토리 보드를 빌드시 변경된 색상을 가진 두 번째 스토리 보드로 변환하기 위해 XSD를 작성하고 변경해야하는 각 항목에 대한 코드를 작성하지 않아도됩니다. –