I need to create custom button with animation. When user touches button it fills with blue shape from left to right (I have done this with CAShapeLayer and CABasicAnimation). But also while shape fills button I need to change button text color (only letters that shape already reached, from left to right).
Related
I have a Ubutton with a title and down arrow. On clicking the button, I open a menu and arrow should transform to the upside and when closing the menu the arrow should transform to the downside. When applying CGAffinetransform to ImageView in the UIbutton, the text is also transforming with some scale which I never applied. Button title changes when selected a menu item and the title will be centered to the view along with the arrow.
So, How can I apply the transformation to arrow only?Is there a way to apply or remove transform for title.
I had tried
self.button.imageview.transform = self.button.imageview.transform.rotated(by: 180 * CGFloat(Double.pi/180))
The arrow image on button should rotate based on menu open and close. That rotation has to happen in animation
enter image description here
I have created this screen using four rounded button on corners. and i need to resize view from all four button tapped event. on the button direction
This is what i need to do.
I want to create a login screen similar to facebook's for my iOS app.
How do I create 2 text-fields that are both in that rounded box?
Embed two textfields in a UIView and give that view the layer.cornerRadius that you need
Giving UIView rounded corners
add 2 UITextfields and set their borders to none
add background image having rounded corner from top left and top right to the 1st uitextfield i.e. username uitextfield
add background image having rounded corner from bottom left and bottom right to the 2nd uitextfield i.e. password uitextfield
add a bordered layer (CALayer), set layer properties like, borderwidth, borderColor and frame as per your requirement and add this layer to uitextfield layer.
I am making an iPhone application that uses hexagon images for button shapes. I add UIButtons to the View and then set the buttons images to be the hexagon image.
My buttons will be layed out like a beehive structure - as per the attached image. If all buttons are in a single row there is no issue.
But when you begin to add multiple rows of buttons, there will be an overlap of buttons - as can be seen by the blue highlighted areas on the attached image.
The dashed lines represent the underlying UIButton shape.
My question is how do I handle these overlapping areas?
For instance, if I add button 3 first to the view and then 1, 2, 4 & 5 in that order to the View, button 3 will only have a very small space for the user to click on to select it as the other buttons will overlap it and have "z-index" presedence (to use a CSS term).
Or the user can click on button 3, but they might click on the top left hand corner of it which will trigger button 1 clicked as an Action.
Alternatively, is there a way to create custom button shapes in Xcode? I can create a button in code but its either a square or a rectangle.
EDIT: I have seen HERE and HERE that allows you to only registers button clicks on button images where the Alpha != 0 but the issue is still that the Alpha for button 1 will overlap button 3 and therefore not register button 3 clicks in the overlapping areas?
Try this Link
https://github.com/ole/OBShapedButton
It gives out a Lib for having buttons sense touch as per its assigned Images
I have some buttons close to each other in a logo shape, they are non rectangular shapes and I was wondering if I can exclude the transparent parts of the button from receiving touches, so that the elements behind it can receive the touches instead?.
Can you make the alpha parts of the button image not part of the button? , or , if the user touches these alpha parts, the button below will be tapped?
You would normally have to subclass UIButton, but luckily someone has taken care of this for you already:
https://github.com/ole/OBShapedButton
This seems to be exactly what you're looking for.