Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Programmingling

macrumors newbie
Original poster
Jun 21, 2010
2
0
Here's the problem, with making a CGRect it just shows up as a rectangle and if I put a circular image inside it, or any oddly shaped image inside it and I want to click the image, the user can still just click in the square area of the cgrect instead of actually clicking the image.

How do I either make it so that the image itself has to be clicked or the imageview is hugged onto the image so it's not a rectangle anymore?

Also what does CG stand for anyway? :D
 
CG stands for CoreGraphics. I am struggling to understand exactly what you are trying to do. All views are rectangular. There is no way round that. If you have an image with transparency (not that all images are also rectangular) and you want the non-transparent section to not be touchable I suspect you are going to have to subclass UIImageView and implement your own hit-test unless there is an obvious, documented method that you should be using.
 
oh I'm sorry I probably did make this a bit more confusing than it should have been. The idea is

let's say I have an image of a circle. I put it in a rectangular imageview box. How do I make it so that only the circle can be touchable and not the rest of the space inside the rectangle. I think you may have understood what I meant but I just want to check back with you.


edit: yeah now that I read back and understood your post I think we're on the same page here. Can you say that again in a different wording? ( i meant the part where you say subclass and hit test stuff, i don't get what you mean ).
 
i meant the part where you say subclass and hit test stuff, i don't get what you mean

No, not really. That is the only way to say it. If you don't understand subclass you need to stop programming and go learn the basics of Object-Oriented Programming.

Given that UIView has a method with the word hittest in the name I suggest you also learn to use the documentation.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.