开发者

UIBarButtonItem Not Visible in QLPreviewController Toolbar

开发者 https://www.devze.com 2023-02-20 08:26 出处:网络
I have a subclass of QLPreviewController that I\'m pushing into a UINavigationController.I am able to show/hide the bottom toolbar using:

I have a subclass of QLPreviewController that I'm pushing into a UINavigationController. I am able to show/hide the bottom toolbar using:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.toolbarHidden = NO;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationController.toolbarHidden = YES;
}

But items I'm adding to the toolbar aren't showing up:

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIBarButtonItem *testButtonItem = [[U开发者_StackOverflow社区IBarButtonItem alloc] initWithTitle:@"Test"
                                                                       style:UIBarButtonItemStylePlain
                                                                      target:self
                                                                      action:@selector(testButtonClicked:)];

    NSArray *myToolbarItems = [NSArray arrayWithObjects:testButtonItem, nil];
    self.toolbarItems       = myToolbarItems;
    [testButtonItem release];
}

Any advice would be very appreciated. Thanks.


Where are you allocating and initializing that view that is giving you the problem?

Are you using a splitViewController on iPad?

From the sound of it an object is sticking around for longer than necessary or when being called back it is not being re allocated and initialized properly before attempting to put it back on the stack, if you are using a splitViewController on iPad it handles it's views differently than a simple UINavigationController on an iPhone.

0

精彩评论

暂无评论...
验证码 换一张
取 消