How to set first row of table view cell in sidebar different from all other rows - swift












0















I've created side menu as shown in this..and I want image view only for the first row with full name label so that if anybody clicks on image view of the first row, allow the user to choose an image from the gallery. moreover, all other rows should contain only the text which redirects to another view controller. Please suggest any link or any piece of code get image view only on the first row of side menu with a button to choose an image from gallery. Here is my code



var arrdata = ["Full name", "Home", "Favourite", "Logout"]
var arrimg = [#imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png")]

@IBOutlet var sidebar: UITableView!
@IBOutlet var sideview: UIView!

var isSideViewOpen: Bool = false

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
cell.img.image = arrimg[indexPath.row]
cell.lbl.text = arrdata[indexPath.row]
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 1
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let HomeViewController = storyBoard.instantiateViewController(withIdentifier: "Home") as! HomeViewController
self.present(HomeViewController, animated:true, completion:nil)
}

if indexPath.row == 3
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let ViewController = storyBoard.instantiateViewController(withIdentifier: "Login") as! ViewController
self.present(ViewController, animated:true, completion:nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
sideview.isHidden = true
sidebar.backgroundColor = UIColor.groupTableViewBackground
isSideViewOpen = false
}









share|improve this question

























  • Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

    – Rocky
    Nov 22 '18 at 11:09











  • will you please elaborate a little bit more @Rocky

    – kanu
    Nov 22 '18 at 11:20
















0















I've created side menu as shown in this..and I want image view only for the first row with full name label so that if anybody clicks on image view of the first row, allow the user to choose an image from the gallery. moreover, all other rows should contain only the text which redirects to another view controller. Please suggest any link or any piece of code get image view only on the first row of side menu with a button to choose an image from gallery. Here is my code



var arrdata = ["Full name", "Home", "Favourite", "Logout"]
var arrimg = [#imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png")]

@IBOutlet var sidebar: UITableView!
@IBOutlet var sideview: UIView!

var isSideViewOpen: Bool = false

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
cell.img.image = arrimg[indexPath.row]
cell.lbl.text = arrdata[indexPath.row]
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 1
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let HomeViewController = storyBoard.instantiateViewController(withIdentifier: "Home") as! HomeViewController
self.present(HomeViewController, animated:true, completion:nil)
}

if indexPath.row == 3
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let ViewController = storyBoard.instantiateViewController(withIdentifier: "Login") as! ViewController
self.present(ViewController, animated:true, completion:nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
sideview.isHidden = true
sidebar.backgroundColor = UIColor.groupTableViewBackground
isSideViewOpen = false
}









share|improve this question

























  • Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

    – Rocky
    Nov 22 '18 at 11:09











  • will you please elaborate a little bit more @Rocky

    – kanu
    Nov 22 '18 at 11:20














0












0








0








I've created side menu as shown in this..and I want image view only for the first row with full name label so that if anybody clicks on image view of the first row, allow the user to choose an image from the gallery. moreover, all other rows should contain only the text which redirects to another view controller. Please suggest any link or any piece of code get image view only on the first row of side menu with a button to choose an image from gallery. Here is my code



var arrdata = ["Full name", "Home", "Favourite", "Logout"]
var arrimg = [#imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png")]

@IBOutlet var sidebar: UITableView!
@IBOutlet var sideview: UIView!

var isSideViewOpen: Bool = false

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
cell.img.image = arrimg[indexPath.row]
cell.lbl.text = arrdata[indexPath.row]
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 1
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let HomeViewController = storyBoard.instantiateViewController(withIdentifier: "Home") as! HomeViewController
self.present(HomeViewController, animated:true, completion:nil)
}

if indexPath.row == 3
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let ViewController = storyBoard.instantiateViewController(withIdentifier: "Login") as! ViewController
self.present(ViewController, animated:true, completion:nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
sideview.isHidden = true
sidebar.backgroundColor = UIColor.groupTableViewBackground
isSideViewOpen = false
}









share|improve this question
















I've created side menu as shown in this..and I want image view only for the first row with full name label so that if anybody clicks on image view of the first row, allow the user to choose an image from the gallery. moreover, all other rows should contain only the text which redirects to another view controller. Please suggest any link or any piece of code get image view only on the first row of side menu with a button to choose an image from gallery. Here is my code



