Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set top margin of table view in iOS?

I am new to iOS development, and my code is running fine in iOS6, but in iOS7 it has some UI issues.

Please see following image. I wanted to add margin to table view, but as stated it was perfect in iOS 6. Question may seem very basic, but I am trying to find any property using which I can add margin.

Secondly, if I need to do it programmatically, please suggest where I should write the code.

I tried to search on google, but may be I am not able to search with correct terms. I am C++ developer and new to Objective C and Mac.

enter image description here

like image 265
Pranit Kothari Avatar asked Apr 17 '14 09:04

Pranit Kothari


1 Answers

You can do this by setting your tableViews contentInset or contentOffset depending on your needs.

[self.tableView setContentInset:UIEdgeInsetsMake(top, left, bottom, right)];
like image 91
ClemensL Avatar answered Oct 02 '22 02:10

ClemensL