Reputation: 224
I know the tableview header and footer but I want to add UIView between the row of tableview in objective-c. and uiview have three button also.
but how can it possible. Anybody can help me..
Upvotes: 2
Views: 772
Reputation: 1321
Suppose I have a UIView and I am creating its object in Controller class in which I have TableView:
var obj_ProfileView : UserProfileView!
In ViewDidLoad Method:
self.obj_ProfileView = Bundle.main.loadNibNamed("UserProfileView", owner: self, options: nil)![0] as! UserProfileView
Then In TableViewFooter Method:
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat
{
if section == 0
{
//Do as per your requirements
return 184.0
}
else
{
//Do as per your requirements
return 45.0
}
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
{
if section == 0
{
return obj_ProfileView
}
else{
return nil
}
}
Upvotes: 0
Reputation: 113
Every UITableViewCell
is a child of UIView
class.
So in effect all your cells are UIViews which you can customize in any way you want.
So what you want to do is use custom cell. Create a model class for it, customize it as you want.
Upvotes: 1
Reputation: 171
You can not add UIView
in between two row or cell of UITableView
. You need to customise your cells. And while filling data to your datasource of UITableView
you need some kind of indications which you need to match in your cellForRowAtIndexPath
method of UITableView
and based on condition you need to show your data cell or custom UIView
which is already in your custom cell.
Upvotes: 2