Code Monkey home page Code Monkey logo

wepopover's Introduction

WEPopover is an attempt to create a generalized version of the UIPopoverController which is unfortunately only available for the iPad. WEPopover should work on any device with iOS >= 3.2. If you want to use it with iOS < 3.2 you need to implement the @property(nonatomic, readwrite) CGSize contentSizeForViewInPopover for the content view controllers you want to present manually.

The project contains some sample code illustrating the usage of the classes, but the only classes you actually need if you want to use the library reside in the "Popover" group in the project tree.

Please have a look at the UIPopoverController documentation on details of the API.
Additions to the UIPopoverController API include:

- Support for custom background views: specify the WEPopoverContainerViewProperties for the view to use as background. The properties specify the images to use for the stretchable background and the arrows (four directions). It also specifies the margins and the cap sizes for resizing the background. A default image with corresponding arrows are supplied with the project.
- Support for limiting the area to display the popover: implement the protocol WEPopoverParentView for the view you supply to the presentPopover method and implement the - (CGRect)displayAreaForPopover.
- Support for repositioning an existing popover (by passing the need to dismiss it and present a new one). See the 'repositionPopoverFromRect' method in WEPopoverController.

wepopover's People

Contributors

werner77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wepopover's Issues

Behave like UIPopoverController

When showing WEPopovercontroller, you can still interact with the underlaying views. It doesn't disappear when touching outside UIPopoverController view.

WEPopoverController show view and after second closed it

I try to show view using popover. Since UIPopoverController does not work on IPhone i use WEPopoverController.

My code:

UIViewController *controller = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"GetDateController"];
controller.modalPresentationStyle = UIModalPresentationPopover;
WEPopoverController *pop = [[WEPopoverController alloc] initWithContentViewController:controller];
pop.delegate = self;
CGRect screen = [[UIScreen mainScreen]bounds];
CGRect r = CGRectMake(8, 8, screen.size.width-8, 57);
pop.popoverContentSize = r.size;
[pop presentPopoverFromRect:CGRectMake(200, 100, 0, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

When I start the program, I see a pop over window, which immediately disappears. When I use UIPopoverController on IPhone program crash, on iPad everything works correctly.

What do I need to do with WEPopoverController to make it work?

Alexander.

Anyone willing to pick up the baton?

Werner doesn't seem to want to maintain this project. There are oodles of forks now - we're all doing are own separate enhancements and fixes. Does anyone want to stand up and offer to actively support this, and then we can use that fork to submit pull requests too?

How to dismiss popover from didSelectRowAtIndexPath?

I'm stumped here. I've implemented the WEPopover classes and setup
the contentView to use a tableview. Now, in that table view, I need to
dismiss the popover when the user selects an item in the didSelectRowAtIndexPath
method but of course the dismissPopoverAnimated is not available since
the tableview is a view inside the contentView inside the popover view
and none of them really know about each other..

So, very simply my question is, how using these classes, do i go about dismissing
the popover in didSelectRowAtIndexPath?

Dismiss Popover With a button

I'm using the WEPopover and I'm presenting a setting's view inside the popover how can i able to dismiss the popover with a help of button present inside a WEPopover view?
8a3eb358fb1676c015f14f1d041d92d9

Can't show on Navigation Controller

Add bellow method to use on Navigation Controller:

  • (void)presentPopoverFromRect:(CGRect)rect
    inView:(UIView )theView
    permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections
    animated:(BOOL)animated
    withKeyView:(UIView
    )keyView {
    .....
    // Don't use self.keyView
    //UIView *keyView = self.keyView;
    .....
    }

WEPopover not working on iOS < 3.2

Due to the call of contentSizeForViewInPopover method (Available in iOS 3.2 and later) in WEPopoverController.m , WEPopover will not work on devices with ios 3.1.x installed on it (like iPhone Edge or iPod Touch 1G which have no access to iOS 4.x).

SIGABRT at UIView *button = [parentView.subviews objectAtIndex:indexOfView];

Im a newbie, 15-year-old kid and Im probably doing something wrong.
I "hooked up" everything according to the sample app you provided.
I only dont understand this line of the Read Me which probably causes the error:

"If you want to use it with iOS < 3.2 you need to implement the @Property(nonatomic, readwrite) CGSize contentSizeForViewInPopover for the content view controllers you want to present manually."

although, the iOS is 4.3

this happens after I hit the UIBarButton item (i used the sufficient method).

the console shows:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray objectAtIndex:]: index 4 beyond bounds [0 .. 3]'
*** Call stack at first throw:

thanks a lot ;)

