I have tableview and textfield in negative frame as it is shown in screenshot now when i start to edit text table's scrollview goes down by 20 or 50 pixel.
the same thing is working fine in iOS6. It's also calling scrollview's delegate method. I cant figure it out.
Help me. Thanks in advance.
Try this code in viewDidLoad or loadView method,
if([self respondsToSelector:#selector(setEdgesForExtendedLayout:)]) {
self.edgesForExtendedLayout = UIRectEdgeNone;
self.automaticallyAdjustsScrollViewInsets = FALSE;
}
In iOS 7, the scrollview layout is adjusted as per the translucent property of the navigation bar. It might be your problem.
This is happening due to autolayout. Really if you wanna check then just a second uncheck your autolayout option in your xib and then check. I'm sure i won't go 20 or 50 pixel down.
Solution :
Make vertical difference 0 between tableview and text filed. After that it won't go 20 or 50 pixel down.
Related
I'm new to Swift and i'm trying to get a full paged gallery in swift using an UICollectionView inside a viewController UINavigationController.
My problem is that i cannot figure out how to get a full paged ImageView with a NavigationBar, what i've got now is this:
my situation now
but i'd like to have this (with a transparent navigation bar like it is in the first picture):
what i want to accomplish
I've searched all over the net for many hours, i've tried to:
self.collectionView.contentInset = UIEdgeInsetsMake(0,0,0,0)
or
self.automaticallyAdjustsScrollViewInsets = true
I've also tried to uncheck "Adjusts scroll insets" in Xcode but nothing seems to work.
After two days of searching i've found a solution, in viewController viewDidLoad():
self.navigationController!.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationController!.navigationBar.translucent = true
If you don't have a navigationController but only a navigationBar or if you have subclassed UINavigationController:
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.translucent = true
Storyboard Screenshot
I wonder if anyone can shed any light on this for me.
I have a UIPageViewController as part of a SWRevealViewController structure as seen in the storyboard in the linked picture.
The UIPageViewController contains a series of UIViewControllers which have a vertical scroll views in them. The first page shows fine but when I swipe left to display a new page the view loads about 30 pixels to high and after 0.5 a second it drops down to the right place. After that when you scroll left and right it displays normally.
I have tried everything in this post so far and nothing has worked.
self.automaticallyAdjustsScrollViewInsets = false;
pageViewController.automaticallyAdjustsScrollViewInsets = false;
I am pretty sure it is something to do with UIPageViewController scroll inset but not sure what to do about it as I have tried everything I can think of in the last 3 days to try and fix this.
Thank you in advance
Not sure if this will help you, but I had a smaller 5px bounce issue scrolling images in a UIPageViewController. Nothing in the post you look through helped me either. But using a separate UIView as a container view between the individual page view controller's view and my UIImageView miraculously solved the issue for me.
So the hierarchy you want in your page's view controller's view is:
Main View
Container View
Your Actual view content
I need to make my tableview not change height at all. Not shrink when statusbar is changed. I am using storyboard and i have another viewcontroller with a embeded tableview where the tableviews height stays the same no matter what.
In interface builder when switching from 3.5" to 4" the tableview changes size. I have fixed this by setting height programmatically. However the height changes when statusbar is changed. I cant seem to find the property in IB that turns off this autosizing feature for my second tableview. Im am not using auto layouts. I dont know why the height allways stays the same on my other tableview in my other viewcontroller.. Can someone please help me out??
Auto resize subviews was the property for the main view that was enabled . Disabling this fixed it.
I spent several days trying to see the working UIScrollView horizontal scroll indicator (without AutoLayout) on iOS7 (on iPad). But without success.
Has anyone fixed such bug?
My project is simple and running iOS5 and iOS6 without troubles.
I found out, that on iOS7 height of the scroll indicator image is always zero:
UIImageView * scrollBar = [[scrollView subviews] lastObject];
if (scrollBar != nil)
{
PrintRect(#"FRAME", scrollBar.frame);
PrintRect(#"BOUNDS", scrollBar.bounds);
}
Result for iOS7:
FRAME x:0.000000 y:54.000000 w:338.000000 h:0.000000
BOUNDS x:0.000000 y:0.000000 w:338.000000 h:0.000000
but for iOS6:
FRAME x:0.000000 y:47.000000 w:338.000000 h:7.000000
BOUNDS x:0.000000 y:0.000000 w:338.000000 h:7.000000
So the height scroll bar image on iOS7 is equal to zero.
It's possible to change the height, but only for a quick time because during drugging the height becames zero again.
I was stuck on something similar. I am doing the CS193P course on iTunes and there was this scrollView exercise - Imaginarium. Basically it's just a UIImageView embedded in a UIScrollView. I was having the same problem that the scroll indicators were not being displayed (with Autolayout turned off)
I looked up the header file for UIScrollView in the documentation and there is this property in scrollView called scrollIndicatorInsets:
The distance the scroll indicators are inset from the edge of the scroll view.
#property(nonatomic) UIEdgeInsets scrollIndicatorInsets
It goes on to say that the default value is UIEdgeInsetsZero!! So I created a UIEdgeInset using UIEdgeInsetsMake (see documentation). Then in viewDidLoad I set this UIEdgeInsets to be my scrollView's scrollIndicatorInsets, after which my indicators appeared when I scrolled.
Hope this works for you too.
I have a came across a rather annoying bug in one of my apps. In iOS7 when I hold down on a UITextView or UITextField to bring up the Magnifying Glass, nothing shows up in the magnified area. This problem is app wide and the only element that ever shows up in the circle area is the keyboard itself (when I drag my finger down to the top of it).
I have tried everything from View Controllers with only a single UITextView to UIWebView and the problem is app wide.
The magnifying glass works as expected on iOS6 devices, and the iOS7 simulator. But not on any of the devices I have tested it with running iOS7.
Any help would be greatly appreciated.
I fixed this by setting the windowLevel of my main window to a float value of 1.2 in appDelegate:
self.window.windowLevel = 1.2;
This is a sort of hack for iOS7 to raise the default level of your main window which is UIWindowLevelNormal (1.0) to 1.2
Had the same issue when using multiple windows at once. Setting correct .windowLevel value for each window for correct z-sorting solved the problem.
We have a similar problem where we were presenting a UIWindow over the top of the existing window and if they have the same windowLevel then the loupe displays the first window added.
example:
[applicationWindow (windowLevel = 0] <------------- [customWindow (windowLevel = 0)]
customWindow renders on top of applicationWindow just fine...but a loupe displayed over a textfield in custom window renders the contents of applicationWindow.
[applicationWindow (windowLevel = 1] <------------- [customWindow (windowLevel = 1)]
Same result. customWindow renders on top of applicationWindow just fine...but a loupe displayed over a textfield in custom window renders the contents of applicationWindow.
[applicationWindow (windowLevel = 0] <------------- [customWindow (windowLevel = 1.01)]
customWindow renders correctly, contents of loupe render correctly.
The way we solved it is by initing customWindow.windowLevel to be UIApplication sharedApplication].keyWindow.windowLevel + .01 (but this could be anything) before making our customWindow the keyWindow. Thanks #user2940692, your answer should probably be the accepted one... if you want it, i'll post our case as a question, you can answer it and I'll give you credit.
I had the same issue. I found that in Project -> Targets -> General that there was a nib listed in the "Main Interface". Once I removed that it works fine. I also tried setting the window level, and it worked, but it was just masking the true problem for me.
If you did not get any help from the above solutions, I found another problem which can cause this to happen. I had a UIWindow object in nib which was initialized in AppDelegate. That view had background color as [UIColor whiteColor]. Setting it to [UIColor clearColor] will resolve this problem.