Fügen Sie einer UITabBar einen UIButton als Unteransicht hinzu

Ich versuche, eine versteckbare UITabBar in meiner App zu implementieren. Ich habe alle Animationen erstellt und sie funktionieren sehr gut. Ich habe nur ein Problem damit, dass mein UIButton "Pull-Tab" die Tab-Leiste anzeigt. Es reagiert nicht auf das Berührungsereignis UIControlEventTouchUpInside. Ich füge den Pull-Tab der UITabBar im UITabBarController hinzu:

- (void)viewDidLoad
{
    [super viewDidLoad];
//Add pull
    pullButton = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *image = [UIImage imageNamed:@"TabBarPull.png"];
    pullButton.frame = CGRectMake(self.tabBar.frame.size.width - image.size.width, -image.size.height + 3, image.size.width, image.size.height);
    [pullButton setImage:image forState:UIControlStateNormal];
    [pullButton addTarget:self action:@selector(pullBarTapped:) forControlEvents:UIControlEventTouchUpInside];
    pullButton.userInteractionEnabled = YES;
    [self.tabBar addSubview:pullButton];
}

So sieht die Tab-Leiste offen und geschlossen aus:

Bearbeiten: Ich habe festgestellt, dass das Problem darin besteht, dass die Schaltfläche außerhalb des Rahmens von UITabBar liegt. Sieht so aus, als müsste ich den Knopf außerhalb der UITabBar platzieren ... Animations-Albtraum.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage