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.
In my app i have UIView that floats at the top of a UITableView (Visualise:Attached to the bottom of the navigation Bar), under iOS5 i was enabling it to float at the top using these lines of code in scrollViewDidScroll
// get the table and buttonView bounds
CGRect tableBounds = self.tableView.bounds;
CGRect buttonViewFrame = self.buttonView.frame;
// make sure the buttonView at the table's original x and y as the content moves
self.buttonView.frame = CGRectMake(tableBounds.origin.x,tableBounds.origin.y,buttonViewFrame.size.width,buttonViewFrame.size.height);
This however no longer seems to work in iOS6, does anyone know why or how to fix the problem? I'm supporting iOS5 and above.
Having looked through the iOS6 release notes i found this...
Note that you can make a subview of the scroll view appear to float (not scroll) over the other scrolling content by creating constraints between the view and a view outside the scroll view’s subtree, such as the scroll view’s superview.
How would I set this up in code as Im not using AutoLayout in storyboards as I'm still supporting iOS5. It would also be great if anyone can enlighten me as to why the code i was using in iOS5 no longer works in 6.
I encountered the following problem: as soon as I add e.g. a UILabel to my UIScrollView - using the storyboard - the scroll view stops "working" (with that I mean you cannot scroll at all). However adding a subview programmatically the scroll view works fine but since I prefer designing my apps visually with storyboard I would like to solve this mysterious error.
Does anyone knows why this error is occurring? Thanks in advance :)
PS: I do set the contentSize of my scrollView, so this cannot be the problem!
Move the code in the viewDidAppear function like this
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.scrollView.contentSize = CGSizeMake(500.f, 500.f);
}
I've been searching for some time for an answer on this problem:
How can I keep the scrollbars on my UIScrollView and UIWebview visible? So that the user knows he can scroll up or down. (like in firefox or any other browser so without touching the scrollvie first)
I read on some sites that it wasn't possible, so my other question would be:
Is there a way to add a "scrollbar" to a scrollview or webview?
Thank you very much
Maybe you could use this:
flashScrollIndicators
It won't show the scrollbar all the time, but it just flashes when the view is loaded.
Edited: Other solution:
In your view didload, you make a scrollview of you webview like this:
UIScrollview *scrollview = [webview.subviews objectAtindex:0];
you have to set the delegate of the scrollview on self:
scrollview.delegate= self
in your .h file you add
When you place in your .m file you can use:
-(void)ScrollviewDidscroll:...
(I don't know if it works when you have multiple scrollviews)
Yes you can try adding a custom view ( can be image view) on top the scrollbar. You will have to monitor the contentOffset and contentSize to know where you are. Based on this information, you can position your custom scroll bars.
I'm working on an iPad application and I'm using UIPopoverControllers. I'm at the part where the app needs to be branded and styled and i'm wondering how to change the color / tint of the UIPopoverController? Standard is dark blue but it needs to be another color..
is this possible?
Greets, Thomas
This is possible starting in iOS 5.0 by subclassing the abstract class UIPopoverBackgroundView and assigning your subclass to the popoverBackgroundViewClass property on your UIPopoverController instance. Unfortunately there is no tintColor property as the popover needs to use images for it's arrow and border in order to achieve smooth animations during dynamic resizing. You can learn more about how to customize the appearance of a UIPopoverController in the UIPopoverBackgroundView Class Reference
It's impossible for now.
It's what I call the "Box in a Box" model. You get control of the box inside of the box (the UIViewController inside of the UIPopoverController), but you have very limited control over the actual popover itself. Outside of the arrow direction and the size, you can't change much else. There are also options for a modal effect popover, which dims everything else when it shows up, but I haven't tried to get it working.
I'm sure you've noticed there is no UIPopover class by now.
The answer you want to hear:
If you really want to style one that bad, just write your own. It's really not that hard.
The link you want to click:
Cocoacontrols is an index of iOS and OSX components available on GitHub, they have some popover stuff.
iOS 7 introduces backgroundColor property of UIPopoverController which affects/includes the navigation background color as well as arrows of popover.
#property (nonatomic, copy) UIColor *backgroundColor NS_AVAILABLE_IOS(7_0);
Usage example:
if ([self.popoverVC respondsToSelector:#selector(setBackgroundColor:)]) { // Check to avoid app crash prior to iOS 7
self.popoverVC.backgroundColor = [UIColor greenColor]; // [UIColor colorWithPatternImage:#"..."] doesn't reflect the color on simulator but on device it works!
}
Note - As of now (iOS 7.0.3), in some cases (like set color using colorWithPatternImage:), the simulator (and even some devices) doesn't honor the color.
Throwing my hat in here;
I've leveraged UIPopoverBackgroundViews in iOS 5+ to add a simple tintColor property onto UIPopoverControllers.
PCPopoverController: https://github.com/pcperini/PCPopoverController
I try to trick it by customizing the view controller inside the popover and then hiding the popover border using this code:
UIView * border = [[insideViewController.view.superview.superview.superview subviews] objectAtIndex:0];
border.hidden = YES;
The app is actually still in development so I'm hoping other people will comment on this solution.
check out these latest projects leveraging UIPopoverBackgroundView
https://github.com/CRedit360/C360PopoverBackgroundView
https://github.com/GiK/GIKPopoverBackgroundView
from ios 5 onward it is can be done, here is a library
https://github.com/ddebin/DDPopoverBackgroundView
just look at the documentation , and it is quite easy
good luck
You can use Elegant Popover cocoapod for just that. You can customise shape and colour of the arrow and the popover itself. Also, you can add colourful borders to the popover.
I know this is a lousy constructed answer, but I've just been playing with the UIPopoverController's views. They do exist.
The only way to access them is from your view that is sitting in the UIPopovercontroller.
I have a navigation controller so I follow this hierarchy
UIView *test = ((UIView *)[[[self.navigationController.view.superview.superview.subviews objectAtIndex:0] subviews] objectAtIndex:1]);
UIView *test2 = ((UIView *)[[[self.navigationController.view.superview.superview.subviews objectAtIndex:0] subviews] objectAtIndex:1]);
test.backgroundColor = [UIColor greenColor];
test2.backgroundColor = [UIColor greenColor];
This isn't exactly the end goal, but it is really close.
you'll find that the_view_in_the_popover.superview.superview (maybe just one superview if you are not reaching out from a navigation controller view) is a UIPopoverView. If you cast it as a UIView and treat it as a UIView you're not really breaking any rules. I guess that is really up to apple though.
Remove UIPopoverController border:
NSArray* subviews = ((UIView*)[popupController.contentViewController.view.superview.superview.superview.subviews objectAtIndex:0]).subviews;
for(UIView *subview in subviews){
[subview removeFromSuperview];
}