How do you create buttons like the "Settings", "Notifications", and "Cash Out" buttons in venmo shown below? Also, is the scroll view they use just a UIScrollView
or a modified UITableView
? I can't figure out how to add things like the buttons or the picture with balance info and name to a UITableView
.
For this example, I think it's easier to use a UITableView
than to build a custom subclass of UIScrollView
. If you want to customize the look of the table view's cells, initialize the table view with the UITableViewStylePlain
style and give each UITableViewCell
the appropriate backgroundView
& selectedBackgroundView
in –[UITableViewDataSource tableView:cellForRowAtIndexPath:]
.
For the "Settings," "Notifications," and "Cash Out" buttons, just add them as subviews of the cell in the first row of the first section. Use -[UIButton setTitle:forState:]
& -[UIButton setImage:forState:]
to give each button a title & image, respectively. Set the UIButton
properties titleEdgeInsets
and/or imageEdgeInsets
so that each button's title appears below its image.
To add a picture with a name, bio, and balance at the top, use the tableHeaderView
property of UITableView
. In -[UIViewController viewDidLoad]
, initialize a UIView *tableHeaderView
with the desired height and give it subviews, e.g., pictureButton
, nameLabel
, bioTextView
, balanceLabel
. Then, do self.tableView.tableHeaderView = tableHeaderView
.
They have used tableView. It contains 3 sections. They have chaged customCell in each section. In cellForRow delegate method you get section. Accordingly you can change cells. In CustomCell you can add any view like buttons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With