Make image view in iOS table view cell clickable - ios

I have a dynamic table view in iOS 6. The table view cells have the subtitle style and show an image, a title and a subtitle.
The table view is inside a navigation controller, and in the navigation bar I have a bar button item which allows you to reset the progress information shown in the subtitle of the cell and in the image shown in the cell (grey image when progress is 0%, orange when bigger than 0%, green when 100%, the actual percentage is shown in the subtitle).
When the user presses the reset button, the image is replaced by a special image (a rounded arrow) which, when pressed, would allow the user to reset the progress and start the exercise from scratch.
The trouble is the image view in a cell is clickable but I cannot distinguish between a click in the image and a click in the text part of the cell (title+subtitle).
How can I do this? I'd better subclass and add a button, which is clickable?
Another consideration is that maybe the round arrow that resets should be an accessory view and appear on the right?

I would just use UIButton and add a custom background image. That should work, as you mentioned.

Related

iOS renders table view cell background colors differently from button image colors, resulting in very differing shades of the same color

Update: this is not something specific to my app, I just re-created it with an Xcode template app. Its something iOS is doing - its rendering the cell and the button differently, resulting in them appearing with differing shades. Example project: https://www.dropbox.com/sh/j7eexzihs6swl3u/AAAuAzMVUKxzCkgPYsMaIYyHa?dl=0
I ran the project on the phone, took a screenshot then sampled the colors in Photoshop - the cell background comes out as 494a49 and the button comes out as 383938. So the color of the table view cell is being drastically altered.
I've got button with an image placed within in a cell of a table view.
The cell content view background color is set to Ox383938 and the color of the background image set in the button is also 0x383938, yet they look very different:
Why is there such a difference in these two shades of gray?
The cell's grey is much paler, as it has an alpha of 0.7 or something while the button has an alpha of 1.0. But this is not the case - these are just a regular button and regular table view & cell dragged and dropped into the storyboard and nothing about them has been altered, nothing changed in the Storyboard settings etc. (other than the cell background color).
Whatever is making the cell paler than the image in the button has not been set by me, if its some default value in an image or button or row or table view then what and where is it and how can I make the cell background and button image the same shade exactly?
This is down to the colour profile. When you have the RGB sliders selected the settings cog will bring up a list of colour profiles and you have to match that to the image. In this case it needs to be sRGB. Then when you set the hex value it will match the image used on the button.

How can I allow tapping on button outside cell frame?

I have added cross button on the edge of collection view cell and half part of this button gets overlapped by the cell below it. How can I make the lower half for this button tappable?
Edit:
Is there anyway we can change the zposition for button or we can make it appear above the collection cells?

How to add tabs in the cell of tableviewController

hello I want to know how can I add tabs in the tableviewcontroller like this
I want to add tabs Contact and About similar to image and also a line between them. These tabs are in the mid of screen not at the bottom.
I have another question is when I press my thumb on this image portion and move my thumb downwards the image size increases. How can I do that. When I do in my controller white background comes up.
You could put buttons at the bottom of the cell and then have the button handlers reload elements in the cell's view.

Create swipe to reveal buttons for iOS 7, using clear color for background

I followed this tutorial http://www.teehanlax.com/blog/reproducing-the-ios-7-mail-apps-interface/ to add more button beside delete button when swiping.
But the problem is the cell need to use clear color so the background image can be seen. But that approach used scrollview to display the content view and the buttons view of tableview cell. If the content view of the scrollview has any background color instead of clear color, it can hide the buttons so these buttons only display a part determined by our finger when swiping on the cell, using clear color for background makes these buttons show without the need to swipe from right to left on the cell.
So anyone can give me a suggestion to use the clear color to display the background image without revealing the under buttons?
You can use MGSwipeTableCell class for creating swipeable buttons with any colour you need. It will not interfere with the tableview cell color as well. It is very easy and quick to implement.
https://github.com/MortimerGoro/MGSwipeTableCell

Display custom overlay image when button is pushed

The Goal:
I would like to add a method to my UIButton which randomly displays the following;
An image in the middle of the overlay displaying a picture
A UIButton at the top-right (red 'x') that closes the overlay
Various UILabels with information
How would I go about creating an overlay, and how would I customize the layout of the overlay and assign values and images dynamically?
I know how to create a custom cell for a UITableView, but I need a bit of guidance on this one.
Use IB or create by program a UIImageView to contain your image on top of the overlay. Then just use the button to toggle the image view between hidden (property of UIimageview) and not. Alternatively you may position push the image view to top and put it down to the bottom of the view heap using the button.

Resources