var arrdata = ["Full name", "Home", "Favourite", "Logout"]
var arrimg = [#imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png"), #imageLiteral(resourceName: "hello.png")]

@IBOutlet var sidebar: UITableView!
@IBOutlet var sideview: UIView!

var isSideViewOpen: Bool = false

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
cell.img.image = arrimg[indexPath.row]
cell.lbl.text = arrdata[indexPath.row]
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 1
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let HomeViewController = storyBoard.instantiateViewController(withIdentifier: "Home") as! HomeViewController
self.present(HomeViewController, animated:true, completion:nil)
}

if indexPath.row == 3
{
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let ViewController = storyBoard.instantiateViewController(withIdentifier: "Login") as! ViewController
self.present(ViewController, animated:true, completion:nil)
}
}
override func viewDidLoad() {
super.viewDidLoad()
sideview.isHidden = true
sidebar.backgroundColor = UIColor.groupTableViewBackground
isSideViewOpen = false
}






ios iphone uitableview swift4 xcode9.4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 7:08







kanu

















asked Nov 22 '18 at 10:31









kanukanu

34




34













  • Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

    – Rocky
    Nov 22 '18 at 11:09











  • will you please elaborate a little bit more @Rocky

    – kanu
    Nov 22 '18 at 11:20



















  • Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

    – Rocky
    Nov 22 '18 at 11:09











  • will you please elaborate a little bit more @Rocky

    – kanu
    Nov 22 '18 at 11:20

















Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

– Rocky
Nov 22 '18 at 11:09





Create two different UITableViewCell & in method cellForRowAt indexPath: use them as require.

– Rocky
Nov 22 '18 at 11:09













will you please elaborate a little bit more @Rocky

– kanu
Nov 22 '18 at 11:20





will you please elaborate a little bit more @Rocky

– kanu
Nov 22 '18 at 11:20












3 Answers
3






active

oldest

votes


















0














First, you will need your custom cell that has an image and the text.



Guide for Custom Cells



After that i would recommend having a list for configuration like



let shouldShowImage = [true, false, false, false, ...]



In your function cellForRowAt you should check if your cell must show the image like



if shouldShowImage[indexPath.row] {

cell.img.image = arrimg[indexPath.row]
} else {

cell.img.isHidden = true
}

cell.lbl.text = arrdata[indexPath.row]





share|improve this answer


























  • I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

    – kanu
    Nov 22 '18 at 11:52













  • To manage the height i would consider this

    – Jose Tomas
    Nov 22 '18 at 11:53













  • How would I write code for single row, Although I've created each and everything programmatically for the side menu use

    – kanu
    Nov 22 '18 at 11:54













  • Sorry, clicked enter too soon

    – Jose Tomas
    Nov 22 '18 at 11:56



















0














Privacy - Media Library Usage Description

Privacy - Camera Usage Description



1)First add these both keys into your Info.plist file...

2)Then add the button on your image view in your UI..
and give the constraint to them...

1) vertical centre with your image view

2) same hight with your image view.

3) same width with your image view.

4) give leading respect to your image view



3)class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate {



var arrdata = ["Choose Image","Full name", "Home", "Favourite", "Logout"]
var imgVw = UIImageView()
var arrImg = [UIImage(named: "home_bg")]
@IBOutlet var tblVw: UITableView!

override func viewDidLoad() {
super.viewDidLoad()
imgVw.image = UIImage(named: "GalleryIcon")

tblVw.delegate = self
tblVw.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell") as! DemoCell
if indexPath.row == 0 {
cell.imgvw.image = imgVw.image
cell.lbl.text = "Choose Image"
}
else
{
cell.lbl.text = arrdata[indexPath.row]
cell.imgvw.image = arrImg[0]
}
cell.selectionStyle = .none
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0
{
let indexPh = tableView.indexPathForSelectedRow
let cell = tableView.cellForRow(at: indexPh!) as! DemoCell
cell.btn.isHidden = false
cell.btn.addTarget(self, action: #selector(btnChooseImageAction), for: .touchUpInside)
}
}

@objc private func btnChooseImageAction() {
let alert = UIAlertController(title: "Choose Image", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (camera) in
self.openCamera()
}))
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { (gallery) in
self.openGallery()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}

//MARK: -Camera image picker functionality
func openCamera()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
else
{
let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK: - Gallery image picker functionality:
func openGallery()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(imagePicker, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Warningq", message: "You don't have perission to access gallery.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK:-- ImagePicker delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imgVw.image = pickedImage
tblVw.reloadData()
}
picker.dismiss(animated: true, completion: nil)
}


}






