I am using auto layout and working with custom UITableViewCell. Inside this cell, I want tp display an image. Issue is that image is not displayed with clarity.
Actual image is this :
But in app, it is displayed as below :
What can be the reason? How to solve it?
![enter image description here][3]
To maintain corner radius for changes in image dimensions, use the resizableImageWithCapInsets method on UIImage.
Good tutorials:
http://useyourloaf.com/blog/2012/07/05/customizing-appearance-with-resizable-images.html
http://ios.biomsoft.com/2011/12/20/ios-5-uiimage-and-resizableimagewithcapinsets/
Related
Currently, I have a UIButton and want to set an image inside of it. I'm successfully able to set the image to inside the UIButton but for some reason, the image is VERY small compared to the UIButton. I want to increase the size of the image - no, not cover the entire button just a slight increase so it's a bit more visible on the UI.
More information, my UIButton is 40x40. The answers I've seen on StackOverFlow have indicated changing the Content Mode but even those answers have not helped. I'm a little stuck at this point so any expertise/advice would be highly appreciated!
Figured it out. I had to use image insets. This property allows to reposition the drawing rectangle for the button image. By setting values to the top, bottom, left, and right image insets we're creating a rectangle and thus, increasing the space for our image to be draw in.
I had actually seen this suggestion in other answers and had tried it but on IB, nothing seemed to change but I finally decided to test it on simulator and saw the affects.
I have an UIImage I want to allow the user to circle a particular part of the image and then write something about it on the image and then I want to save this image.
I do not know how to start on this are there any libraries or example that can help
First take one UIImageView add your image in it. Now add label as subview in UIImageView.
Now finally capture the the UIView as image.
Here this will help you to code for capture the UIView as image
Thanks.
Capture UIView and Save as Image
I have added a table view, and I am display image in the cells. I have also added this code:
So that the cells resize depending on the image.
When I launch my app though, I get this :
[![enter image description here][1]]
And the images do not load untill I start scrolling...If I scroll down half the page then go back to the top, I get this: Which is correct
[![enter image description here][2]][2]
Any ideas? I have researched on google and tried the odd solution for the older versions of Xcode, But nothing seems to work!
If the image is already downloaded and resident in your cache when you pass the post to the cell them the image view will have an image and therefore an intrinsic content size. This all allows the table view to calculate the required layout.
If the image needs to be downloaded then the image view won't have an image and will size to zero because there is no intrinsic content size other than that.
If your images are all the same size then you can supply a placeholder image while waiting for the download and the cell will size appropriately.
Note also that you aren't updating the cell when the image has downloaded. When you do this you do need to check that the cell hasn't been reused (or you'll be showing the wrong image). If you don't have a placeholder or can't guarantee the image size then you will also need to ask the table view to update.
Maybe your post.downloadImage() and post.fetchLikes() should callback, and in callback, should reload cell in mainThread. hope it help.
Below is my storyboard, I had quite a lot of constrains to make those four buttons fit into the screen nicely. However, after I put the images into the buttons and check the storyboard preview, all images are distorted. I try to adjust (had tried all of the options) the view mode at attribute inspector panel but seems no effect at all.
One more thing, I am using PDF as vector type image set, not regular .png file I am wonder if that matters? Should I change the way vector image displayed inside UIButton programaticly?
The verctor image size was 500px*500px. I resize the image into 50px*50px after #orkenstein 's reminader, xcode may not be able to handle oversized vector image that well. The image appear inside button as it is exactly 50px*50px and lost its ability to scale. Also as he sugested I should but the vector image inside an UIImageView and after my test, it works perfectly fine in an UIImageView.
Setting the contentMode on the button itself doesn't work for me, but setting it on the button's imageView does. From this Stackoverflow answer:
button.imageView?.contentMode = .scaleAspectFit
I would like to implement the similar feature as in the facebook iPad app in which the text can be added to an image as in the below image.
I can add a view like this with the text in the imageview, but don't know how to keep the size of the added view like in the below image when its zoomed in or out (like pins in mapview)?
Can some one suggest me implement like in the above facebook tagging feature in my app? Thanks in advance.
You should put your image in a scrollView to be able to zoom it.
Your tags are views added on the [scrollView superView], so you can zoom the image and your tags keep the same size.
Then with a bit of logic and the convertPoint methods of UIView you should retrieve the coordinate of the anchor in the resized image.
- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view
It's not a fully baked answer but you should have steps. Maybe you can also find some open source implementation to use or inspirational