TableView editing mode deletion button overlaps - ios

Currently I am working on an app where I have a UITableViewController and wan't to be able to delete the items. So I added the correct buttons and methods. However when I press the edit button the deletion icons appear over the my text.
With the default UITableViewCell this is not happening. Then the text moves so it clears free from the button. How could I achieve this in my own table view cell?

As stated by Putz1103 this happens when you place your views on the view instead of the contentView. The contentView is handled by iOS automatically.

With the answers provided here I continued my search. And this answer on this question is what I did wrong. I had a UIView (of which I changed it's class in the Interface Builder to a subclass of UITableViewCell.
But I had to drag out a UITableViewCell, and that one did have a contentView property.
Thanks for the responses.

Related

Smaller button over a big button in swift

I am new to swift and iOS development. I have created a scroll view with table view cells and image views inside cells. Each Image view has a button with same constraints. I have a fixed button in the same screen (irrespective of scroll view) and I am not sure how to achieve the click for it since every time I click on it, the background button is being clicked. I saw some solutions about disabling and enabling the buttons but in this case, I will not be sure which button will be in the background since it is a scroll view. Any help on how to solve this will be appreciated
Since I don't see your code, I can't tell you the exact fix but I assume that the question is how to determine the button's position in the parent view hierarchy. Every UIView has a method called bringSubviewToFront(view:) so if this was the case, then, you can use this method to bring your button to the front.

UIView with container view not scrolling properly when keyboard appears

I have an issue dealing with a UIContainerView inside a UIView. When I try to show the keyboard to edit one of the fields I would expect the whole UIView (with the UIContainerView inside it) to scroll up and out of the way of the keyboard.
Here is what I see at the moment. Does anybody have any suggestions on how to resolve this issue?
The automatic scrolling for input only happens in things like UITableView. For this one, refer to the Apple guide of managing keyboards.
Essentially, you want to manually scroll up the view when the keyboards appear and put it back when the keyboard is hidden.
Edit: I just realised that you have a
UITableViewController. My guess would be because it's on fullscreen, the table view doesn't have enough room to scroll. In this case, you would need to put the all the views inside a scroll view and follow the guide above.

Can I put 2 UITextFields in the same tableViewCell?

Check out this image below, this is what I'm trying to accomplish, but I ran into some problems. The first approach I made was to have an imageView (blue square) and 2 separate tableViews within a scrollView. Each tableViewCell would have textFields inside them. The first issue was when the keyboard came into the view, I would move the view up to make sure the bottom textFields were not covered up. I then wanted to be able to scroll up and down so I could still see the top textFields as well. This didn't work because when I nested the tableView inside the scrollView, The scrollView wouldn't scroll. I was also having a problem with setting the firstResponder to pass from textField to textField on the second table only.
I then decided it would be better to create 1 tableView, and add a custom cell to hold my imageView and two textFields. My question is, is it possible to create that custom cell that will hold my imageView and two textFields? would this be a better approach?
Thanks
Wow, I think your can do it easily by UITableView. All you need to do is customising UITableViewCell.
This is possible using subviews. However, why you aren't considering UIViewController or UIScrollViewController for this design?

UITableViewCell covering delete button on swipe left

I am posting this question, specifically related to iOS 7.
When I swipe cell to left, the delete button appear correctly, but the cell is not moving left enough, which results in the delete button being covered by the cell for nearly half of its width.
The cell is a class extending UITableViewCell, and in Storyboard there's a UIView with some child views in it, but for the rest it is just a plain cell.
The custom class is not implementing any drawing mechanism.
Unless you have some custom code configuring your cell, I would remove the code for this and add it back. There has to be something that you've written in your code to cause this to happen. Usually, this functionality works right out of the box. Post your code so that we can see what's causing the issue.

UIStoryboards, UITableViewControllers, and UIToolbars: Can't Place The Toolbar Where I Want

This breaking my head because I can't seem to find a way to do it. I want to put a UIToolbar directly on top of a UITabBar, but whenever I drag the component, it goes and gets added below a UITableViewCell.
This is what happens:
The toolbar should be below, on top of the tab bar, not below the UITableViewCell. These cells are dynamic, not static (if it matters).
Any help will be really appreciated!
EDIT: I just figured it's adding the toolbar as a cell rather than as another component. I can't seem to add the toolbar outside the table though. Uuuhhgh.
Start by creating a ViewController, not a TableViewController.
Drag out the TableView into the ViewController and resize it accordingly, then add the UIToolBar below it.
Hope it works.

Resources