share|improve this answer
























  • Not Working, Getting lots of error - @vinay gupta

    – kanu
    Nov 22 '18 at 13:23











  • Can u please show me what error it's showing u .

    – vinay gupta
    Nov 23 '18 at 5:14











  • 1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

    – kanu
    Nov 23 '18 at 5:49













  • I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

    – kanu
    Nov 23 '18 at 5:52



















0














Hey i updated the answer please check.
Ohkay so if you want two different view you will need to create 2 different UITableViewCells.



One cell will contain your imageView and Label and the other one will contain just a button.



Register both the cell's nib using



tableView.register(UINib(nibName: "your_nib_name", bundle: nil), forCellReuseIdentifier: "your_cell_identifier") method.



Now simply follow this method in cellForRowAt method



if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_image_label_cell", for: indexPath) as! your_image_label_cell_className

//your code here
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_button_cell_identifier", for: indexPath) as! your_button_cell_className

//your code here
return cell
}


What i did was i checked that if its the 1st row indexpath.row == 0 it will return the label with image cell, else for all other rows it will return a cell with a button on which you can add tap action event for navigating to different screens.



Similarly, if you want a different tap in the first row you use indexPath.row == 0 in didSelectRowAt method and you are done. Hope this was helpful.






share|improve this answer


























  • no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

    – kanu
    Nov 22 '18 at 11:42













  • @kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

    – Zahurafzal Mirza
    Nov 23 '18 at 6:41











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428918%2fhow-to-set-first-row-of-table-view-cell-in-sidebar-different-from-all-other-rows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














First, you will need your custom cell that has an image and the text.



Guide for Custom Cells



After that i would recommend having a list for configuration like



let shouldShowImage = [true, false, false, false, ...]



In your function cellForRowAt you should check if your cell must show the image like



if shouldShowImage[indexPath.row] {

cell.img.image = arrimg[indexPath.row]
} else {

cell.img.isHidden = true
}

cell.lbl.text = arrdata[indexPath.row]





share|improve this answer


























  • I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

    – kanu
    Nov 22 '18 at 11:52













  • To manage the height i would consider this

    – Jose Tomas
    Nov 22 '18 at 11:53













  • How would I write code for single row, Although I've created each and everything programmatically for the side menu use

    – kanu
    Nov 22 '18 at 11:54













  • Sorry, clicked enter too soon

    – Jose Tomas
    Nov 22 '18 at 11:56
















0














First, you will need your custom cell that has an image and the text.



Guide for Custom Cells



After that i would recommend having a list for configuration like



let shouldShowImage = [true, false, false, false, ...]



In your function cellForRowAt you should check if your cell must show the image like



if shouldShowImage[indexPath.row] {

cell.img.image = arrimg[indexPath.row]
} else {

cell.img.isHidden = true
}

cell.lbl.text = arrdata[indexPath.row]





share|improve this answer


























  • I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

    – kanu
    Nov 22 '18 at 11:52













  • To manage the height i would consider this

    – Jose Tomas
    Nov 22 '18 at 11:53













  • How would I write code for single row, Although I've created each and everything programmatically for the side menu use

    – kanu
    Nov 22 '18 at 11:54













  • Sorry, clicked enter too soon

    – Jose Tomas
    Nov 22 '18 at 11:56














0












0








0







First, you will need your custom cell that has an image and the text.



Guide for Custom Cells



After that i would recommend having a list for configuration like



let shouldShowImage = [true, false, false, false, ...]



In your function cellForRowAt you should check if your cell must show the image like



if shouldShowImage[indexPath.row] {

cell.img.image = arrimg[indexPath.row]
} else {

cell.img.isHidden = true
}

cell.lbl.text = arrdata[indexPath.row]





share|improve this answer















First, you will need your custom cell that has an image and the text.



Guide for Custom Cells



After that i would recommend having a list for configuration like



