iphone - How to add center button to UITabBar and hide it when tab bar is hidden in iOS SDK? -
I am working on a custom tab bar. I added the button in the middle of the tab bar using the following code:
button = [with the UI button button: Type: UIButtonTypeRoundedRect]; Button.frame = CGRectMake (0,0,50,50); [Button setbackground image: [UIImage imageNamed: @ "uploader_disabled.png"] forState: UIControlStateNormal]; [Button setbackground image: [UIImage imageNamed: @ "uploader_enabled.png"] forState: UIControlStateHighlighted]; [Button addTarget: Self-Proceeding: @Selector (Open ActionSheet) Control Events: UIContolEventTouchUpInside]; CGFloat elevation = button.frame.height.height - self.tabBar.frame.size.height; If (height preference <0) {button.center = self.tabBar.center; NSLog (@ "heightDifference"); } Other {nslog (@ "height not height"); CGPoint Center = self.tabBar.center; Center.y = center.y - AltitudeFIFF / 2.0; button. Center = center; } [Self.view addSubview: button]; Now when I hide the tab bar, this button is not being hidden. It is visible in all view controllers.
I would appreciate your help in solving this problem.
You are adding a button to self.view . You should advertise on this tabbar [self.tabbar addSubview: button];
Comments
Post a Comment