I'm trying to construct a register page similar to the one used by instagram or foursquare , the problem is they have a special mechanism in a table view where you can set your avatar , like so :
It seems like an imageview was added above 2 tableview cells , obviously the insets are modified so the line doesn't touch it , but i can't seem to place the image or modifiy the tableview cell width .
How can i achieve this ?
This is probably a single cell with 3 UIImageViews, 2 UITextFields, UIButton and a dividing line being another subview (perhaps thin UIView). You can easily achieve this with a subclass of UITableViewCell.
Update: review this question for steps how to achieve it in storyboard: How do you load a prototype cell from a storyboard? You would need IBOutlets for UITextFields and IBAction for UIButton.
Related
I have added some buttons to a UICollectionView like so in the storyboard:
When I build the app, I don't see anything in the UICollectionView. Why is this? I want to have only 5 buttons in there and receive their click events in the view controller. How can I achieve this?
Each cell behaves like a button. So in my storyboard I put one reusable cell with a label in it, and I add 5 items to the UICollectionView and it worked as expected.
I have one view on view controller on that view I have six buttons I want to set constraints to these buttons but I am not able to do that. When I set constraints two of them get compressed don't know why.
I am sharing screen Shot,Please help me Thank you
You don't need six buttons for designing above screen. You can do this by using UITableView and custom UITableViewCell.
For more : Customize tableview cell
Or by using three UIViews by sub viewing UIImage and UILable and then add UITapGestureRecogniser to that UIView.
For more : Tap gesture
i am coding and ran into a problem. I want spacing between cells and spacing on the side. i tried heightForRowAtIndexPath:but got spacing on the main controller not between cells! I basically want fake margin between a custom nib UITableViewCell but could not find anything legible in swift on google, I Do not know objective C and would like to do this in swift. could someone tell me what i am doing wrong and how they would fix in in swift? thanks!
Hi your problem is logical so for swift and objective c solution would be same.
as you say u r using custom tableviewcell nib u can create this view with marginal space in nib file like
here blue color part is UIView you can add your cell component like label,textfield add here and yellow part is space that you want between cells now load this custom cell .nib in your table with table delegate method you will get the out put way you want.
here you heightForRowAtIndexPath that is use for whole row
hope this will give you idea how to get space
You have to create the inner content view to hold all the subviews. Then leave the margin between the inner content view and TableviewCell's content view.
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?
I have a UITableView that I've created in a UIStoryboard. It contains one Prototype UITableViewCell. The cells are populated in the ViewController's cellForRowAtIndexPath: method.
I'm now trying to add the ability to delete cells using commitEditingStyle:forRowAtIndexPath:. Everything is working except that when the delete button animates over the cell, the rest of the content doesn't shift over and it looks really ugly. According to this SO question, content will only be shifted if it's added to the cell's contentView rather than to the cell itself.
As such, is there a way to add a UIView (Ex. a UIButton) to a UITableViewCell's contentView within a UIStoryboard?