Why is my UITableView cut off in iOS 7? - uitableview

In iOS 6, my login tableview that consisted of two rows (Username and Password) was completely shown correctly. In iOS 7, the bottom row is cut off, and I don't know why or how to correct the issue. Nothing changed except for upgrading to Xcode 5 and running on the iOS 7 simulator.
UPDATE: adding more images

try playing with navigationBar.translucent property in your view controller. in iOS 6 it is NO by default, but YES in iOS 7. I had a similar issue and this fixed it for me.

Just check your UITableView frame in iOS7, may be you are running it on 3.5 inch view and it will shrink.

Looking at the provided image, I think you may be underlapping the nav bar. Or to put it another way, your nav bar is on top of hte table. Though I'm not sure why that would cut off the bottom of the login information

I've found that simply changing from GROUPED to PLAIN table view style fixes the "underlap" issue with the section #0 header, but modifies the color of the section header views. I set the tableview background color in my app. With PLAIN style, the section header background color is messed up. The section header color is close to the tableview background color, but slightly modified. This does NOT happen if I simply switch back to GROUPED. It sounds like an iOS7 bug or an Xcode bug.

The translucent = NO fixed it for some cases. In others, I ended up adjusting the tableView in viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect f = self.tableView.frame;
f.origin.y += self.navigationController.navigationBar.frame.size.height;
f.size.height -= self.navigationController.navigationBar.frame.size.height;
self.tableView.frame = f;
}

This is obviously some kind of issue with the grouped table view style. All I had to to was go into the storyboard scene, select the table view, then in the attributes inspector change the style from grouped to plain. It works as intended now without being cut off.

Related

iOS 7 have a trouble about layout

My app use uitabbar and uinavigationbar.but I encounter a problem in iOS7.1. if I switch page between one with navigationbar and one without navigationbar. the page have scrollview or uitableview,every time swith,self.view.frame or self.view.bounds is Correct,but scrollview or uitableview's frame is Correct but bounds.y every time swith will change 20px.one up,one down.
i try to change scrollview or uitableview's bounds.y in view will viewWillAppear.
CGRect bounds = contentScrollView.bounds;
bounds.origin = CGPointMake(0, 0);
contentScrollView.bounds = bounds;
but if i do it,ok,every time swith page is show right,but when i drag the scrollview or uitableview,the layout incorrect.
the demo has upload on github:https://github.com/KingCentLee/HSText
I hope someone can help me.the demo in iOS 7 later is normal. just iOS 7 swith page encounter the problem.and can tell the reason.Thank you.
I have seen your code. Try delete the code in viewWillAppear. I'am sorry, I don't have ios7 device. In my memory, it may cause by the system status bar which height is just 20px. This is only a suggestion. ps:I can't add a comment.

Strange UITable Separator issue - shifted right

Got a bit of a weird one.
I am using the following codebase to build a UItable with AutoLayout programmatically:
Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
The issue I have is that the output seems to give me the separator shifted to the right I need the background to be the background colour you see, but that little "notch" still remains white. I have changed the separator colour to black here for better viewing.
Any ideas on what is creating that would be much appreciated.
in viewDidLoad method set:
self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
note, that this method available from iOS 7

View goes under tab-bar - iOs7 Autolayout

