UITextView address selection inside UIView - uiview

I have a TableViewController in which I have a custom UITableViewCell called TableViewCell. Inside this cell I have the following: UITextView UIImage UILabel. The UITextView displays an address, so I have enabled address detection. It was working fine until I put all the objects inside a UIView so I could set a nice border inside the cell. Now, the address detection is no longer working. How do I keep the UITextView inside the UIView and also have address detection enabled?
Thanks in advance! (Comment for down votes)

Related

Change a label inside a UICollectionView Cell by pressing it

can anyone point me in the right direction of trying to edit a UiCollectionView cell by pressing on it? I have 3 labels inside a XIB, and that is presented in the UICollectionView. I would like to have the user be able to edit it when they press on a certain cell. Maybe even pop up like below.
Thanks all
You should probably use a UITextField instead of a UILabel to enable user interaction. Then link that UITextField to your custom UICollectionViewCell class.

Disabling touch interaction of Spaces between Custom table view cell

I use custom cells of subclassing UITableViewCell in a table view. And There must be space between cells. I succesfully add the space with adding a subview that I called SpaceView into the content view. But When I touched the spaceView, it is perceived as I touched the cell. And didSelectRow method called. I tried to set spaceView's UserInteractionEnabled==NO. But It doesn't work.
So my question is; Is this the right way I used to add space between cells ? Should I try to add cells for making the space ? or If its the right way, How can I prevent calling "didSelectRowAtIndexPath" method when I touched spaceView ?
like Inder said below, u can use an UIButton to solve the issue.
1) in your custom cell: at the bottom of your custom cell add a blank UIButton with the height u actually need between cells, and customize its background color according to your needs.
2) in cellforrowatindexpath: disable button of each cell. (or you can also do that in Interface Builder of previous step)
result: u have a clear disabled button that will appear as required space between cells.
Make your spaceView as UIButton (I guess it's UIView right now)
When you add UIButton that touch will be consumed by the button thus touch won't be passed to it's parent.
OR
I'm not sure if it will work or not, you can add tap gesture to your spaceView

UITableViewCell selection behaviour changes when selectedBackgroundView is set

I have a UITableViewCell which is loaded from a xib, with a handful of labels and image views. I notice that when the .selectedBackgroundView property is set (in -awakeFromNib), interaction with the cell is only possible when touching on the labels or image views within the cell.
Trying to touch any blank space in the cell does nothing. Not setting .selectedBackgroundView returns the behaviour to normal.
Does anyone have a fix for this? (Mine currently is to place an empty UILabel over the entire contents of my cell)

Semi-Selection of Custom UITableViewCell Corrupts UILabel Drawing

Tapping and then rolling your finger off of my UITableView's custom UITableViewCell corrupts the drawing of the contained UILabel. Neither setSelected: nor setHighlighted: are called. The UITableView uses dynamic prototypes. Tapping the cell results in normal selection and drawing. Here is a video showing what happens:
http://www.youtube.com/watch?v=vMHQc5tpcOY
I do custom drawing in a subclassed CALayer. Any guidance in resolving is appreciated.
I was able to resolve this by overriding setHighlighted as described in this answer.

UIScrollView within UICollectionViewCell Not Working

I have a UICollectionView with a custom UICollectionViewCell. The UICollectionView scrolls horizontally, with each cell occupying all of the visible screen.
The UICollectionViewCell has a UIView subview, which in turn has a UIScrollView subview.
The UIScrollView is intended to scroll vertically, but it's not scrolling at all. I've tried setting the scroll view's contentSize with no success.
I suspect that the UIScrollView is not getting any touch events rather than it being a size issue.
Any suggestions?
EDIT >>
I'm now sure it's an event problem rather than anything specific to the UIScrollView.
I've now overridden the pointInside: method in the UIView in the UICollectionViewCell and can see that it now returns false every time I tap on it. In that case you'd think that the tap event would propagate to the next subview , but the UIView still isn't getting events. I've tried adding a UIGestureRecognizer to the UIView but it never registers a tap.
Could there be anything here intercepting the events that I'm not aware of?
I've been trying to solve a similar problem with a scrollview, and your edit about events reminded me of this question (which solved my problem again) How can I use a UIButton in a UICollection supplementary view?
Its possible you need to be using a UICollectionReusableView, not a UICollectionViewCell. Changing the class worked for me because I was using a button (and recently a scrollview) in a header.
However I've not tried for cells themselves. For capturing events from a UICollectionViewCell, maybe the following may help?
Getting button action : UICollectionView Cell
Try to disable userInteractionEnabled for the UIView and enable it for your UIScrollView
I'm not sure if this was your problem, but it was mine - and I'm putting it here in case anyone else comes across this for the same reason. I wanted to put a UIScrollView inside a UICollectionReusableView but by accident I had created my custom class as;
class CustomCellHeader: UICollectionViewCell {
}
instead of;
class CustomCellHeader: UICollectionReusableView {
}
Once I changed that, the UIScrollView within my header cell came to life!
Embed the scrollable content in a ScrollView within the cell.
Add "UICollectionViewDelegateFlowLayout" to the UICollectionViewCell i.e.:
class SomeCollectionCell: UICollectionViewCell, UICollectionViewDelegateFlowLayout {
}
Now scrolling within the cell should work.

Resources