let shouldShowImage = [true, false, false, false, ...]



In your function cellForRowAt you should check if your cell must show the image like



if shouldShowImage[indexPath.row] {

cell.img.image = arrimg[indexPath.row]
} else {

cell.img.isHidden = true
}

cell.lbl.text = arrdata[indexPath.row]






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 '18 at 11:32

























answered Nov 22 '18 at 11:22









Jose TomasJose Tomas

6317




6317













  • I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

    – kanu
    Nov 22 '18 at 11:52













  • To manage the height i would consider this

    – Jose Tomas
    Nov 22 '18 at 11:53













  • How would I write code for single row, Although I've created each and everything programmatically for the side menu use

    – kanu
    Nov 22 '18 at 11:54













  • Sorry, clicked enter too soon

    – Jose Tomas
    Nov 22 '18 at 11:56



















  • I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

    – kanu
    Nov 22 '18 at 11:52













  • To manage the height i would consider this

    – Jose Tomas
    Nov 22 '18 at 11:53













  • How would I write code for single row, Although I've created each and everything programmatically for the side menu use

    – kanu
    Nov 22 '18 at 11:54













  • Sorry, clicked enter too soon

    – Jose Tomas
    Nov 22 '18 at 11:56

















I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

– kanu
Nov 22 '18 at 11:52







I've tried your given code...But the problem is the only image is hiding from all other rows but I also want to change the height or to manage height according to the text - @Jose Tomas

– kanu
Nov 22 '18 at 11:52















To manage the height i would consider this

– Jose Tomas
Nov 22 '18 at 11:53







To manage the height i would consider this

– Jose Tomas
Nov 22 '18 at 11:53















How would I write code for single row, Although I've created each and everything programmatically for the side menu use

– kanu
Nov 22 '18 at 11:54







How would I write code for single row, Although I've created each and everything programmatically for the side menu use

– kanu
Nov 22 '18 at 11:54















Sorry, clicked enter too soon

– Jose Tomas
Nov 22 '18 at 11:56





Sorry, clicked enter too soon

– Jose Tomas
Nov 22 '18 at 11:56













0














Privacy - Media Library Usage Description

Privacy - Camera Usage Description



1)First add these both keys into your Info.plist file...

2)Then add the button on your image view in your UI..
and give the constraint to them...

1) vertical centre with your image view

2) same hight with your image view.

3) same width with your image view.

4) give leading respect to your image view



3)class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate {



var arrdata = ["Choose Image","Full name", "Home", "Favourite", "Logout"]
var imgVw = UIImageView()
var arrImg = [UIImage(named: "home_bg")]
@IBOutlet var tblVw: UITableView!

override func viewDidLoad() {
super.viewDidLoad()
imgVw.image = UIImage(named: "GalleryIcon")

tblVw.delegate = self
tblVw.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell") as! DemoCell
if indexPath.row == 0 {
cell.imgvw.image = imgVw.image
cell.lbl.text = "Choose Image"
}
else
{
cell.lbl.text = arrdata[indexPath.row]
cell.imgvw.image = arrImg[0]
}
cell.selectionStyle = .none
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0
{
let indexPh = tableView.indexPathForSelectedRow
let cell = tableView.cellForRow(at: indexPh!) as! DemoCell
cell.btn.isHidden = false
cell.btn.addTarget(self, action: #selector(btnChooseImageAction), for: .touchUpInside)
}
}

@objc private func btnChooseImageAction() {
let alert = UIAlertController(title: "Choose Image", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (camera) in
self.openCamera()
}))
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { (gallery) in
self.openGallery()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}

//MARK: -Camera image picker functionality
func openCamera()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
else
{
let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK: - Gallery image picker functionality:
func openGallery()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(imagePicker, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Warningq", message: "You don't have perission to access gallery.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK:-- ImagePicker delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imgVw.image = pickedImage
tblVw.reloadData()
}
picker.dismiss(animated: true, completion: nil)
}


}






share|improve this answer
























  • Not Working, Getting lots of error - @vinay gupta

    – kanu
    Nov 22 '18 at 13:23











  • Can u please show me what error it's showing u .

    – vinay gupta
    Nov 23 '18 at 5:14











  • 1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

    – kanu
    Nov 23 '18 at 5:49













  • I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

    – kanu
    Nov 23 '18 at 5:52
















