I have a tableView with tableViewCell. The cell contains three labels. When you edit an existing cell (by tapping it) or create a new one (by tapping a "plus"-button) you see a new viewController where you can change the content of those three labels.
All of this works fine, but when you edit (or add) a second time and save it, the first label magically changes it position (it moves down and to the left). If you close the app and reopen is, everything is at the right position again.
I just cannot understand why this is happening. The labels are inside a stack, have constraints and everything.
Does anyone have any idea? Or did anyone have a similar problem and was able to solve it?
Thank you very much!
Related
I have created a UITableView with a cell inside. Inside this cell view, we have a Content View, and in that, I have subtitle text. This is all in the storyboard. I wanted to have an image right next to the cell, so I put an image and chose a picture.
The image turned out really small, and I couldn't even make it bigger - it was that small. So I put another image view that I created in the view and plopped it into the tableView. Then I try to delete the first tiny image view. It doesn't delete.
When I try to move it out of the Content View, it duplicates itself. When I try to drag it to the view and out of the Content View, it sends a duplicate version. So I tried to change the cell type from subtitle to custom, hoping that everything in the Content View would disappear and I can put it in again.
Then, Xcode crashed. I tried again with changing it to custom, but it crashed again. I didn't put the crash report because it is very long but tell me in the comments if I should put it, and I will edit this question to put it in. Tell me if there is any other information you need.
Thank you in advance!
UPDATE:
I deleted the whole cell. I realized that when putting a picture in the attributes inspector of the table view cell, it makes the picture either really big or really small. It doesn't allow me to resize the picture or move the picture without randomly duplicating it. Does someone know why this happens?
If you want to customise the size of your image, you can do so very easily by creating a UINIB file and then customising the look of your cell in the new file created. You can do so by creating a new cocoa touch class of type UITableViewCell and then select the create XIB file checkbox. Then you will see a similar to main.storyboard layout which works exactly like the main.storyboard and the difference is that it is specifically for the table cell. Make sure you register the UINIB with the table view so that you can control the data that shows up in your cell. I hope this helped!
I have a UITableView which has a variable amount of sections and every section has a variable amount of rows. Every section contains a section header, a section footer and the rows for that section. They are shown and displayed inside a container. Everything up until now works as expected. To demonstrate what my UITableView currently looks like:
I am now trying to implement the possibility to swipe left on the entire section, so that the header of the section, the rows inside this section and the footer of this section move to the left and display another UIView. I am capable of swiping the cells separately, but enabling this feature on the entire sections have caused headaches for the past two days. This is what I would like to achieve:
I have thought about implementing UIGestureRecognizers but I am afraid they might conflict with my UITableView. Also, I started implementing it, but I would not know how to move solely the section on which was swiped to the left.
Then I thought I could maybe implement a UIScrollView as container for each section. How I would accomplish this is still a mystery to me, but it seems like a possible solution if this could be done.
Furthermore I am out of ideas and stuck on how this should be done. It's something I have not found on the Internet so far - at least no working examples of some kind so I have zero inspiration on how to achieve the effect.
I therefor would like to ask if somebody has an idea of how this could work and what I have to keep in mind when implementing this. Every clue pointing me towards a working solution is gratefully appreciated!
EDIT: I have already seen the possible duplicate this afternoon. However, the suggestion there shows touchesBegan() on the header, which does not work in my case as I need the entire section to be "draggable".
I think one way you can implement this is with a vertical stackview containing views that contains a tableview and the trash icon. When a user swipes left on the tableview header, it will show the hidden trash icon in the view. I would think that each tableview only has one section so it will be easier to keep track of which "section" the user has swiped.
I have currently managed to arrange a similar solution. I take the rectangle of the section with rect(forSection:int), add a UIPanGestureRecognizer in which I add a UIView on top of the UITableView if touches began, I calculate the location of the finger and let the cudtom UIView follow. When a certain point (100 from left edge of the UITableView) is reached, the section gets removed with deleteSections(indexSet:with:).
This works. It does the job, but it adds an overlay to the section rather than pushing it to the left.
Therefor I am asking of someone knows if there is any way of setting the offset for one specific section or for an area of a UIView, so I can offset the rectangle of the section. I have been able to setContentOffset on the entire UITableView but this is not the desired result.
If there is no way to do this, I would consider keeping the solution I have now or maybe implement a snapshot feature which takes a screenshot and crops the rect of the frame, adding this UIImage to the custom view to simulate the section. But that would be tricky. Any ideas for this idea are also welcome.
though the elements show, they don't show in the proper location
When I put UI elements in to the storyboard on this app that I'm working on they do not show up in the right location. I can edit them, move them, manipulate them... but all of it shows up lower than where they are actually located. then on this second viewcontroller that I have created, the header from the first viewcontroller is now showing up over there.
Not really sure if there is a way that I can reset the storyboards or get this to clean up at all.
thanks.
delete all your constraints first from the left hand side of the story board.
run the app and see how it looks
now, set contraints for each widget one by one properly and give it a try
The two buttons were in a stack view with constraints that were throwing them off. Once I removed the stack view and laid out the buttons without the extra view they worked perfectly.
I am facing weird problem with the UIPickerView. I have implemented UIPickerView in my project and when i scroll quickly to select value from it, the selected row disappears. Please have a look at the attached image.
Not only single picker all picker in the project have same issue. I added new date picker without binding it with the code and that too have the same issue. Please can anyone let me know what could be the issue.
I noticed one thing, When I scroll it, the selected number animate from pricker and goes to bottom left and than disappears.
Except this UI issue everything works fine.
Thank in advance
When trying to view a larger UITableView inside of a UIViewController in the storyboard, I can only see/edit the top most cells from the table. The moment I scroll further down the cells are all blank. This is purely for storyboard, the code works fine when running, but any cells in the storyboard that are further down a tableview I can no longer edit since they show as blank.
Here's an example to illustrate
As can be seen from the shift right click, I can't even select the cells that are there.
I know and have experienced problems such as not being able to scroll at all before, such as this, but this is different as I can scroll down but cannot see the rest of the cells of my tableview. Has anyone else ran into this problem, and would know a solution? It seems like it may have something to do with Xcode 7, as I recently upgraded to it.
Although not ideal, I've found a few work arounds for this problem. One solution is to make a temporary UIViewController with a UITableView, and then drag cells into the temp UIViewController until the cell you want to edit is visible. Once you've changed it, drag all the cells in the temporary view controller back into their correct controller. This is extremely hacky, but so far is the only way I've found to visibly see the cell.
Another thing that can be done is that the cells are still editable in the document outline, meaning constraints and elements can still be modified from there. However, it is difficult, as I wasn't able to see the cells being edited, they still appear to be blank.
Hopefully someone else finds/knows of a solution to this and can post it, I'll leave these two workarounds up though they're far from ideal.