TTTableSubtitleItem squishes image and does not clip it? - iphone

I am using a TTTableSubtitleItem with UITableViewStyleGrouped. When viewing the tableView, the image that is in the TTTableSubtitleItem gets skewed to fit the image view (rather than just placing image without changing dimensions) and also the image does not get a rounded edge when it is the first item in the section.
Does anyone know of a way to fix these two issues?

I needed to subclass TTTableSubtitleItem and draw my own images.

Related

How do I blur (ios7 style) a section of an image in a UITableViewCell?

I've got a UIImageView that takes up the whole cell and shows an image. I'd like to blur the bottom third of the view in the iOS7 style (we're targeting iOS7). There will be a label over the blurred part.
The issue seems to be that I can't "screenshot" the UIImageView right as I am setting up the cell in tableView:cellForRowAtIndexPath: as it hasn't loaded yet. Although i've even tried setting up a timer for a 0.1 second delay and that also doesn't work.
I've tried the stuff on http://damir.me/posts/ios7-blurring-techniques
I've tried https://github.com/justinmfischer/7blur
I'd like to use the new screenshotting API drawViewHierarchyInRect:afterScreenUpdates:
I'd also like to use apple's sample code UIImage+ImageEffects
The only thing that has worked so far has been to just put a UIToolbar in but the performance is really slow. I don't need dynamic updates.
I've managed to get the following effect a few times but it has just tinted the view and hasn't actually blurred anything so I'm a bit confused.
Use UIImageEffects sample from apple
Make a Image View with a size of the lower portion you want to blur... and then set its image to a blurred one. also set its content mode to UIViewContentModeBottom for the proper clipping
Since your image isnt the size of the cell.. first get a temp image as it is being displayed in the cell by drawing a UIImage from it.. refer for the code here
How to capture UIView to UIImage without loss of quality on retina display
then blur that image
Load this image into a UIImage, blur the image, clip to fit the area that you want. Use UIImage+blur.h

iPhone - Make a small image fill a custom larger button

I have a UIButton in which I want to insert an image that would stretch to the button size. The button property allow it to stretch "down" the included image to fit the button size, but I want to do the opposite : the thing is that my image is small, and I want it to grow if the button is bigger than the image.
How may I do this ?
Set the image as the background image of the button.
you can use property value Aspect Fit or something related to it.
I had same problem and after searching i found a good thread.
How do I scale a UIButton's imageView?
I will suggest you to set background image of button which will solve your problem.
And be careful if you are resizing image programatically it will take time to resize. If you have multiple images and you are resizing programatically do it on different background thread which will protect your main thread and GUI will not hang and set resized image on main thread.

Obj-C, how to handle a background image which is squashed on some views and not others?

I've got a background image with a radial gradient, on some views it looks fine.
But on others where I have extra controls at the top of the view its squashed as it has less room to be show.
I guess I'm going to have to take account of the where the images starts at the top or the bottom, so one end will loose a section. But if I can do this via a property, rather than stretch ? or if I have to chop the image some how ?
What can I do?
Are you showing with UIImageView? Default contentmode is set to UIViewContentModeScaleToFill, which is to stretch in all directions to fit frame.
Change contentMode property to get the effect you want, ie UIViewContentModeScaleAspectFill.

iPhone animation with stretchable image

I got a UIView subclass that draws a UIImage as its background. The image is created using the stretchableImageWithLeftCapWidth:topCapHeight: method, it has round edges.
I also use an animation block inside of which I resize my view. I had hoped that during animation, the drawRect:method would get called sometimes, which would result in the background image getting drawn correctly.
Unfortunately, the animation seems to render the image and then just rescale it during the animation, which obviously makes the formerly round edges getting nastily stretched.
The only workaround I can imagine is put three separate UIImageViews (top cap, middle fill, bottom cap) above my original background image and then reposition the caps images and scaling the fill image. However, this seems quite complicated...
Is there any better way I can prevent this from happening?
EDIT: Found this. Sounds bad...
While digging through some Apple docs, I coincidentally found the solution to my problem. All you have to do is play with UIView's contentStretch parameter. It allows you to manually specify the area of your view that gets stretched during animation.

Resizing images on iPhone for UITableView image

I'm using a sectioned TableView, and I want to show an image on the left side of the cell.
If I pick one from the photo library (out of the example photos in simulator) and set it as UITableViewCell.imageView.image, it takes up the whole screen.
How can I resize the image so that it fits exactly into the cell's image view?
Thanks,
Yassin
This is basically the same question as How to scale a UIImageView proportionally ?, which has a good answer.
Add that category to your project and call it with the size of your view. I've used the code and it works well.