Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS custom buttons and scroll view like venmo

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.

enter image description here

like image 688
user1529956 Avatar asked Jun 06 '13 07:06

user1529956


2 Answers

  1. 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:].

  2. 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.

  3. 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.

like image 69
ma11hew28 Avatar answered Sep 20 '22 16:09

ma11hew28


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.

like image 26
Durgaprasad Avatar answered Sep 19 '22 16:09

Durgaprasad