my UIPageViewController class conforms to UIPageViewControllerDataSource protocol and yet UIPageControl is not visible.
I've attached screen representing segues between UIPageViewController and it's child UIViewController's which are added by setViewControllers method.
Question is why Page Control is not shown and what can i do with it except adding UIPageControl instance to view myself ?
For some reason, it seems as though UIPageControl only appears when the Transition Style is set to "Scroll" -- very frustrating! (Hope I'm wrong?)
Click on your UIPageViewController ('Home Page View Controller'?) to see the option under Page View Controller.
Make sure you've implemented the optional -presentationCountForPageViewController: and -presentationIndexForPageViewController: data source methods.
UIPageViewController.h is very clear about the requirements:
A page indicator will be visible if both methods are implemented,
transition style is 'UIPageViewControllerTransitionStyleScroll', and
navigation orientation is
'UIPageViewControllerNavigationOrientationHorizontal'.
Related
I'm newbie with iOS and asking for direction.
I want to make a page which contains navigation buttons on top and when tap load different UICollectionView's as you can see on the app screen taken from "Fancy". Also buttons line have to be fixed on top while scrolling down. (just like in the screenshot)
Which is the right approach?
Base class to be UICollectionViewController and adding as SubView
Using UIScrollViewController?
etc...
Thanks in advance.
Base class should be UiViewController implementing UICollectionViewDelegate
UIViewController <UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
Create different NSArray for each Category of your project as datasource of UICollectionView
use UISegmentedControl for switching the datasource of UICollectionView and reload UICollectionView to display different content.
You can customise your Segmented Control as you wanted.
Implement UITabbarController for the bottom bar to enter any other views
There are a number of ways to go about this. The simplest would probably be to use a UIViewController subclass whose view contains a UISegmentedControl subview (for the navigation controls) and a UICollectionView subview for the content.
I've noticed that a UIScrollView doesn't have mentioned accessibility area where I can set accessibility label or accessibility. This seems to apply for activity indicators too.
Why does UIVIews, UIButtons and more have this area and not UIScrollView and UIActivityIndicatorView?
Good question - the reason for a scroll view is that Apple don't consider it to be an accessible element.
If you look at the UIAccessibility documentation, you'll find Apple have the following to say on what counts as an 'accessible element':
The only exception to this [a view being accessible] is a view that merely serves as a container for other items that should be accessible. Such a view should implement the UIAccessibilityContainer protocol and set this property to NO.
A UIScrollView is simply a container for subviews, so its isAccessibilityElement property is set to no (hence why you don't see the accessibility options in interface builder).
So basically, when you're using a scroll view the items inside it should be accessible, but not the scroll view itself.
To add more details on UIAutomation accessibility labels for UIScrollView you will have to use the index to the ScrollView to access subviews on the scroll view. Eg :
target.frontMostApp().mainWindow().scrollViews()[0].buttons()["logoutButton"].tap();
NOTE : Assumption is that the "logoutButton" is the accessibility label for the logout button and it is a subview on the scroll view.
I was looking to implement something like the image below, and really have no idea how it's done and was wondering if someone had a quick design idea (no code is necessary or anything). Is it a footer view for the table view? is it some unknown footer view for a popover controller? Is it some way to integrate a toolbar from the UINavigationController 'into' the popover? I guess I could always create a custom view and display it 'like' a popover. Thanks for any help.
UIPopoverController will actually do a lot of that for you. If you set its content view controller to a UINavigationController, the contents of that navigation controller’s current view controller’s navigation item will display embedded in the top of the popover. I believe setting the view controller’s (not the navigation controller’s) toolbarItems will have the same effect at the bottom.
In this case, it looks like they wrote a custom popover controller; it doesn’t have an arrow attached, and the top of it is shaded a little differently from the standard UIPopoverController. But I’m pretty sure you can use the methods I just described to achieve a similar effect without having to roll your own popover.
I have a UIViewController that is presented with UIModalPresentationFormSheet. So when the keyboard is visible it stays visible until the view controller gets dismissed.
In that UIViewController I have a navigation controller. So in every UIViewController pushed to that navigation controller I have to check these things:
when the keyboard shows/hides I have to adjust the contentInset
when view appears I have to check if the keyboard is visible or not (the navigation controller remembers that with the notification) and adjust the contentInset. I push UITableViewControllers there, so I don't get viewDidAppear and co. So I have to do all this with the UINavigationControllerDelegate methods?
on every rotation I have to do adjust the contentInset
Otherwise the keyboard may cover some content.
Is that the correct handling? Isn't there any easier solution for this problem? Because this is kind a messy!
I didn't found a better solution, so i did it this way.
I have a UIWebView which inside a UIScrollView (scrollview contain another component)
I tried to enable multitouch both on Interface Builder or Programmatic on UIWebView but it still cannot zoom for html, do I need to handle both zoom in at the UIScrollView and UIWebView? Or anything I haven't to set?
You MUST set scalesPageToFit=YES for any pinching and zooming to work on a UIWebView
OK, you need to do both the above, but also the following. I had a web view in the main view, and that didn't work.
As above, you first have to put a UIScrollView in the main view, then put the web view in the scroll view.
As above, implement <UIScrollViewDelegate> in your view controller, drag the scroll view delegate to the view controller in Interface Builder, and implement the viewForZoomingInScrollView method. This must return the pointer to the UIScrollView (return myScrollView).
I created IBOutlet properties for both the web view and the scroll view - link them in the NIB to your view controller.
On the Scroll View, go to the Attributes Inspector, set your Max and Min zoom factors (I set 0.5 to 5.0, that works well).
On the Web View, in the Attributes Inspector:
In the Web View section, select Scales Pages To Fit
In the View section, select for Mode, "Top Left"
In the View section at the bottom, check off User Interaction Enabled, and Multiple Touch Enabled
With JavaScript you can control the zoom level, although the oly solution I have found doesn't look smooth.
Say you have in <head>:
<meta id="vp" name="viewport" content="width=768,initial-scale=1.0">
To zoom to 4x, and still allow the user to change zoom, change the content twice:
var vp = document.getElementById('vp');
vp.content = "width=767,minimum-scale=4.0,maximum-scale=4.0,user-scalable=yes";
vp.content = "width=768,minimum-scale=0.25,maximum-scale=10.0,user-scalable=yes";
Toggling the width is very important - otherwise Mobile Safari has serious repainting bugs (due to over-optimisation).
You cannot just set initial-scale again - it is ignored the second time.
You need to implement the viewForZoomingInScrollView method in your controller, or zooming won't do anything. (I don't really know why this should be needed, but there you go.)
For detailed information, see http://developer.apple.com/iphone/library/documentation/WindowsViews/Conceptual/UIScrollView_pg/ZoomZoom/ZoomZoom.html.