Can't click the buttons inside a TableViewCell in iOS 14 [duplicate] - swift

This question already has an answer here:
Selectable objects on UITableViewCell not responding to user input on iOS14
(1 answer)
Closed 2 years ago.
In iOS 13 it works perfectly, but I am not able to make a simple tap on a button work within a TableViewCell. Is it happening to someone else? Has the way of doing this changed?

Solved!
You have to add your views to cell contentView like this:
contentView.addSubview(button)
and anchor your button to contentView:
button.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true

Related

How to remove scrollview sidebar swift [duplicate]

This question already has answers here:
How to hide scroll bar of UICollectionView
(3 answers)
Closed 2 years ago.
I am creating a swiping controller from collection views in my app, but one problem I am having is I am not able to get rid of the thin rectangle that appears whenever I swipe from one collection view cell to the next. The rectangle I am talking about also appears whenever you are scrolling in a scrollview. I am not sure what the proper terminology for this is however I would really appreciate it if someone could help me understand how to get rid of this.
if you are using StoryBoard uncheck Show Horizantal Indicator and Show Vertical Indicator
And in code you can do
scrollView.showsHorizontalScrollIndicator = false
scrollView.showsVerticalScrollIndicator = false
Have you tried:
myCollectionView.showsHorizontalScrollIndicator = false
myCollectionView.showsVerticalScrollIndicator = false
Those properties are inherited of UIScrollView

How to create an immovable TableView? [duplicate]

This question already has answers here:
Preventing UITableView from scrolling?
(2 answers)
Closed 6 years ago.
I would like to create a Sign Up page in my application and I want to create an immovable table(witch you can not scroll). I'm doing this in Swift language, if somebody knows will be very helpful. Sign Up Page
In the inspector window of the tableview storyboard turn off anything related to scrolling. And then just make sure your table view height does not exceed the view height
Have you tried setting the bounces property to NO?
You can use the following code:
tableView.bounces = false
tableView.scrollEnabeld = false
From https://stackoverflow.com/a/5344072/4882590
You can do that from your XIB as well as programmatically.
From XIB:
Just select the tableView and in Inspector uncheck bounce horizontally & bounce vertically and scroll horizontally and scroll vertically
Programmatically:
If you want to do that programmatically then you can try
self.tableView.scrollEnabled = false
OR
[self.tableView setScrollEnabled:NO];

UITableView Header (not section header) problem [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Adding iOS UITableView HeaderView (not section header)…
I want to make a tableview header like in the contacts app:
Exactly like there, am image beside a label above the table.
Any way doing that?
Thanks!
Did you try a custom UIView with 2 subviews, a UIImageView and a UILabel, for a header?

how to change colour of arrow in uitableview [duplicate]

This question already has answers here:
Which is the best way to change the color/view of disclosure indicator accessory view in a table view cell in iOS?
(12 answers)
Closed 8 years ago.
I want that the arrow of Tablecell is visible permanently. currently it is visible only on selection.
secondly i want to change its colour from white to orrange.
How i will do this.
Regards
Nauman k
You can find your answer here:
Which is the best way to change the color/view of disclosure indicator accessory view in a table view cell in iOS?

Checkable UIPickerView [duplicate]

This question already has answers here:
How can I get a check mark beside UIPickerView labels?
(2 answers)
Closed 9 years ago.
i can't find a property to set my UIPickerView checkable... in other programs, I can select a item and the pickerView show a checkmark :-(
Here I solve this problem by creating controller.With this we can able to design view with our own way.Here,I use a UITableView and some custom Delegates methods to create a picker view.
Hope,it solve your problem
Check this link also:
Click here!
You will have to make a custom picker view. There is a method that is viewForPickerView:atComponent:row: or something like that. You will need to return your own view and do your own logic to draw a checkmark.
See my answer here for an elaboration of reproducing a checkmark-enabled UIPickerView, like the one Mobile Safari uses for dropdown menus.