iPad:在splitview的详细视图中使用tabbar

时间:2011-09-15 15:18:46

标签: ipad uisplitviewcontroller tabbar popover

我正在使用splitview模板开发我的第一个iPad应用程序,这一切看起来都很不错。我在我的splitview的detailview中添加了一个tabbar,我用tabbar加载的每个控制器都实现了协议SubstitutableDetailViewController,除了未显示的portait模式的popover按钮外,它都可以工作。我做错了什么?

viewcontroller1.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

0 个答案:

没有答案