This question already has an answer here:
Mask UIView Touch Detect [closed]
(1 answer)
Closed 9 years ago.
I have Masked UIView . View with blue dots. Green circle Area is masked off.I dont want to get touches on that area.i just want to get touches on visible layer of the View.
Please select touch view in your touch method in place of self.view
May be it helps
Try creating a CGPath of the masked area & then check if the touch falls in ur masked area or not like this :
UIBezierPath *p = [UIBezierPath bezierPathWithCGPath:myCGPath];
BOOL isInPath = [p containsPoint:myCGPoint];
Hope this Helps !!!
Related
This question already has answers here:
Attempting to mask a circle around an image not working
(2 answers)
Closed 2 years ago.
I want to make the label's backround full circle.
i searched and find out
numLabel.layer.masksToBounds = true
numLabel.layer.cornerRadius = numLabel.bounds.width / 2
on iphone it is fine
on ipad, firsttime it is just a corner radius rectangle, when i move tableview up and down, in anotherwords, cell view gets out of the main view and gets back in, it becomes a fine circle.
i wonder, what is the mistake i am doing ?
edit : numLabel is inside TableViewCell / TableViewController / NavigationController / splitViewController
and it has its own tableViewCell class. and that code is run From layoutsubviews()
numlabel width and height is equal by contraints
you should never call layoutSubViews directly
override layoutSubViews, don't forget to call super and then put your code there.
This question already has an answer here:
Changing View size using user touch input
(1 answer)
Closed 7 years ago.
I am creating an app where user touch the screen and places a rectangle view on screen which he can move or resize by touching its corners like any other crop view . I have done this functionality but i want eight handlers on the sides of that rectangle so that user can use that handlers to resize it. Now i am unable to create such functionality . I tried to add eight buttons as subview on that rectangle view but when resizing when that view increase its size than all eight buttons just change their positions . can anybody help me with this functionality ?
Thanks in advance
Hi i got the answer from here . here is a great class for making resizable view. Great work by the developer
Create resizable view in ios with UITouch
To do this you are going the right way about it.
You need to create a custom view that positions these eight handles depending on the size of the view. When the view changes size you then need to reassess where those handles are so maybe have a function thats called when the view is resized and in here you change the location of each handle just by changing its x and y origin depending on the view size.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to draw a rounded rectangle in Core Graphics / Quartz 2D?
I want to draw a rounded rectangle programmatically for my overlaying UIView,
how would I approach this?
NSBezierPath has a special +bezierPathWithRoundedRect:xRadius:yRadius:, check the documentation.
NSBezierPath *path =
[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(...)
xRadius:3.0f
yRadius:3.0f];
[path fill];
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How to set this Layout in iPhone need Some help
I draw image in imageview.
I have one image view and Button is there.
When i draw something it show like this,
I dont wan't to show drawing on that button.
How can i do that?
There are 2 approaches:
1) You can do this IB:
Drag your UIImageView in IB to bottom of your stack subviews of view where your UIView (where you are drawing) is placed.
2) You can do this in code:
Push your view on the top of views using following method
- (void)bringSubviewToFront:(UIView *)view
For example:
UILabel * labelgreen;
[labelgreen.superview bringSubviewToFront:labelgreen];
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
UIView with rounded corners
Round two corners in UIView
I'm aware of means for rounding all four corners of a UIView, but how could I round only the bottom corners of a view?
To achieve this, you need to use CALayer masking. This question Just two rounded corners? and the accepted answer should get you started. If you run in to trouble, then you should take a look at this follow-up post: Round two corners in UIView
You can draw in one CALayer filled rectangle with bottom rounded corners and than set it as mask to your:
[[view layer] setMask:calayerWithDrawedMaskingRect];