How to make UIImage rounded,Not rounded corner - uiimageview

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

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.

Related

NSImageView rending a blurry NSimage despite it being of the same size

I have an NSCollectionViewItem with an NSImageView (32x32) to which i supply a #1x image of the same size.
It looks perfect in the interface builder, but when the app is built, the resolution looks quite off. Is there any particular reason for this?
Just to add that the Image in the asset manager also has a #2x
EDIT: Still investigating this issue, but I have just noticed that If the collection view which contains the collection item, which contains the NSImageView is enclosed by a bordered NSSCrollView the images are perfect (.ie non blurry)
Turns out if you draw images in frames with either the x,y coords or the height and width having fractions you end up with blurry images. passing the drawingRect through NSIntegralRect fixes that.

how to remove white borders from an UIImageView

I have an application , where I drag a circular UIImageView on top of another UIImageView , and since a circle could never be squared , the white borders of the image must show , so I wonder if there is a way to remove those borders or to hide them (not by making them have the same color ).
I am expecting that you are looking for image masking feature. Have a look at this tutorial and this one too. Both of them uses CoreGraphics frame functions and are really quicker in response.
Please note that it is not the Swift version but will give you atleast a starter.
try to set the image.layer.borderWidth = 0
(this is the swift version)

Trouble with Auto-Layout

Xcode 5
I'm trying to learn the auto-layout system. Thought I would start with something simple, but I'm already getting stumped :-)
Scene: Main View -> ImageView -> View
I want to support rotation such that the Image rotates and centers on the screen, using Aspect-Fit content.
I want the smaller view to maintain it's relative position to the top edge of the UIimage view. It does't seem to understand the aspect-fit, and it aligns the sub view along the top of the main view, not the fitted image.
I think it has something to do with the fact that the small view is a sibling of the Image, and not a sub-view. I can only seem to create constraints to the superview.
.
You haven't started with something simple!
An aspect fitted image view doesn't actually change its size under auto layout depending on the image, it fits the image into the bounds that the constraints have determined, leaving the rest of its frame blank. If you set a border or background colour on the image view you will see this.
To achieve the effect you're after you would need to do the aspect fitting calculation yourself and modify the sizing constraints on the image view appropriately.

Scrolling through movie clip inside mask

I am using Flash CS5 and trying to make a movie clip scrollable inside a rectangle mask.
I have tried different codes but it doesn't seem to assume the movieclip as the scrollable area and the rectangle as the mask.
I'm very new to this, there is probably an obvious solution.
Please help!
The link http://www.kirupa.com/developer/flash8/scrollbar.htm has a tutorial for scroll movieclip. I thing this tutorial will help you.

How to pan a zoomed out UIImageView inside an UIScrollView?

I have an UIScrollView which contains one UIImageView. Everything is working correctly, I can zoom in and out, when zoomed in I can pan around, etc.
The problem that I am unable to solve is how to pan a zoomed out image around the screen. The user needs to be able to zoom the image out until it's small, and then move that small image to any point on the screen. Sadly, it's stuck in the center of the screen (usually, it would be stuck in the top left corner but I did fix that problem).
There are a couple of things you need to do here. I suggest doing them in viewWillAppear rather than viewDidLoad because if you're using storyboards, it doesn't work quite right in viewDidLoad.
First, you need to set the content size property of your scroll view to be the size of the photo itself because you want the entire area of your photo to be scrollable.
self.scrollView.contentSize=self.photoShown.size;
photoShown is UIImage. scrollView is a UIScrollView
Second, you need to set the frame of your UIImageView that houses your image to be the size of your image:
self.imageView.frame=CGRectMake(0,0, self.photoShown.size.width, self.photoShown.size.height);
if you haven't done this, then the frame of the UIImageView is the size of the screen itself and there is simply nowhere to pan. That's why it needs to be bigger, so you can pan to the regions not currently shown on screen.

Resources