**You may want to go 'Edit 2' section directly (at below), there you can find the last and current situation.
I can't explain the problem just with the words properly, so I'll try to explain with pictures. Here is the situation I have:
As you can see in the picture, the allignment of the header titles doesn't match with the contents of the TableViewCell. I want section header to be at the top of the values. Like, "Alış" string to be at the beginning of the values. To be specific, I want something like that:
Alış Satış
654.000 666.000
313.757 321.921
157.370 160.960
... ...
And so on.
I was referring to this link to make section headers. Of course, it is a simple doc, so I moved myself using "auto layout" and "update frames" and "add the missing constraints" from the Resolve Auto Layout Issues segment that storyboard has. Well, clearly I failed. Here is the tableView that refers to this problem:
So here, the second cell is used for the header, as suggested in the link I gave.
I'm not familiar with using constraint, that is making the issue more complicated to me.
Any help / suggestion would be appreciated.
Waiting for your assistance.
EDIT:
Here is the code I have to write header.
EDIT 2: Now, I'm really close and just need a little assistance
I was trying 'til the morning on this, I know it is a bit much time. Anyway. So eventually I figured it out and tried in iPhone 4s to 6 plus, they give the correct result, with a minor mistake. The answer was simple: playing with the autolayout to understand with reference. I recommend Apple's doc and Ray's doc.
Back to last problem, as you can see in the first picture, my last row of tableVieWCell's alignment is right which I want it to be left. So the last situation is at below:
**I worht mentioning that I know that the alignment may not be what is my topic, but I didn't want to ask another question. If it is really unappropite, you can warn me, so I can ask in another topic.
Please make seperate xib file with class file .h & .m and it's superview is UIView for section header. And design the same view which you have design for table cell. You can use autolayout also in xib file. This will work :-)
Related
How can I make the design by using collection view, please explain me. Here is the image of the design:
This is simply a UICollectionView with a UIPageControl below it.
You just need to design a UICollectionViewCell that looks like a card and use that in your collection view.
Have a look at [this Ray Wenderlich tutorial] to give you an idea how to use a UICollectionView. Of course you'll need a horizontal scrolling one, but that's easy configurable. Also read the iOS documentation.
You'll also need to scrolling to stop with one full card visible; read this.
Since you're new on StackOverflow you may not know this: On StackOverflow you're expected to first do your own research and try hard to get something working. Then when you have a detailed issue you can't figure out, you post that here. Please do so next time.
I see that in the storyboard, under Constraints, it lists all of the constraints being used. I am currently doing video tutorials and I think it would be a lot easier to simply write down what I see instead of dragging and connecting everything right now. Is there a way to do this?
Yes. The respective classes to use are 'NSLayoutConstraint' and 'NSLayoutAnchor'. It is described in the programming guide "Auto Layout Guide".
BTW:
I just found another question that actually shows some code how to use it:
How to set UITextField width constraint to have room for a certain string
UITableViewCell shows up in Main.storyboard but doesn't show up in simulator.
I'm using Main.storyboard. In my simple experiment with Swift, I added a TableView, then put a UITableViewCell in it, and then I put an image and a label under the cell's content. It looks okay in Main.storyboard but when I run the project, the content disappear. All I did is purely on Main.storyboard and not touching the .swift file yet.
Here are the links of screenshots of my simple work:
How my app looks in Main.storyboard
How it looks when I run Xcode simulator on iPhone 8, the tableview cell's content disappear
I have searched the problem through the stackoverflow and found a related question here: 'UIImageView doesn't show up in simulator', then I followed the recommended solutions from the forum but still didn't solve the bug.
What I have done so far to solve the bug:
Check if every item in my view has four constraints defining X, Y position, width and height.
Try to check and uncheck the autolayout flag for my Main.storyboard
Make sure my tableview cell's contents (and everything inside my view) has alpha set to 1
Well I haven't check how things looks in my .xib file.
I would like to know if this is a bug, or just a problem in my settings?
I'm quite new to Xcode, swift, and iOS app. Any help or suggestion would be greatly appreciated. If you have the same problem with me, I would like to know your case as well.
The only reason your cell doesn't show up in the simulator is because your tableview is dynamic.
Dynamic table views have data that is loaded at runtime, where there isn't a fixed number of cells, and every cell has the same layout. The Apple tutorial is a good place to start. It guides you through on how to use a tableview/tableviewcontroller.
There is no way around it: You have to code in .swift files if you want to use dynamic table views.
If you are going to use static table views, on the other hand, the number of cells is fixed, and the data is not loaded at runtime. You can use static tableviews if you don't want anything to do with code at the moment.
I had a similar problem. I solved it by deleting constraints for the affected view and starting all over.
Hi guys I've trying to figure out which iOS component is the one in the picture below (the one pointed by the arrows), its like a cell separator that gets stuck at the top while the bottom keep scrolling, you can also find it in the address book with the alphabet. If you happen to know any tutorial any tutorial also post it too. Thank you very much!
That is the section header in a UITableViewController or a subclass of UITableViewController (subclasses are used so you can write your own custom code). You can check out the Stanford cs193P course for more information. Table Views are covered in the 9th week.
Thats the TableView's section header
I was wondering, how you could do something like this, e.g. make the separator line usable, in this example as a display of votes. I think the separator line is a cell here. When you click on it a popover menu comes and you can click what you want to vote for. My question is: Does someone know how to do that or has a link to a useful explanation?
I don't think that the "seperators" are actual cells, but rather part of the previous cell. You can see that the indicatorview is seemingly not centered vertically (which I personally even find sloppy).
So, just make a custom cell with your desired behavior. Maybe google for "Accordeon cell" or something like that, I think I remember they talked about cells like that in the previous WWDCs.