0














Privacy - Media Library Usage Description

Privacy - Camera Usage Description



1)First add these both keys into your Info.plist file...

2)Then add the button on your image view in your UI..
and give the constraint to them...

1) vertical centre with your image view

2) same hight with your image view.

3) same width with your image view.

4) give leading respect to your image view



3)class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate {



var arrdata = ["Choose Image","Full name", "Home", "Favourite", "Logout"]
var imgVw = UIImageView()
var arrImg = [UIImage(named: "home_bg")]
@IBOutlet var tblVw: UITableView!

override func viewDidLoad() {
super.viewDidLoad()
imgVw.image = UIImage(named: "GalleryIcon")

tblVw.delegate = self
tblVw.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell") as! DemoCell
if indexPath.row == 0 {
cell.imgvw.image = imgVw.image
cell.lbl.text = "Choose Image"
}
else
{
cell.lbl.text = arrdata[indexPath.row]
cell.imgvw.image = arrImg[0]
}
cell.selectionStyle = .none
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0
{
let indexPh = tableView.indexPathForSelectedRow
let cell = tableView.cellForRow(at: indexPh!) as! DemoCell
cell.btn.isHidden = false
cell.btn.addTarget(self, action: #selector(btnChooseImageAction), for: .touchUpInside)
}
}

@objc private func btnChooseImageAction() {
let alert = UIAlertController(title: "Choose Image", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (camera) in
self.openCamera()
}))
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { (gallery) in
self.openGallery()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}

//MARK: -Camera image picker functionality
func openCamera()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
else
{
let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK: - Gallery image picker functionality:
func openGallery()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(imagePicker, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Warningq", message: "You don't have perission to access gallery.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK:-- ImagePicker delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imgVw.image = pickedImage
tblVw.reloadData()
}
picker.dismiss(animated: true, completion: nil)
}


}






share|improve this answer
























  • Not Working, Getting lots of error - @vinay gupta

    – kanu
    Nov 22 '18 at 13:23











  • Can u please show me what error it's showing u .

    – vinay gupta
    Nov 23 '18 at 5:14











  • 1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

    – kanu
    Nov 23 '18 at 5:49













  • I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

    – kanu
    Nov 23 '18 at 5:52














0












0








0







Privacy - Media Library Usage Description

Privacy - Camera Usage Description



1)First add these both keys into your Info.plist file...

2)Then add the button on your image view in your UI..
and give the constraint to them...

1) vertical centre with your image view

2) same hight with your image view.

3) same width with your image view.

4) give leading respect to your image view



3)class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate {



var arrdata = ["Choose Image","Full name", "Home", "Favourite", "Logout"]
var imgVw = UIImageView()
var arrImg = [UIImage(named: "home_bg")]
@IBOutlet var tblVw: UITableView!

override func viewDidLoad() {
super.viewDidLoad()
imgVw.image = UIImage(named: "GalleryIcon")

tblVw.delegate = self
tblVw.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell") as! DemoCell
if indexPath.row == 0 {
cell.imgvw.image = imgVw.image
cell.lbl.text = "Choose Image"
}
else
{
cell.lbl.text = arrdata[indexPath.row]
cell.imgvw.image = arrImg[0]
}
cell.selectionStyle = .none
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0
{
let indexPh = tableView.indexPathForSelectedRow
let cell = tableView.cellForRow(at: indexPh!) as! DemoCell
cell.btn.isHidden = false
cell.btn.addTarget(self, action: #selector(btnChooseImageAction), for: .touchUpInside)
}
}

@objc private func btnChooseImageAction() {
let alert = UIAlertController(title: "Choose Image", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (camera) in
self.openCamera()
}))
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { (gallery) in
self.openGallery()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}

//MARK: -Camera image picker functionality
func openCamera()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
else
{
let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK: - Gallery image picker functionality:
func openGallery()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(imagePicker, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Warningq", message: "You don't have perission to access gallery.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK:-- ImagePicker delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imgVw.image = pickedImage
tblVw.reloadData()
}
picker.dismiss(animated: true, completion: nil)
}


}






share|improve this answer













Privacy - Media Library Usage Description

Privacy - Camera Usage Description



