1

I am searching for a Listview in Swift that looks like the following:

Wanted ListView:-

enter image description here

I want a ListVIew that has a picture in the background and a text over the picture. And when I click at that picture, I want to go to the next site.

And how I get these Header?

Header Example:-

enter image description here

Can someone help me?

pkc456
  • 8,350
  • 38
  • 53
  • 109
moxmlb
  • 1,190
  • 3
  • 10
  • 18
  • Implement the [`UITableView`](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/) with `customTableCell`. On your customTableCell class draw the custom design as shown in your requirement image. Implement the `didSelectRowAtIndexPath` delegate method to goto the next site. – pkc456 Aug 23 '16 at 06:31
  • in the customTableCell I set the background with the image and set a text over the image? – moxmlb Aug 23 '16 at 06:34
  • Set a background image. Set a left aligned label. Set the `accessoryType` of cell to `UITableViewCellAccessoryType.DisclosureIndicator`. – pkc456 Aug 23 '16 at 06:36
  • Okay thanks, I edited the question, can you tell me how I get the Header? – moxmlb Aug 23 '16 at 06:37
  • as @pkc456 says, custom cell is the only way to get your desired design, you can add a UIImageView as background and a label as title and from storyboard or by programmatically add UITableViewCellAccessoryType to DisclosureIndicator. – Subhash Sharma Aug 23 '16 at 06:40
  • Is your comment for the header or the list? – moxmlb Aug 23 '16 at 06:42
  • sorry when I was typing your question changed :P – Subhash Sharma Aug 23 '16 at 06:42
  • Note:- Please try not to post image as link. Custom header:- Set the translucent navigation bar. Set the [custom image](https://www.hackingwithswift.com/example-code/uikit/how-to-add-a-section-header-to-a-table-view) in your headerview. – pkc456 Aug 23 '16 at 06:44
  • Ok, Let me post all the above details in answer. – pkc456 Aug 23 '16 at 06:46
  • you can have it by using `UITableView` or `UICollectionView` – caldera.sac Aug 23 '16 at 06:47

2 Answers2

2
  • Implement the UITableView with customTableCell.
  • On your customTableCell class draw the custom design as shown in your requirement image. (Set a background image. Set a left aligned label.)
  • Implement the didSelectRowAtIndexPath delegate method to goto the next site.
  • Set the accessoryType of cell to UITableViewCellAccessoryType.DisclosureIndicator
  • Custom header:- Set the translucent navigation bar. Set the custom image in your headerview.
pkc456
  • 8,350
  • 38
  • 53
  • 109
0

You need to implement UITableView to achieve your requirements mentioned in question. You can use custom cell and can add UIImageview and UILabel on it to show image and title. Second thing you can implement tableHeaderView which can fullfill your need of header. Tableview is memory efficient with great performance. So, in your case UITableView is the right choice.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75