我正在使用 splitview 模板开发我的第一个 iPad 应用程序,一切似乎都很好。我在拆分视图的详细视图中添加了一个标签栏,我使用标签栏加载的每个控制器都实现了协议 SubstitutableDetailViewController,除了未显示的肖像模式下的弹出按钮之外,它都可以工作。我做错了什么?
视图控制器1.h
@interface CentriAttivitaViewController : UIViewController <SubstitutableDetailViewController> {
UIToolbar *toolbar;
UILabel *titolo;
}@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
@property (nonatomic, retain) IBOutlet UILabel *titolo;
@end
`
和 viewcontroller1.m
@synthesize toolbar, titolo;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidUnload {
[self setTitolo:nil];
[super viewDidUnload];
self.toolbar = nil;
}
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
// Add the popover button to the toolbar.
NSMutableArray *itemsArray = [toolbar.items mutableCopy];
[itemsArray insertObject:barButtonItem atIndex:0];
[toolbar setItems:itemsArray animated:NO];
[itemsArray release];
}
- (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
// Remove the popover button from the toolbar.
NSMutableArray *itemsArray = [toolbar.items mutableCopy];
[itemsArray removeObject:barButtonItem];
[toolbar setItems:itemsArray animated:NO];
[itemsArray release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)dealloc {
[toolbar release];
[titolo release];
[super dealloc];
}
-(void)viewDidLoad{
self.titolo.text = @"Qualità";
[super viewDidLoad];
}
@end