I am trying to implement a button that transitions to another view. The button works when the view is expanded but not when the view is collapsed. Why is this happening?
Note: The same button is in both pictures but the attributes (color, target) only seem to get applied when the view is expanded.
Not clickable
Clickable
I solved this by removing the leading bottom constraint in storyboard. Working as intended.
Related
I am thinking of implementing a UISegmentControl extension to achieve the twitter's iOS notification tab bar, navigation bar segment style. I tried extending the class like in this post.
I want to be able to control the size of the underline that scales based on the text's width, just like in the app.
Any ideas or suggestions are appreciated.
Yes
Have a top row section:
Icon | Notifications | Settings Icon
Then a bottom row:
All | Mentions
You make a container for each section in the bottom row that takes 50% of the width of the row and then have a block inside each section for the text. The width of block should only be as wide as the text so that when you add a bottom border to it, it only spans as far as the text goes
You can create your custom Top Bar.
Add two views each containing your label with text, below that label add a view whose leading and trailing constraint from label. add both of these views in Stack View and fill equally. For tap you can use TapGesture or UIButton.
Use collection view for dynamic tabs.
UIPageViewController below for different screens.
I have attached a screen i designed for reference
XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers. Pan gestures can be used to move on to the next or previous view controller. It shows an interactive indicator of the current, previous, next child view controllers.
https://github.com/xmartlabs/XLPagerTabStrip
I have a stackview that I am using as a dropdown menu by changing the spacing to collapse and expand the stack view.
There are buttons inside the stack view of the same size. When the spacing is negative they appear on top of each other. I set the layer zIndex to determine which button I want to show on top.
I was hoping this zIndex would also determine which button receives the tap notification but instead the last button in the stack view always receives the tap.
How can I make sure the visible button (with highest zIndex) is receiving the tap?
Is there a better way for me to implement a collapsible menu of buttons?
Best regards
If you are using stackview and want to show/hide the button conditionally, then while hiding button, also write:
stackView.removeArrangedSubview(buttonInstance)
buttonInstance.removeFromSuperview()
Instrad of buttonInstance.removeFromSuperview(), also try buttonInstance.isHidden = true
Here's my setup: I have a ViewController that contains an image(button). This button takes the user to another viewController using an #IBAction func (tab controller tab). However, I also want a scrollView on the initial ViewController, just under the image button.
What I'm trying to achieve is the ability to scroll content on top of the image button as if it were another page on top of the image button. As the user scroll back down, the image button is revealed underneath the scrollView and is clickable again.
I can't seem to find a solution anywhere online. My scrollView is either fixed below the image button, or covers the image button rendering it unclickable.
Here's a screenshot
take a look at the demo project i set up:
https://github.com/slotti85/ButtonAndScrollView
i...
put the scrollview all over the screen (also over the button),
set up a contentInset to make the button visible initially,
subclassed UIScrollView and
overrode the pointInside function to make the scrollview forward a touch if the "transparent area" is tapped.
hope it helps!
I have an UITableView in a ordinary View controller with the Top-bar visible on an iPhone.
However, as per the screenshot below, the first cell in the table view is behind the Top-bar. How can I make it appear under the Top-bar while on the iPad, which doesn't use the navigation controller, and doesn't have the Top-bar it appears at the top?
if you use storyboards there is a nice option on the right (see screenshot). it is called extend edges - under top bars. if you clear the checkbox, your problem should be solved.
I'm making an app with a picker view, and when a button is pressed, the picker view pops up, and when another button is pressed, it disappears. In the storyboard, the picker view covers the bottom half of the screen, including two buttons, but when I run the simulator, the buttons and other objects that are on the screen (such as labels and text fields) get shifted to seemingly random places, including the objects that are not covered by the picker view. What exactly is the problem, and how do I fix it?
Go to the story board, select that particular view controller on which you have placed the picker view and open document outline window(which appear on the left side of story board). After that you will get the list of components present on that view. Drag the labels and the buttons to the bottom of the picker view. By doing this you will get the labels and the buttons on the top of the picker view and add the constraints to the components.
Another reason might be that you have selected other model at the bottom and ran on other model.
Just set the constraints it will solve the problems. And delete suggested constraints.