I am using AGSPopupsContainerViewController to display multiple popups when touching on mapView we fetch more than one AGSGraphics.
Here is my code:
NSMutableArray *popups =[[NSMutableArray alloc]init];
AGSPopupInfo *popupinfo;
for (AGSGraphic *g in Graphics ) {
popupinfo =[AGSPopupInfo popupInfoForGraphic:g] ;
AGSPopup* popup = [AGSPopup popupWithGraphic:g popupInfo:popupinfo];
popup.allowEditGeometry = false;
[popups addObject:popup];
}
if (!popupVC) {
self.popupVC = [[AGSPopupsContainerViewController alloc] initWithPopups:popups
usingNavigationControllerStack:false];
}else{
[self.popupVC showAdditionalPopups:popups];
}
self.popupVC.delegate = self;
self.popupVC.doneButton = self.customActionButton;
self.popupVC.style = AGSPopupsContainerStyleCustomColor;
self.popupVC.barItemTintColor = [UIColor redColor];
self.popupVC.pagingStyle = AGSPopupsContainerPagingStyleToolbar;
// Animate by flipping horizontally
self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// If iPad, use a modal presentation style
if([[AGSDevice currentDevice] isIPad])
self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:self.popupVC animated:YES completion:nil];
All works fine, I have the right number of pupups, the problem is that using the arrows in the toolbar I can only see the first and the last ones. Why? I am missing something?
Arrows are doing what they are supposed to do - using them will show you the first and the last popup. Swipe to the left (or right) and you'll see the rest of the popups.
Related
In iOS 9, I see a new window appearing in my app that I didn't see before. An image is below. From walking the view tree, I suspect it may be coming from the UIRemoteKeyboardWindow -- but I don't know that. What is it, and what do I have to do to keep it from appearing?
EDIT: As a commenter pointed out, this is tied to the inputView, i.e. the keyboard. I don't want a keyboard and so disabled it by calling
self.inputView = [[UIView alloc]initWithFrame: CGRectZero];
That did kill the keyboard, but there is still the accessory. I've tried similar tricks to kill the accessory; none of them have worked, yet. Calling self.inputAccessoryView is returning nil, which doesn't help.
This got rid of it:
-(void) killAccessory {
UIView* input = self.inputView;
UIView* parent = input.superview;
parent.hidden = YES;
}
-(BOOL) becomeFirstResponder {
BOOL r = [super becomeFirstResponder];
[self killAccessory];
return r;
}
You can use the following code :
textField.inputAssistantItem.leadingBarButtonGroups = [[NSArray alloc] init];
textField.inputAssistantItem.trailingBarButtonGroups = [[NSArray alloc] init];
the textField use above is the textField which you tap to edit.
Since the iOS7 upgrade, I have a weird behaviour of the UIImagePickerController. In this application I am using the UIImagePickerController with a cameraOverlayView.
In iOS6 I called the UIImagePickerController using the following code:
_picker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) {
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;
_picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
_picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
_picker.showsCameraControls = NO;
_picker.navigationBarHidden = NO;
_picker.toolbarHidden = YES;
_picker.wantsFullScreenLayout = YES;
_overlayViewController = [[OverlayViewController alloc] init];
_overlayViewController.picker = _picker;
_overlayViewController.frameSize = self.frameSize;
_overlayViewController.delegate = self;
_picker.cameraOverlayView = _overlayViewController.view;
}
else {
_picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
_picker.delegate = self;
Where the OverlayViewController is an UIViewController, with a transparent background which draws some custom controls on screen.
But now in iOS 7 the camera is drawn through the statusbar and a black bar appears beneath the live camera view.
I can solve this by applying a CGAffineTransformMakeTranslation to the cameraViewTransform property of the UIImagePickerController, but why is this like this?
In iOS 7, by default UIViewController views take up the entire screen area including the status bar.
wantsFullScreenLayout
is deprecated and ignored. In some cases, this fix works (in the view controller class):
if ([self respondsToSelector:#selector(setEdgesForExtendedLayout:)]) {
[self setEdgesForExtendedLayout:UIRectEdgeNone];
}
In other cases, it's a bit more complicated. It's late here, so see how you go with it. Helpful things to note - in a UIViewController, the following code will give the correct statusbar height on both iOS 6 and iOS 7, should it come to having to align things using CGRect math:
if (UIDeviceOrientationIsLandscape(self.interfaceOrientation)) {
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.width;
} else {
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
}
And then don't forget that in Interface Builder, there are the new "iOS 6 delta" adjustments that allow you to design for iOS 7 and then use offsets to correct for iOS 6.
Anyhow, let me know how you go.
My understanding of the issue, based on a few other SO threads and such, is that UIImagePickerController does not do what we'd expect in terms of managing the status bar via [UIViewController -prefersStatusBarHidden].
This means you either have to disable view controller status bar management entirely, via plist, or figure out a way to get UIImagePickerController to do what we want. On the assumption that you're not looking for the former, I can say I've had success in the latter by putting the picker in a wrapper controller that does what I want (but fall back to your previous code if you still need to detect/support iOS6):
#interface PickerContainer : UIViewController
#property ( nonatomic, weak ) UIImagePickerController* picker;
#end
#implementation PickerContainer
- (void) setPicker: (UIImagePickerController*) picker
{
[self addChildViewController: picker];
[picker didMoveToParentViewController: self];
self->_picker = picker;
}
- (void) viewDidLoad
{
[super viewDidLoad];
self.picker.view.frame = self.view.bounds;
[self.view addSubview: self.picker.view];
}
// Will have no effect in ios6 -- see [-init] for that option
- (BOOL) prefersStatusBarHidden { return YES; }
- (id) init
{
if ( ! ( self = [super init] ) ) return nil;
if ( detectThatThisIsIos6() ) self.wantsFullScreenLayout = YES;
return self;
}
#end
This will work for you, scaled camera, you will have a black bar at the bottom but it will get overlayed by tool bar
https://stackoverflow.com/a/15803947
I am trying PSDFKit demo version to display pdf files in my application. I have added PSPDFViewcontroller as child view to app view hierarchy.And PSPDKIt toolbars are hidden.App is using toolbars of parent view controller.
My problem is that when I tried to add note annotation then it gets overlapped with bottom toolbar.
Could not find reason behind this strange behaviour.
What could be reason?
Here is my code
-(void)showDocumentWithFileURL:(NSURL *)url
{
NSData*pdfdata = [NSData dataWithContentsOfURL:url];
PSPDFDocument *document = [PSPDFDocument documentWithData:pdfdata];
[document.outlineParser outline]; //Parse outline..
self.psPdfViewController = [[PSPDFViewController alloc] initWithDocument:document];
self.psPdfViewController.scrollingEnabled = YES;
self.psPdfViewController.toolbarEnabled = NO;
self.psPdfViewController.delegate = self;
self.psPdfViewController.document.delegate = self;
self.psPdfViewController.shouldHideStatusBarWithHUD = NO;
self.psPdfViewController.renderAnimationEnabled = NO;
self.psPdfViewController.hidesBottomBarWhenPushed =YES;
//Hide bottom page scrollbar.
self.psPdfViewController.scrollDirection = PSPDFScrollDirectionVertical;
self.psPdfViewController.leftBarButtonItems = #[];
//Add pspdf view as chaild view controller.
[self addChildViewController:self.psPdfViewController];
[self.view addSubview:self.psPdfViewController.view];
//Add Navigation Bar and toolbar Buttons.
[self updateHeaderFooter];
}
else
{
[self updateHeaderFooter];
}
}
i use the JTRevealSidebarV2 and have a problem. The sidebar is not always visible. It is sometimes white. Have anybody a solution?
This is the Code for see and dismiss the sidebar:
// This is an examle to configure your sidebar view through a custom UIViewController
- (UIView *)viewForLeftSidebar {
[self changeAllButtonImageUnpressed];
// Use applicationViewFrame to get the correctly calculated view's frame
// for use as a reference to our sidebar's view
CGRect viewFrame = self.navigationController.applicationViewFrame;
UITableViewController *controller = self.leftSidebarViewController; NSLog(#"Controller.view %#", controller.view);
if ( controller == nil ) {
self.leftSidebarViewController = [[SidebarViewController alloc] init];
self.leftSidebarViewController.sidebarDelegate = self;
controller = self.leftSidebarViewController;
//controller.title = #"LeftSidebarViewController";
}
controller.view.frame = CGRectMake(0, viewFrame.origin.y, 250, viewFrame.size.height);
controller.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
return controller.view;
}
This happens when you open a sidebar than hit the home key. reopen the app and its all messed up
So we are making a game that has a normal UIView title screen, and when the user presses the "Start Game" button, we attempt to put up the loading screen, remove the title view, we initialize the game view and add it to the superview (window in our case) underneath the loading screen.
Unfortunately, the end result is that the UI is blocked for a few seconds upon touching the "Start Game" button, and our loading screen blips on the screen for a millisecond before being kicked off for the loaded game view. We even added logging, and the logging messages appear in console while the UI is blocked.
Here is the method in question:
-(void)switchToGame{
NSLog(#"adding loading");
loadingScreen = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:#"loading_screen.jpg"]];
[self.window addSubview:loadingScreen];
NSLog(#"removing titlescreen");
[titleView.view removeFromSuperview];
self.titleView = nil;
if(self.gameView == nil){
gmViewController *g = [[gmViewController alloc]
initWithNibName:#"gmViewController"
bundle:nil];
self.gameView = g;
[gameView setIsLoading:YES];
self.gameView.parent = self;
[g release];
}
NSLog(#"inserting gameview");
[self.window insertSubview:gameView.view belowSubview:loadingScreen];
[self.window setRootViewController:gameView];
[self setGameIsActive:YES];
[gameView startAnimation];
//remove the loading screen
NSLog(#"killing loading");
[loadingScreen removeFromSuperview];
[loadingScreen release];
[gameView setIsLoading:NO];
}
Forgot about this question.
We solved it by moving the loading screen add to it's own function:
- (void)addLoadingScreen
{
loadingScreen = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:#"loading_screen.jpg"]];
[self.window addSubview:loadingScreen];
}
And then executing it on its own thread:
[NSThread detachNewThreadSelector:#selector(addLoadingScreen)];