UISplitView
üzerinde çok fazla araştırma yaptım ve Ana ve Detay'ın değişen bir görünümü olduğunda Bölünmüş Görünüm'ü denetlemenin bir yolunu bulamadı.Tekli bir konumdaki UISplitViewController temsilci
Daha sonra onu temsilci olan bir singleton sınıfı ile yönetmenin bir yolunu buldum.
Sorunum, doğru yol olup olmadığından emin değilim. reusability
ve memory managment
hakkında endişeliyim. Ayrıca, Apple’da delege yapmak için Apple’ın yönergeleri olduğunu düşünüyorum.
Bu
I (ve aslında çalışıyor) ne var:// SharedSplitViewDelegate.h
/* In the detail view controllers:
// in the initial detail view controller
- (void)awakeFromNib
{
[super awakeFromNib];
// needs to be here, otherwise if it's booted in portrait the button is not set
self.splitViewController.delegate = [SharedSplitViewDelegate initSharedSplitViewDelegate];
}
// shared between all detail view controllers
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
SharedSplitViewDelegate *rotationHandler = [SharedSplitViewDelegate initSharedSplitViewDelegate];
[self.toolbar setItems:[rotationHandler processButtonArray:self.toolbar.items] animated:YES];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface SharedSplitViewDelegate : NSObject <UISplitViewControllerDelegate>
+ (id)initSharedSplitViewDelegate; // returns the singleton class instance
- (NSArray *)processButtonArray:(NSArray *)array; // Adds and removes the button from the toolbar array. Returns the modified array.
@end
Şimdi uygulaması:
Bu kod kullanabilir ve o yaşayabilir bulur herkes için değiştirmek serbesttir onların projesi :).
StackOverflow'a (hesabım olmadan birkaç ay beklediğim halde) yeniyim, böylece her eleştiri sıcak karşılanır.