This must be just another autolayout question. I did do all I can think of to find out what is wrong but nothing seems to right. Maybe I'm missing something or doing something really stupid.
I added an UIImageView to a ViewController, set the autolayout constraints of the ImageView in Xcode. To see the borders, i added an IBOutlet to viewcontroller and set border width of Image to 2.0 and border color to red. It works well in iOS 6, in both landscape and portrait mode. When i run the same in iOS 7, the bottom part of the view goes under tab bar.. heavy sigh. Im hoping this is something configurable in the UI, rather than making code change. I unchecked "Unchecked" Adjust scroll view insets for ViewController , also made sure that the bottom Space ( Vertical Space) of the ImageView is set to the top of Botton Layout Guide, as mentioned in apple ios migration guide. Im not sure what else to do and im not feeling lucky. Can someone please take a look ? I already spent few days on this and im not reaching anywhere. Here are few screen shots if it helps.
Thank you for your time.
Unfortunately stackoverflow wont let me add images unless i have brownie points :(
hopefully these links would work
iOS 7 screenshot
iOS 6 Screenshot
There is an option I believe called 'under bottom bars' uncheck this and it should work.
I found this code in another post and it resolved my issue.
- (UIRectEdge)edgesForExtendedLayout {
return [super edgesForExtendedLayout] ^ UIRectEdgeBottom;
}

iOS 7 setContentOffset in viewDidLoad resettting to 0

I have a UISearchBar attached to the top of the table view. The idea is that when you drag down from the top you can search.
So under iOS 6 I have attached the search bar and then in the viewDidLoad I "setContentOffset" to CGPointMake( 0, searchBar.frame.size.height ) which sets the content offset to 44.
This works perfectly for me.
However the behaviour is not the same in iOS 7.
After I do the setContentOffset in viewDidLoad, I see an internal call to _notifyDidScroll which sets the content offset back to 0 (after viewDidLoad has completed). The funny thing is my search bar is not at -44.
How can I make iOS6 and iOS7 behave the same way? I don't care if iOS6 starts doing this notifyDidScroll or iOS 7 stops doing it, but i'd like consistency between both versions!
For now I have had to use a horrible solution that performs different tasks on iOS 7 and iOS6.
I think you need to disable UnderTopBars in your ViewController. You can do this in the storyboard or .xib in the property of your UIViewController.
edit:
Hope that will help.

ios7 all searchviews and tableviews off by 20 pixels

EDIT: This is not an issue with the frame. The frame is in the correct spot. It is the content that is off. Yes, we are compensating for clear status bar. ViewDidLoad shows content offset is at 0,0.
On every page of my applcation that has a scrollview it's content is pushed down by 20 pixels. I think it may have something to do with the new StatusBar, or lack thereof. The bug also seems to be present in the simulators settings menu. Screenshot below. This only seems to affect the first scroll view that is added to a ViewController and only if no other views have been added to it. Table views are also being affected because they inherit from Scroll view. To be clear the scrollview starts at the correct origin but the content is pushed down by 20 pixels. This is bizarre because I would think if it was a status bar issue it would be 20 pixels above not below.
Currently we are fixing it by adding this to our base view controller
UIView *hackView = [[UIView alloc] init];
hackView.frame = CGRectMake(0, 0, 0, 0);
[self.view addSubview:hackView];
Obviously, this is a hack.
The same thing is happening on phone and in simulator even with the Gold Member version of IOS7 when building for latest IOS7. You can even see an example of the bug in the simulator's settings tableview and also in ours below.
This is a screenshot immediately after it loads. One bizarre thing that we noticed is that when we execute a pull to refresh it will correct the scrollview and rest at it's correct location. Alternatively, if we compensate it will look correct in the beginning but any subsequent pull to refreshes will migrate the scrollview to -20px
After further testing in Xcode, my original workaround still works, but the real culprit seems to be a Navigation Controller combined with the Adjust Scroll View Insets flag on the view controller. Disabling that solved the issue.
[self setAutomaticallyAdjustsScrollViewInsets:NO];
Original workaround: Try reordering your view hierarchy or add an empty view at the top.
This happened to me, and it appears that when a UIScrollView or similar subclass is first in the hierarchy it gets offset by 20 pixels (to keep it from hitting the status bar). However, this still occurs even when the view in question is nowhere near the top.
This is reproducible in Interface Builder, and an easy workaround for me has been to reorder my views so that a label or button is first under the view controller's view. If that's not possible in your case, adding an empty view (even off screen) above your scrollview also seems to solve the problem.
I added this to my UIViewControllers in viewDidLoad: which were affected and it fixed the issue for me:
NSComparisonResult order = [[UIDevice currentDevice].systemVersion compare: #"7.0" options: NSNumericSearch];
if (order == NSOrderedSame || order == NSOrderedDescending)
{
// OS version >= 7.0
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Another, cleaner method:
if ([self respondsToSelector:#selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
How are you laying out your views? With autolayout you can use the topLayoutGuide, which should accommodate for these offsets.
In the Ios 7 the view starts from the window from y= 0, move your view to 20 pixel dowm
self.view.frame = CGRectmake (0,20,320,hight);
this is due to transparent status bar in iOS 7.
pull down the view to show it properly.

Resources