Auto layout is disabled.
On the view I have UINavigationBar at the top.
I have added UITableView in the XIB file (grouped) and set it in the IB to be at the top just bellow navigation bar.
But some strange gaps are displayed like on the images bellow.
I can't figure how to setup this layout I don't know from where gaps are comming. Any help (I use IOS 7 xcode 5)?
UPDATE
When I add your code:
Then I have tried from xcode again:
Simple set height of header 0.00001, if you set 0 it will be use auto value.
- (float)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0.00000001;
}
From Interface Builder
Result
Set edgesForExtendedLayout of your controller to uirectedgenone
Related
I have a an app in IOS 6. Now i am try to make it compatible with IOS 7.
I have a search bar controller. All works good in IOS 6. I have used UISearch Display Controller.
But in IOS 7 content size of table view not set correctly.
While i dont search any thing :
But if i search any anything than click on list view and scroll i have this out put :
![enter image description here][2]
You can see the white space below.
- (NSInteger)tableView:(UITableView *)tableView1 sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
if (title == UITableViewIndexSearch) {
[tblData scrollRectToVisible:self.searchDisplayController.searchBar.frame animated:NO];
return -1;
}
}
Thanks for Help
As you mentioned in the comment, you have a custom cell, maybe with custom layout and view hierarchy. Be sure to add views to the cell's contentView instead the cell, that is changed in iOS7.
I have a UISearchBar linked with a UISearchDisplayController in the header of a UITableView in iOS7.
I set the UISearchBar with the style minimal. When the searchdisplaycontroller shows his table it has the behavior of the picture below. The table is scrolling above the searchbar. When I switch the style of the tableview to Prominent the table scrolls under the searchbar as expected.
Is this a bug or this behavior is expected?
The text isn't floating above the search bar, it's going below. Minimal style doesn't provide a background so this is expected. It will, however, provide a background during activation if there is a navigation bar present (Minimal style really wants to be over either no content or blurred content).
You are free to add your own custom background if you'd like.
Try with
self.edgesForExtendedLayout = UIRectEdgeNone;
in viewDidLoad method. It works for me.
I think this issue may for the Auto-Layout or Auto-Resizing. Just check in the nib file in insppector view.
Make the x=0 and y=0 for search bar and for tableview x=0 and y=44 , now you will get the tableview below the searchbar.
I added UISearchBar as tableHeaderView for UITableView in xib, by just dropping UISearchBar onto UITableView.
It is working fine, when the table has more than 6 rows.
But when there is less than 6 rows, it UITableView does not scroll.
At the same time, if i add the UISearchBar as tableHeaderView for UITableView programatically in .m file using the following statement, EVERYTHING WORKS FINE.
tableViewTemp.tableHeaderView = searchBarFriends;
Seems very strange to me,
What might be the problem?
Please advice, Thank you.
Here is a little trick I did ;) Don't make your SearchBar a subview of your UITableView. Just add instances of them both in your nib file and wire them up as IBOutlets in your UITableViewController. Then what you are going to do is set the SearchBar as the header view for your table, that way you don't have to worry about the frames overlapping and interfering with touch events. Here's how you do it:
Create the property in your TableView header file
#property ( nonatomic, retain ) IBOutlet UISearchBar *searchBar;
Set the header view for your table:
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return self.searchBar; // The property you wired up in IB
}
Set the height for your header or (UISearchBar)
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 44; // The height of the search bar
}
That's all you need. Now this may not be the best solution if you have a grouped tableview or a table with multiple sections but its a clean solution for a simple table. Otherwise, you'd have to adjust the frame of the searchbar AND the tableview in code because they overlap and thats why you have touch issues. Hope this helps!
if you add search bar like below hierarchy it will work
I had almost the same problem (for me it wouldn't scroll at all with any number of rows, but it would as soon as I removed the search bar). Fixed it adding this in viewDidLoad:
self.tableView.alwaysBounceVertical = YES;
How does the table view appear with rounded corners (as shown below)?
I would appreciate any sample code or may be some tutorial for having the table look rounded in the corners. Each section title also appears different from the conventional way..
It is a UITableViewStyleGrouped you can initialize it with:
- (id)initWithFrame:(CGRect)frame style:UITableViewStyleGrouped
You can implement datasource and delegate methods for UITableView and take Custom UITableView cell which has UITextField or add UITextField as sub view in cell's contentView
Does anyone have the same problem as I do? ... I've upgraded to the iPhone SDK 3.2 and I am unable to resize UITableViewCell object in my XIB file (usually I've been just resizing the view but now the cell has the same size and there is just a grey are around) ... btw, I've tried to reinstall twice including one deep reinstall.
Hey I had this same issue. This is old, so maybe you found a solution already, but for those who haven't...
Select the cell in IB, and bring up the size panel (by clicking to it or with command-3). Under size & position, set to frame, and edit the height box there.
Easy, huh. Don't know how we missed this.
The tableviewcell size can be set by dragging the cell frame in the interface builder.
Then implement then tableview delegate tableView heightForRowAtIndexPath for the particular cell you want to have a different height.
I have 3.2 installed and don't have that issue. Check that you are returning the correct cell height for heightForRowAtIndexPath. So for a cell at section zero, row zero (that uses a custom UITableViewCell), use the height of the cell defined in the XIB:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 0 && indexPath.row == 0)
return m_customCell.frame.size.height;
else
return 44;
}
first tab (Attributes) -> subtab(Simulated User Interface Elements) -> Status Bar: set(Unspecified) . Worked for me
The accepted answer (selecting the TableCell) and using the inspector did not work for me with XCODE 5.
This worked:
- In interface builder, select the TABLE VIEW (NOT the TableViewCell).
- Then in inspector (Size Inspector), notice at the top "Row Height". Set that as desired.
- Also notice Section Height can be set here too!
Final note, the table cell can definitely be drag/resized as well.