How to move resizableUIView from its corner in Swift? - ios

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.

Related

Setting background of view to an image that is able to pinch zoom

I have created a game where a map is on the screen. With this map I would like to have buttons to change scenes and preform actions. The map I have on the screen I would like to be the full screen with pinch zoom capability, along with capability of a button or label to be on top of the image, without the button being zoomed in on or below the scroll view. I tried using a UIScroll View but the button kept zooming in and going below the image. How can I set the background of my View to a pinch zoomable image with labels and buttons on top not being effected in swift and xcode 7?
I am not sure if this is the most efficient way, but by calling the method touchesDidBegin() you can move the objects like the TextField and the buttons to a new view that is above the scrollview. Then when touchesDidEnd() you can move them back into the scrollview.

create custom button animation

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).

Registering button clicks on image bounds only

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

Make image view in iOS table view cell clickable

I have a dynamic table view in iOS 6. The table view cells have the subtitle style and show an image, a title and a subtitle.
The table view is inside a navigation controller, and in the navigation bar I have a bar button item which allows you to reset the progress information shown in the subtitle of the cell and in the image shown in the cell (grey image when progress is 0%, orange when bigger than 0%, green when 100%, the actual percentage is shown in the subtitle).
When the user presses the reset button, the image is replaced by a special image (a rounded arrow) which, when pressed, would allow the user to reset the progress and start the exercise from scratch.
The trouble is the image view in a cell is clickable but I cannot distinguish between a click in the image and a click in the text part of the cell (title+subtitle).
How can I do this? I'd better subclass and add a button, which is clickable?
Another consideration is that maybe the round arrow that resets should be an accessory view and appear on the right?
I would just use UIButton and add a custom background image. That should work, as you mentioned.

iOS : How to create a close button that sits on the edge of a UIView with rounded corners (using IB)?

Background:
I am working on an iPad app that will pop a custom view when the user clicks on an image.
I want the view to have rounded corners and a close button ( red x in a circle ) that sits on right top edge.
The button in half inside and half outside the view.... Take a look at the Kayak or Zynga Poker apps to see what I am talking about.
Question : If I create the view programmatically and add the button, it works.
However, I really want to user a nib to create the view so I can design the view correctly. So when I call self.layer.maskToBounds = YES on the view ( to create the rounded corners with a radius of 25 ), it clips my button ( since its half in and half out ). How do I retain my button without it getting clipped and still have rounded corners ?
Sounds to me like you are using a view and a button. What you might try is using a third container view (with clear background) in which you place your original view and your button. The button will need to be on top of the view, so to speak, so it is not obscured by your view. But that should allow you to have properly rounded corners on your view (not the container view) and have your button fully visible.
Some settings, such as maskToBounds, cornerRadius, aren't available in IB. You can create the entire view using a NIB except it won't have rounded corners in IB and in viewDidLoad you set just those properties that couldn't be set in IB.

Resources