PSPDFKit note annotation issue with toolbar - ios

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];
}
}

Related

iOS esri sdk - Multiple Popups using AGSPopupsContainerViewController

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.

UIImagePickerController not full screen

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

JTRevealSidebar: The Sidebar is sometimes white

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

UITextView not shown on screen

In my app I habe a view controller that calls several views. All these views are UIViews. That works fine, but not in every case. One of the views that are called has some labels, textfields and two UITextViews. Everything is shown correctly but the UITextViews. The view is called in that way:
[[self view] addSubview:tasteView];
//tasteView = [[TasteView alloc] init];
[self setCurrentView:tasteView];
I call the init method of the view to display the UITextViews:
EDIT: After a comment of Phillip Mills this was slightly changed! Init isn't called anymore.
- (id)init
{
if (self)
{
[tv1 setNeedsDisplay];
CGRect frame = tv1.frame;
frame.size.height += 1;
tv1.frame = frame;
}
return self;
}
As I saw that setNeedsDisplay had no effect, I changed the size of the corresponsing frame to force a redraw. Unfortunately that had no effect, too.
Btw, the view is initially loaded in the viewDidLoad of the view controller:
- (void)viewDidLoad
{
[super viewDidLoad];
[self setCurrentView:placeholder];
[self configureView];
wineryView = [self loadWineryView];
wineView = [self loadWineView];
tasteView = [self loadTasteView];
}
A method for loading the views looks like this:
- (UIView *) loadTasteView
{
NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:#"TasteView" owner:self options:nil];
UIView *tView;
for (id view in nibViews)
{
if ([view isKindOfClass:[TasteView class]])
{
tView = (TasteView*) view;
}
}
return tView;
}
I do not know why those UITextViews are not shown. Did I forget something? To show really everything, here are the connections that I made in InterfaceBuilder:
Does anyone know what I did wrong and can help me?
I think your initial code should be like this :
tasteView = [[TasteView alloc] init];
[[self view] addSubview:tasteView];
[self setCurrentView:tasteView];
addSubView after it is allocated
Hope it helps you
If you are creating the view in code (your first sample), alloc and init the view before trying to add it as a subview.
If you're loading it from another nib (last code section), you still need to add it to the view hierarchy.

We want a loading screen while our OpenGL ES view inits , but the UI is blocked until we don't need it anymore?

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)];

Resources