what approach should i follow - swift
how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.
and all cell are clickable (push to another Viewcontroller)
ios swift tableview
add a comment |
how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.
and all cell are clickable (push to another Viewcontroller)
ios swift tableview
1
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
2
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is agrouped
style tableView, returning different types of cells in-cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27
add a comment |
how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.
and all cell are clickable (push to another Viewcontroller)
ios swift tableview
how can i build the same design like this ... please guide me i just want an idea that how i can achieve the same view. i know what is tableview and all but thing is how to populate tableview with three different cell type and there postion is not fixed depend on beckend.
and all cell are clickable (push to another Viewcontroller)
ios swift tableview
ios swift tableview
asked Nov 15 '18 at 10:30
harinder ranaharinder rana
177
177
1
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
2
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is agrouped
style tableView, returning different types of cells in-cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27
add a comment |
1
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
2
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is agrouped
style tableView, returning different types of cells in-cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27
1
1
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
2
2
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a
grouped
style tableView, returning different types of cells in -cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a
grouped
style tableView, returning different types of cells in -cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27
add a comment |
2 Answers
2
active
oldest
votes
In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.
to register a prototype cell programatically use
func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
if you use storyboard - you can simply drags multiple cells into the tableview
then in the
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
you dequeue the right cell type
func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?
cell is "selectable" by utilising the tableview's delegate method
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
add a comment |
In order to create this view the easiest way from my side is
Create a simple collection view with different sections and in each section, multiple rows will be there
Here you check the screenshot of demoapp :
http://prntscr.com/lioqjz
Where section and rows both are dynamic
To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:
extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
//If you have different rows with different sections then you follow through array count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell
cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
return cell
}
}
and here is the SS of storyboard:
http://prntscr.com/liosvm
And to cell use to clickable, you can add UITapgesture in each cell
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317375%2fwhat-approach-should-i-follow-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.
to register a prototype cell programatically use
func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
if you use storyboard - you can simply drags multiple cells into the tableview
then in the
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
you dequeue the right cell type
func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?
cell is "selectable" by utilising the tableview's delegate method
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
add a comment |
In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.
to register a prototype cell programatically use
func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
if you use storyboard - you can simply drags multiple cells into the tableview
then in the
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
you dequeue the right cell type
func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?
cell is "selectable" by utilising the tableview's delegate method
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
add a comment |
In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.
to register a prototype cell programatically use
func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
if you use storyboard - you can simply drags multiple cells into the tableview
then in the
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
you dequeue the right cell type
func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?
cell is "selectable" by utilising the tableview's delegate method
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
In order to provide diff cells (does't matter if in different sections or only a single one) all you need to do is to register multiple different "prototypes" of cells (each with diff layout/style/etc.) with the table view. You can then use your "business logic" to dequeue (if reusable) specific "type" as you need.
to register a prototype cell programatically use
func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
if you use storyboard - you can simply drags multiple cells into the tableview
then in the
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
you dequeue the right cell type
func dequeueReusableCell(withIdentifier identifier: String) -> UITableViewCell?
cell is "selectable" by utilising the tableview's delegate method
optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
answered Nov 15 '18 at 11:19
Peter PajchlPeter Pajchl
2,2321624
2,2321624
add a comment |
add a comment |
In order to create this view the easiest way from my side is
Create a simple collection view with different sections and in each section, multiple rows will be there
Here you check the screenshot of demoapp :
http://prntscr.com/lioqjz
Where section and rows both are dynamic
To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:
extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
//If you have different rows with different sections then you follow through array count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell
cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
return cell
}
}
and here is the SS of storyboard:
http://prntscr.com/liosvm
And to cell use to clickable, you can add UITapgesture in each cell
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
add a comment |
In order to create this view the easiest way from my side is
Create a simple collection view with different sections and in each section, multiple rows will be there
Here you check the screenshot of demoapp :
http://prntscr.com/lioqjz
Where section and rows both are dynamic
To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:
extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
//If you have different rows with different sections then you follow through array count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell
cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
return cell
}
}
and here is the SS of storyboard:
http://prntscr.com/liosvm
And to cell use to clickable, you can add UITapgesture in each cell
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
add a comment |
In order to create this view the easiest way from my side is
Create a simple collection view with different sections and in each section, multiple rows will be there
Here you check the screenshot of demoapp :
http://prntscr.com/lioqjz
Where section and rows both are dynamic
To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:
extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
//If you have different rows with different sections then you follow through array count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell
cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
return cell
}
}
and here is the SS of storyboard:
http://prntscr.com/liosvm
And to cell use to clickable, you can add UITapgesture in each cell
In order to create this view the easiest way from my side is
Create a simple collection view with different sections and in each section, multiple rows will be there
Here you check the screenshot of demoapp :
http://prntscr.com/lioqjz
Where section and rows both are dynamic
To do this view we are using UICollectionreusableview to give space between each sections using as footer view, Here is the code of collectionview implementation:
extension ViewController:UICollectionViewDelegate,UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
//If you have different rows with different sections then you follow through array count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"Cell", for: indexPath) as! customCollectionViewCell
cell.txtLabel.text="Type="+String(indexPath.section)+""+String(indexPath.row)
return cell
}
}
and here is the SS of storyboard:
http://prntscr.com/liosvm
And to cell use to clickable, you can add UITapgesture in each cell
edited Nov 15 '18 at 12:30
answered Nov 15 '18 at 12:23
khusboo suhasinikhusboo suhasini
205111
205111
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
add a comment |
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
the exact view i want to build is this link link 2
– harinder rana
Nov 15 '18 at 13:20
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
Okay i will update my answer,first check this ss and tell me the exact requirement prntscr.com/liq62g
– khusboo suhasini
Nov 15 '18 at 13:56
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
imageView is not required
– harinder rana
Nov 16 '18 at 10:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317375%2fwhat-approach-should-i-follow-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
It just looks like a tableview with 3 sections. There are plenty of tutorials available on UITableView if you haven't worked with them before.
– Paulw11
Nov 15 '18 at 10:34
@Paulw11 but the thing is there are three different types of cell and the position of cell is not fixed
– harinder rana
Nov 15 '18 at 10:37
2
Still, there are more than enough tutorials on the subject. Here are some hints for you: This is a
grouped
style tableView, returning different types of cells in-cellForRowAtIndexPath:
– Alladinian
Nov 15 '18 at 10:42
you are not getting my point , here the cells are not fixed
– harinder rana
Nov 15 '18 at 11:06
Do you mean the location of he various cell groups are not fixed? You need to explain your problem more clearly. If you are talking about layout, you need to determine the layout requirements and write the code.
– Paulw11
Nov 15 '18 at 19:27