1)First add these both keys into your Info.plist file...

2)Then add the button on your image view in your UI..
and give the constraint to them...

1) vertical centre with your image view

2) same hight with your image view.

3) same width with your image view.

4) give leading respect to your image view



3)class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate {



var arrdata = ["Choose Image","Full name", "Home", "Favourite", "Logout"]
var imgVw = UIImageView()
var arrImg = [UIImage(named: "home_bg")]
@IBOutlet var tblVw: UITableView!

override func viewDidLoad() {
super.viewDidLoad()
imgVw.image = UIImage(named: "GalleryIcon")

tblVw.delegate = self
tblVw.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrdata.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell") as! DemoCell
if indexPath.row == 0 {
cell.imgvw.image = imgVw.image
cell.lbl.text = "Choose Image"
}
else
{
cell.lbl.text = arrdata[indexPath.row]
cell.imgvw.image = arrImg[0]
}
cell.selectionStyle = .none
return cell
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0
{
let indexPh = tableView.indexPathForSelectedRow
let cell = tableView.cellForRow(at: indexPh!) as! DemoCell
cell.btn.isHidden = false
cell.btn.addTarget(self, action: #selector(btnChooseImageAction), for: .touchUpInside)
}
}

@objc private func btnChooseImageAction() {
let alert = UIAlertController(title: "Choose Image", message: "", preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (camera) in
self.openCamera()
}))
alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { (gallery) in
self.openGallery()
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}

//MARK: -Camera image picker functionality
func openCamera()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker, animated: true, completion: nil)
}
else
{
let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK: - Gallery image picker functionality:
func openGallery()
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(imagePicker, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Warningq", message: "You don't have perission to access gallery.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

//MARK:-- ImagePicker delegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
imgVw.image = pickedImage
tblVw.reloadData()
}
picker.dismiss(animated: true, completion: nil)
}


}







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 12:49









vinay guptavinay gupta

11




11













  • Not Working, Getting lots of error - @vinay gupta

    – kanu
    Nov 22 '18 at 13:23











  • Can u please show me what error it's showing u .

    – vinay gupta
    Nov 23 '18 at 5:14











  • 1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

    – kanu
    Nov 23 '18 at 5:49













  • I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

    – kanu
    Nov 23 '18 at 5:52



















  • Not Working, Getting lots of error - @vinay gupta

    – kanu
    Nov 22 '18 at 13:23











  • Can u please show me what error it's showing u .

    – vinay gupta
    Nov 23 '18 at 5:14











  • 1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

    – kanu
    Nov 23 '18 at 5:49













  • I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

    – kanu
    Nov 23 '18 at 5:52

















Not Working, Getting lots of error - @vinay gupta

– kanu
Nov 22 '18 at 13:23





Not Working, Getting lots of error - @vinay gupta

– kanu
Nov 22 '18 at 13:23













Can u please show me what error it's showing u .

– vinay gupta
Nov 23 '18 at 5:14





Can u please show me what error it's showing u .

– vinay gupta
Nov 23 '18 at 5:14













1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

– kanu
Nov 23 '18 at 5:49







1. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 2. Instance member 'sourceType' cannot be used on type 'UIImagePickerController' 3. 'InfoKey' is not a member type of 'UIImagePickerController'

– kanu
Nov 23 '18 at 5:49















I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

– kanu
Nov 23 '18 at 5:52





I'm getting Similar kind of error for camera but i've resolved for open camera code but its difficult for open gallery option

– kanu
Nov 23 '18 at 5:52











0














Hey i updated the answer please check.
Ohkay so if you want two different view you will need to create 2 different UITableViewCells.



One cell will contain your imageView and Label and the other one will contain just a button.



Register both the cell's nib using



tableView.register(UINib(nibName: "your_nib_name", bundle: nil), forCellReuseIdentifier: "your_cell_identifier") method.



Now simply follow this method in cellForRowAt method



if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_image_label_cell", for: indexPath) as! your_image_label_cell_className

//your code here
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_button_cell_identifier", for: indexPath) as! your_button_cell_className

//your code here
return cell
}


What i did was i checked that if its the 1st row indexpath.row == 0 it will return the label with image cell, else for all other rows it will return a cell with a button on which you can add tap action event for navigating to different screens.



