0

Draw a circle,make a rounded UIImageView in it.How to get this, please guide me. thx!

MR.King
  • 3
  • 1
  • It's not clear to me. You want a ImageView like this? http://www.interiordesign.net/photo/348/348655-Theater_in_the_Round.jpg – Damitha Raveendra Apr 23 '12 at 04:45
  • yes,and the circle's border is white color. – MR.King Apr 23 '12 at 04:51
  • Is the circle radius always fixed?. – Damitha Raveendra Apr 23 '12 at 04:55
  • yes,circle radius always fixed,but in circle,imageview maybe change – MR.King Apr 23 '12 at 04:56
  • This may not work for you but worth a try. 1. Create two ImageViews. 2. One for your image which you wanna display. 3. Over the previous ImageView another one with an image of a white circle border, adding transparency only to the area which you wanna display your previous image. Hope this will help. Tell me if it is not clear. – Damitha Raveendra Apr 23 '12 at 05:10
  • if display imageview larger than white circle border one.how can i display it.two imageview's rect is the same? – MR.King Apr 23 '12 at 05:15
  • The one with the white circle should be an ImageView size of the screen so that your displaying image won't be visible other than the circle. Clear enough?. – Damitha Raveendra Apr 23 '12 at 05:23
  • Here is an example made for you ImageView 2: http://img21.imageshack.us/img21/3431/test2sn.png Final Image: http://imageshack.us/f/580/testjkn.png/ – Damitha Raveendra Apr 23 '12 at 05:40

1 Answers1

0

Let's put it this way,

  • First we create a UIImageView to the size of the circle you want.Let's say you want this image to be a circular image,

http://united4iran.org/wp-content/uploads/2010/11/cell-phone-in-canada.jpg

  • Then you create another UIImageView one top of the previous one to the size of 320x480 and set this image to it (Assume this image size is 320x480),

Note: also remember that inner area of the circle in above image is transparent.

  • Then you should get a image like this,

http://img580.imageshack.us/img580/782/testjkn.png

Hope this will help you.

Damitha Raveendra
  • 1,721
  • 17
  • 24
  • thanks a lot first!but it unuseful for me.below the display imageview also has a imageview,outer area of circle imageview must transparent.So display imageview full rect visible.Do you know about context? – MR.King Apr 23 '12 at 10:55
  • Try this one, http://stackoverflow.com/questions/996292/how-to-mask-a-square-image-into-an-image-with-round-corners-in-the-iphone-sdk – Damitha Raveendra Apr 23 '12 at 11:00
  • finally,i decide that use context to cut the image and above it put a circle imageview.thankyou for guide me. – MR.King Apr 24 '12 at 08:00