crash in ios8.x

hi,

we have been using your good control for last 2 years and it was working well - thanks!

but in ios8 on iphoen6, it is crashing at
[self.view removeFromSuperview]
in [WEPopoverController animationDidStop]
Uses a slightly older version, but new version also has same code in this case, only refactored.
Does not happen always.

Below is the trace.

SIGSEGV
SEGV_ACCERR
Crashed Thread
0
libobjc.A.dylib 0x000000019556fbd0 objc_msgSend + 16
1
UIKit 0x00000001895b7d48 __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 128
2
UIKit 0x00000001895b7c08 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 460
3
UIKit 0x00000001895b7d48 __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 128
4
UIKit 0x00000001895b7c08 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 460
5
UIKit 0x00000001895b7d48 __85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 128
6
UIKit 0x00000001895b7c08 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 460
7
UIKit 0x000000018988310c __UIViewWillBeRemovedFromSuperview + 436
8
UIKit 0x00000001895b6c0c -[UIView(Hierarchy) removeFromSuperview] + 104
9
TestApp 0x00000001001d5eac -WEPopoverController animationDidStop:finished:context:

WEPopoverContainerView protocol - displayAreaForPopover

Hello ! First of all, very nice library. Much better than the competition :)

I think

if ([theView conformsToProtocol:@protocol(WEPopoverParentView)] && [theView respondsToSelector:@selector(displayAreaForPopover)]) {
displayArea = [(id )theView displayAreaForPopover];

should be replaced with :

if ([self.delegate conformsToProtocol:@protocol(WEPopoverParentView)] && [self.delegate respondsToSelector:@selector(displayAreaForPopover)]) {
displayArea = [(id )self.delegate displayAreaForPopover];

. since the controller is implementing the protocol and the existing method works only if you have a custom view with a custom class as a displayAreaView.
Correct me if I'm wrong.

Present WEPopover from UITableViewCell subclass

Hi,

First, thanks a lot for your great work.

Here is what I'm trying to achieve :
I have a UITableView with custom cells subclassed. Cells are composed of some buttons that should present WEPopover on touch. The touch action is implemented in the cell's subclass. I would like to allow Up and Down arrow directions as in the Demo project.

I succeeded in presenting the popover but arrow directions seemed to be ignored. Indeed, whatever the space available, it's always the same direction.

Here is the code used in cell's subclass :

[self.likeCommentPopoverController presentPopoverFromRect:self.commentNumberButton.frame inView:self permittedArrowDirections:(UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown) animated:YES];

I tried to present it from tableView but it doesn't work :

CGRect rect = [self.superview.superview convertRect:self.commentNumberButton.frame fromView:self]; [self.likeCommentPopoverController presentPopoverFromRect:rect inView:self.superview.superview permittedArrowDirections:(UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown) animated:YES];

Have you got an idea to achieve this ?

Thanks a lot.

Anthonin

wrong clipping with scrollviews (fix attached)

It sort of glitches. Because it compares with 0 rather than with the visible area boundaries. I do not want to describe it in detail. Look at the diff and you will see that I'm right.

WEPopover/Popover/WEPopoverContainerView.m

@@ -190,12 +190,12 @@ permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections
                     theOffset = CGPointMake(anchorPoint.x - xArrowOffset - upArrowImage.size.width / 2, anchorPoint.y  - yArrowOffset);
                     theBgRect = CGRectMake(0, 0, theSize.width, theSize.height);

-                    if (theOffset.x < 0) {
-                        xArrowOffset += theOffset.x;
-                        theOffset.x = 0;
-                    } else if (theOffset.x + theSize.width > displayArea.size.width) {
-                        xArrowOffset += (theOffset.x + theSize.width - displayArea.size.width);
-                        theOffset.x = displayArea.size.width - theSize.width;
+                    if (theOffset.x < CGRectGetMinX(displayArea)) {
+                        xArrowOffset += theOffset.x - CGRectGetMinX(displayArea);
+                        theOffset.x = CGRectGetMinX(displayArea);
+                    } else if (theOffset.x + theSize.width > CGRectGetMaxX(displayArea)) {
+                        xArrowOffset += (theOffset.x + theSize.width - CGRectGetMaxX(displayArea));
+                        theOffset.x = CGRectGetMaxX(displayArea) - theSize.width;
                     }

                     //Cap the arrow offset
@@ -215,12 +215,12 @@ permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections
                     theOffset = CGPointMake(anchorPoint.x - xArrowOffset - downArrowImage.size.width / 2, anchorPoint.y - yArrowOffset - downArrowImage.size.height);
                     theBgRect = CGRectMake(0, 0, theSize.width, theSize.height);

-                    if (theOffset.x < 0) {
-                        xArrowOffset += theOffset.x;
-                        theOffset.x = 0;
-                    } else if (theOffset.x + theSize.width > displayArea.size.width) {
-                        xArrowOffset += (theOffset.x + theSize.width - displayArea.size.width);
-                        theOffset.x = displayArea.size.width - theSize.width;
+                    if (theOffset.x < CGRectGetMinX(displayArea)) {
+                        xArrowOffset += theOffset.x - CGRectGetMinX(displayArea);
+                        theOffset.x = CGRectGetMinX(displayArea);
+                    } else if (theOffset.x + theSize.width > CGRectGetMaxX(displayArea)) {
+                        xArrowOffset += (theOffset.x + theSize.width - CGRectGetMaxX(displayArea));
+                        theOffset.x = CGRectGetMaxX(displayArea) - theSize.width;
                     }

                     //Cap the arrow offset
@@ -240,12 +240,12 @@ permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections
                     theOffset = CGPointMake(anchorPoint.x - xArrowOffset, anchorPoint.y - yArrowOffset - leftArrowImage.size.height / 2);
                     theBgRect = CGRectMake(0, 0, theSize.width, theSize.height);

-                    if (theOffset.y < 0) {
-                        yArrowOffset += theOffset.y;
-                        theOffset.y = 0;
-                    } else if (theOffset.y + theSize.height > displayArea.size.height) {
-                        yArrowOffset += (theOffset.y + theSize.height - displayArea.size.height);
-                        theOffset.y = displayArea.size.height - theSize.height;
+                    if (theOffset.y < CGRectGetMinY(displayArea)) {
+                        yArrowOffset += theOffset.y - CGRectGetMinY(displayArea);
+                        theOffset.y = CGRectGetMinY(displayArea);
+                    } else if (theOffset.y + theSize.height > CGRectGetMaxY(displayArea)) {
+                        yArrowOffset += (theOffset.y + theSize.height - CGRectGetMaxY(displayArea));
+                        theOffset.y = CGRectGetMaxY(displayArea) - theSize.height;
                     }

                     //Cap the arrow offset


@@ -265,12 +265,12 @@ permittedArrowDirections:(UIPopoverArrowDirection)permittedArrowDirections
                     theOffset = CGPointMake(anchorPoint.x - xArrowOffset - rightArrowImage.size.width, anchorPoint.y - yArrowOffset - rightArrowImage.size.height / 2);
                     theBgRect = CGRectMake(0, 0, theSize.width, theSize.height);

-                    if (theOffset.y < 0) {
-                        yArrowOffset += theOffset.y;
-                        theOffset.y = 0;
-                    } else if (theOffset.y + theSize.height > displayArea.size.height) {
-                        yArrowOffset += (theOffset.y + theSize.height - displayArea.size.height);
-                        theOffset.y = displayArea.size.height - theSize.height;
+                    if (theOffset.y < CGRectGetMinY(displayArea)) {
+                        yArrowOffset += theOffset.y - CGRectGetMinY(displayArea);
+                        theOffset.y = CGRectGetMinY(displayArea);
+                    } else if (theOffset.y + theSize.height > CGRectGetMaxY(displayArea)) {
+                        yArrowOffset += (theOffset.y + theSize.height - CGRectGetMaxY(displayArea));
+                        theOffset.y = CGRectGetMaxY(displayArea) - theSize.height;
                     }

                     //Cap the arrow offset

Position in view

I used [WePopover] to show tooltip by tapping on a view. The tooltip's content depends on the location we tap. The view also can zoom by pinch or move by pan gesture. Actually, it runs good when the view in the original position (the view at the first run time).

However after pinch or pan, tap the view to call wepopover, the view automatically restore the original position. So, the point to show wepopover is changed. It is different with uipopover on iPad. Do you know why? and how can I fix it?

This from my code:

- (void)handleTap:(UITapGestureRecognizer*)gesture {
CGPoint point = [gesture  locationInView:self.view];

// create tooltip and it's content
...

self.tooltip = [[[popoverClass alloc] initWithContentViewController:_tooltipContent] autorelease];
[self.tooltip presentPopoverFromRect:CGRectMake(point.x, point.y, 1, 1) inView:self.view.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

Thank you very much.

Autorotate

After rotating the position not in correct. How to resolve it. Can support masonry?

Image Shadows

This is just an informative note that people can greatly simplify the background images by not drawing shadows in the bitmaps, and then turning on layer shadows. I just did this and its like 10 lines of code and really makes it much easier to supply user images.

Popover disappears in certain animation cases

I was dismissing a normal UIPopoverController with animation and then presenting a WEPopoverController with animation.

The normal popover fades out, the WEPopover fades in, and then disappears!

I can't find where the WEPopover is being hidden, but if I go from the WEPopover to a normal popover, or from a normal popover to another normal popover, both cases work fine - the one popover fades out and the new one fades in. I believe it has something to do with the end of animation although I tried breakpointing on that function and it only occurs after the fade in.

I did manage to find a workaround which although not exactly the effect I wanted, it's better than having the popover disappear!

Workaround: dismiss the normal popover without animation and the WEPopover stays visible.

Modernize it

You should update this for iOS 6, ARC, and to use storyboards.

Missing "presentPopoverFromBarButtonItem" method

Hi, thanks again for this great work !

It's not really an issue but more a remark about WEPopover missing a method that is present in UIPopover :

  • (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

I'll check on my own how to get the rect and view from an UIButtonItem, but it's not trivial.
I'll update here if I got any additionnal information

presentPopoverFromBarButtonItem: not working properly in iOS5

I traced the problem down to the frameInView code in UIBarButtonItem+WEPopover.m

First, I got an error when running due to the location of the following code:

if (!hasCustomView) {
         [self setCustomView:nil];
}

Since this code occurred before UIView *button = [parentView.subviews objectAtIndex:indexOfView]; and the newly created view was the last object in the array, the indexOfView parameter exceeded the bounds of the array.

I moved the code shown above to after the array is referenced and that eliminated the error.

However, frameInView doesn't return the proper CGRect for the button, which messes up the position of the arrow and to make matters worse, the button completely disappears from the app once pressed!

I haven't found a proper way to get the correct frame, so I ended up using presentPopoverFromRect: using two different CGRect's - one for portrait and one for landscape.

Hopefully this will save you time and effort if you plan on using presentPopoverFromBarButtonItem:

Possible App Rejection (Private API Name Collision)

I ran my project through App Scanner, an unofficial private API detector that I wrote and it flagged

animationDidStop:finished:context:

in WEPopoverController.m

I checked it out and sure enough there were 2 instances where it is invoked. Also there is an implementation for that method signature.

The offending lines are around 176, 249, and 79.

The solution is to resolve the private API name collision by renaming the method signature to something like
myAnimationDidStop:finished:context:

See this StackOverflow for one of many cases where people have had their apps rejected for this.
http://stackoverflow.com/questions/3455604/apple-rejected-app-because-of-animationdidstopfinishedcontext-is-a-non-public

Shadow Not Working (Partial Solution Provided)

If you set WEPopoverContainerViewProperties.shadowColor to a solid color, it doesn't work as expected. This is because the -shadowView is empty and thus won't cast any shadow.

The solution is to manually provide a shadow path. You will have to adjust the path or the WEPopoverContainerViewProperties's background image or margins.

You can put this line inside [WEPopoverContainerView -initFrame] after the -shadowView frame is set:

....
_bgView.frame = _bgRect;		// PROVIDED FOR CONTEXT
_shadowView.frame = _bgRect;	// PROVIDED FOR CONTEXT

// set shadow path here when shadowView.frame is set.
// we need it since the shadowView is empty and won't cast any shadow.
_shadowView.layer.shadowPath = CGPathCreateWithRect(_shadowView.bounds, NULL);
....

error: @synthesize of 'weak' property is only allowed in ARC or GC mode

This was the error I experienced, while using Cocoa Pods -- pod 'WEPopover', :head.

screen shot 2014-10-08 at 1 25 38 am

screen shot 2014-10-08 at 1 42 50 am

Fix -
Yes, WEPopover migrated to ARC. The only way to fix the above error is by replacing weak by assign in WEPopoverContainerView.h and WEPopoverController.h Now, there could be a scenario when an object with a assign property is deallocated, the value of the assign pointer will not be set to nil, you will run the risk of accessing garbage. Let me know your thoughts.

The contents of the PodFile, incase you want to duplicate the error -

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '6.0'
inhibit_all_warnings!
pod 'WEPopover', :head

Please add semantic version tags.

WEPopover was added to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects and provides a central repository for iOS/OS X libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, WEPopover doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Exception on iOS 5.1.1 in WEPopoverController.m

-[UITableViewCellContentView translatesAutoresizingMaskIntoConstraints]: unrecognized selector

Fix is quite easy (various ways to do it, but one option is below). Change Line 858 in WEPopoverController.m to:

       if (view.autoresizingMask != UIViewAutoresizingNone || ([view respondsToSelector:@selector(translatesAutoresizingMaskIntoConstraints)] && !view.translatesAutoresizingMaskIntoConstraints)) {

WEPopover doesn't respond to orientations

Hi, I am having difficulties w/ WEPopover not responding to orientations correctly. in IB I created a uiviewcontroller, inside of it I have uitableview. I init wepopover by doing this:

         myPopoverController = [[WEPopoverController alloc] initWithContentViewController:filtersController];

then I present it:

[myPopoverController presentPopoverFromRect:CGRectMake(pos.x, pos.y, textField.frame.size.width, textField.frame.size.height) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 

It seems like when keyboard is shown it autorotates to orientaiton just fine, but if keyboard isn't shown (which is what i want) the table view just floats above everything but doesn't respond to orientation. Any ideas what I could be doing wrong?

Doesn't pop up in the right location in the general case

I added this code to WEPopoverController to make it work - not sure how to submit a bug fix so here it is:
in: WEPopoverController.m
issue: Tried presenting a popover from an MKMapView, using the Annotation View's coordinates, and its superview. The annotation view's coordinates seem to be in absolute world coordinates as both X and Y are extremely large. The superview for annotation views is some custom layer view on top of the actual MKMapView. Still - showing a popover should work
fix: Converting the coordinates to key view coordinates, and using key view as the superview makes the rest of the code work.
regression: I assume that some of the code further down the line only works when "theView" has an x coordinate of 0 on-screen. Something like that. Works perfectly with the patch below.

  • (void)presentPopoverFromRect:(CGRect)rect
    inView:(UIView *)theView
    permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections
    animated:(BOOL)animated {

    [self dismissPopoverAnimated:NO];

    //First force a load view for the contentViewController so the popoverContentSize is properly initialized
    contentViewController.view;

    // create bg view
    UIView *keyView = self.keyView;

    // Nik: convert the rect to bg view coordinates
    // this is a little trick so the rest of the code works - theView and rect have some restrictions that make them not work in the general
    // case. Rather than fix all that code, we convert the rect to key view coords, and use the keyView (as it's already in the view hierarchy).
    rect = [keyView convertRect:rect fromView:theView];
    theView = keyView;

popover goes out of screen after orientation change (fix attached)

When one changes the screen orientation, the popover may go out of screen. After you restore the original orientation, it appears again.

$ git diff
diff --git a/WEPopover/Popover/WEPopoverController.m b/WEPopover/Popover/WEPopoverController.m
index 313b8f0..3965397 100755
--- a/WEPopover/Popover/WEPopoverController.m
+++ b/WEPopover/Popover/WEPopoverController.m
@@ -193,7 +193,9 @@
     }
     containerView.clipsToBounds = contentViewController.view.clipsToBounds;
        containerView.autoresizingMask = ( UIViewAutoresizingFlexibleLeftMargin |
-                                                                         UIViewAutoresizingFlexibleRightMargin);
+                                      UIViewAutoresizingFlexibleRightMargin |
+                                      UIViewAutoresizingFlexibleTopMargin |
+                                      UIViewAutoresizingFlexibleBottomMargin);

        self.view = containerView;
        [self updateBackgroundPassthroughViews];

Of course, it would be better to omit the UIViewAutoresizingFlexibleXxxMargin on the side with the arrow.... or on the side nearest to the corresponding super-view boundary... but this fix so far is good enough. It just does not happen to move far from the pressed button.

Popover from Custom Toolbar issues...

Hi,

Displaying popover's from navbar works perfectly... class is great!
However when displaying from a custom toolbar it all goes a bit funny.

I have a toolbar at the bottom of the screen with a bar button on the left-hand side. When I call presentPopoverFromBarButtonItem:, I input sender, however it decides to put the arrow in the middle of the toolbar, and then fades out my toolbar, and from then on I can't interact with it, even when it's closed.

Here is an image which demonstrates my problem:
Before and after popover

And here is my code for the display method:

- (IBAction)layersButtonPressed:(id)sender {
    if (!self.popoverController) {
        PopoverContentViewController *contentViewController = [[PopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];
        contentViewController.items = [[NSArray alloc] initWithObjects:@"Layer 1", @"Layer 2", @"Layer 3", nil];
        contentViewController.popoverType = PCPopoverTypeCheckList; //Custom enum for content
        self.popoverController = [[[popoverClass alloc] initWithContentViewController:contentViewController] autorelease];
        self.popoverController.delegate = self;
        [self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
        self.popoverController.passthroughViews = [NSArray arrayWithObject:toolbar];
        [self.popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        [contentViewController release];
    }
    else {
        [self.popoverController dismissPopoverAnimated:YES];
        self.popoverController = nil;
    }
}

Thanks in advance,
Alex

Using WEPopover in combination with DCIntrospect

WEPopover does not work in combination with DCIntrospect. This is because DCIntrospect changes the first subview of the main UIWindow to a UITextField. And WEPopover is using the first subview of the window to add the popover view to.

This is not a huge issue since DCIntrospect is only supposed to be used in the iOS Simulator. But it would at least be helpful to mention it on the Wiki. It might safe people who see that it works on the device but not in the simulator a lot of time .

Build Warning in WEPopoverController.m

Compiling with LLVM Compiler 2.1, I get a build warning for the line,

contentViewController.view;

"property access result unused - getters should not be used for side effects"

I can make that warning go away, by rewriting that line as:

[contentViewController view];

So far as I know, it gives you the end result in an almost exactly similar approach minus the build warning. Granted the build warning is still valid in this scenario (getters shouldn't be used for side effects).

Current build has strange appearance

On the simulator in either iPhone or iPad, when you run the demo a strange darker black artifact (a thick vertical line) animates into the right side of the popover. It's distracting and obvious. Moreover, I think you could significantly improve drawing and scaling issues by using Core Graphics to draw most of the various images you bundle with the framework.

ModalViewController

When there is a modalviewcontroller in the foreground and the popover is triggered inside the modalviewcontroller it shows itself behind the modalviewcontroller.

ContentSize on iPad

I'm using WEPopover on iPad and I have to set popoverController.popoverContentSize before presenting the popover, in order to not get an zero-sized popover. The problem lies in WEPopoperContainerView:

[self determineGeometryForSize:correctedSize anchorRect:anchorRect displayArea:displayArea permittedArrowDirections:permittedArrowDirections];
[self initFrame];

In between those two calls, the value of bgRect gets lost and thus the frame stays zero. On the iPhone, in your sample code, this doesn't happen somehow.

autorelease

Your code doesn't compile, Xcode complains: ARC forbids explicit message send of 'release'

Fails creating popOver in UITableView controller for some UITableViewCell

Hi,
I'm trying to use WEPopover on some UITableViewCells, it's working well for cells at the beginning of the tableview, but after a certain limit, it's just stopping showing the popOver !
The call is the following :
[self.wepopoverController presentPopoverFromRect:aCell.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown
animated:YES];

The same command using an UiPopoverController on iPad is working well !

The origin of the arrow should be rounded.

When caculating the frame of arrow in WEPopoverContainerView, the position of arrow should be roundf(x) or round(y). Otherwise the drawing of the arrow will blur.

I have add four lines of code. Should I commit it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.