Similarly, if you want a different tap in the first row you use indexPath.row == 0 in didSelectRowAt method and you are done. Hope this was helpful.






share|improve this answer


























  • no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

    – kanu
    Nov 22 '18 at 11:42













  • @kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

    – Zahurafzal Mirza
    Nov 23 '18 at 6:41
















0














Hey i updated the answer please check.
Ohkay so if you want two different view you will need to create 2 different UITableViewCells.



One cell will contain your imageView and Label and the other one will contain just a button.



Register both the cell's nib using



tableView.register(UINib(nibName: "your_nib_name", bundle: nil), forCellReuseIdentifier: "your_cell_identifier") method.



Now simply follow this method in cellForRowAt method



if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_image_label_cell", for: indexPath) as! your_image_label_cell_className

//your code here
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_button_cell_identifier", for: indexPath) as! your_button_cell_className

//your code here
return cell
}


What i did was i checked that if its the 1st row indexpath.row == 0 it will return the label with image cell, else for all other rows it will return a cell with a button on which you can add tap action event for navigating to different screens.



Similarly, if you want a different tap in the first row you use indexPath.row == 0 in didSelectRowAt method and you are done. Hope this was helpful.






share|improve this answer


























  • no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

    – kanu
    Nov 22 '18 at 11:42













  • @kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

    – Zahurafzal Mirza
    Nov 23 '18 at 6:41














0












0








0







Hey i updated the answer please check.
Ohkay so if you want two different view you will need to create 2 different UITableViewCells.



One cell will contain your imageView and Label and the other one will contain just a button.



Register both the cell's nib using



tableView.register(UINib(nibName: "your_nib_name", bundle: nil), forCellReuseIdentifier: "your_cell_identifier") method.



Now simply follow this method in cellForRowAt method



if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_image_label_cell", for: indexPath) as! your_image_label_cell_className

//your code here
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_button_cell_identifier", for: indexPath) as! your_button_cell_className

//your code here
return cell
}


What i did was i checked that if its the 1st row indexpath.row == 0 it will return the label with image cell, else for all other rows it will return a cell with a button on which you can add tap action event for navigating to different screens.



Similarly, if you want a different tap in the first row you use indexPath.row == 0 in didSelectRowAt method and you are done. Hope this was helpful.






share|improve this answer















Hey i updated the answer please check.
Ohkay so if you want two different view you will need to create 2 different UITableViewCells.



One cell will contain your imageView and Label and the other one will contain just a button.



Register both the cell's nib using



tableView.register(UINib(nibName: "your_nib_name", bundle: nil), forCellReuseIdentifier: "your_cell_identifier") method.



Now simply follow this method in cellForRowAt method



if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_image_label_cell", for: indexPath) as! your_image_label_cell_className

//your code here
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "your_button_cell_identifier", for: indexPath) as! your_button_cell_className

//your code here
return cell
}


What i did was i checked that if its the 1st row indexpath.row == 0 it will return the label with image cell, else for all other rows it will return a cell with a button on which you can add tap action event for navigating to different screens.



Similarly, if you want a different tap in the first row you use indexPath.row == 0 in didSelectRowAt method and you are done. Hope this was helpful.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 6:39

























answered Nov 22 '18 at 11:25









Zahurafzal MirzaZahurafzal Mirza

13010




13010













  • no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

    – kanu
    Nov 22 '18 at 11:42













  • @kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

    – Zahurafzal Mirza
    Nov 23 '18 at 6:41



















  • no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

    – kanu
    Nov 22 '18 at 11:42













  • @kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

    – Zahurafzal Mirza
    Nov 23 '18 at 6:41

















no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

– kanu
Nov 22 '18 at 11:42







no..no I also want the label in the first row of table view cell...I want image only in the first row and all other rows should contain a button to navigate to another view controller @Zahurafzal Mirza

– kanu
Nov 22 '18 at 11:42















@kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

– Zahurafzal Mirza
Nov 23 '18 at 6:41





@kanu Please check i updated the answer. Update me if it works and if it does dont forget to upvote bro. Thanks :D

– Zahurafzal Mirza
Nov 23 '18 at 6:41


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428918%2fhow-to-set-first-row-of-table-view-cell-in-sidebar-different-from-all-other-rows%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python