Giter Club home page Giter Club logo

popoverview's Introduction

#PopoverView#

PopoverView is a simple resolution-independent UIView written entirely in CoreGraphics and QuartzCore for display of modal content on both iPhone and iPad. It can display singular UIView contentViews, arrays of UIViews, display titles, or even allow selection from a list of strings. It is implemented via a very simple static interface that allows you to show the popover with just a single line. All animation, positioning, and memory allocations are handled by the component at runtime. We are releasing under the MIT License.

For More Information, please see our full blog post: PopoverView



##Demonstration## As a quick demonstration, I used a UIView from another one of my components called OCCalendar[^1]. To display this to the user on tap, I simply allocate and initialize the view, then I use a single line to display it to the user. The PopoverView handles positioning above/below the point of interest, handles all of the memory management, and manages the view stack so it gets displayed to the user at the correct location.

OCDaysView *daysView = [[OCDaysView alloc] initWithFrame:CGRectMake(0, 0, 150, 100)];
[daysView setMonth:10];
[daysView setYear:2012];
//[PopoverView showPopoverAtPoint:point inView:self.view withContentView:[daysView autorelease] delegate:self];
[PopoverView showPopoverAtPoint:point inView:self.view withTitle:@"October 2012" withContentView:[daysView autorelease] delegate:self];

As you may note, I have two versions of the display code here. One of them displays the daysView as a single contentView with no title, and the other displays the same view with a "October 2012" title.


##Demo Project## The structure of the demo project is very simple. The PopoverView.h and .m files are in the "PopoverView" folder in the root directory. The demo project files are in the "popover/demo" subdirectory.


##License##

(MIT Licensed)

Copyright (c) 2012 Runway 20 Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

popoverview's People

Contributors

blackbears avatar davidcueva avatar gereons avatar graetzer avatar luoyibu avatar ocrickard avatar palringosteve avatar rainwolf avatar wasauce avatar yfme 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

popoverview's Issues

Fails to render on iOS 4

The popover view does not render the background correctly on iOS 4 (tested on 4.3.5 iPhone 3GS).

Screenshot

Code sample for rotation/orientation support?

This class is brilliant, however I've been struggling to get it working in multiple orientations; show a popover in portrait mode, rotate to landscape mode and it's nowhere near the point that I originally specified.

I've tried setting the autoresizingMask to have flexible left/top margins but this doesn't seem to work either.

I've also tried dismissing the popover then calling one of the show... methods again in response to an orientation event but this seems to result in the popover disappearing completely.

Any assistance would be greatly appreciated :)

Method of getting topView fails when using with DCIntrospect - popover doesn't appear

The line below (to get the topView) returns the DCIntrospect window instead of the application's window. I realize that DCIntrospect is kind of a unique-purpose tool and the conflict won't arise in production because DCIntrospect should never be used in production, but just wanted to give people a heads up in case they had issues with the Popover not showing. No error is thrown, just found it by tracing through the code.

  // get the top view
// http://stackoverflow.com/questions/3843411/getting-reference-to-the-top-most-view-window-in-ios-application/8045804#8045804
 topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];

Ensure only one Popoverview open at time?

There is an issue where if someone were to double tap on a cell where PopoverView is being used it will sometimes generate two instances of PopoverView. (One per tap) which will cause the application to crash... Is there a way to enforce only one PopoverView to be open at one time?

Here is the current code I am using in - (void)tableView:(UITableView *)TableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath

[PopoverView showPopoverAtPoint:cell.center inView:self.view withTitle:title withContentView:sti.view delegate:self];

Broken link

"...full blog post" link (http://blog.getsherpa.com/blog/2012/09/14/popoverview-a-flexible-modal-content-view-for-ios/) is broken:

404 Not Found

Code: NoSuchKey
Message: The specified key does not exist.
Key: blog/2012/09/14/popoverview-a-flexible-modal-content-view-for-ios/index.html
RequestId: D7C4DD86CCBDBC14
HostId: bxXuqQuubNRnJcjM9kIEQbuy40Q3Ia2QBLXxwGvuRf2tFu5GIHjufMndydLzQrzj

An Error Occurred While Attempting to Retrieve a Custom Error Document

Code: NoSuchKey
Message: The specified key does not exist.
Key: error.html

content view is not scrollable?

My content view is a UIViewController contains a UITableView, the cell is clickable, but the table view is not scrollable. It just crash, without any helpful information.

Crash when popoverView dismiss!

Crash when popoverView dismiss! I use ios sdk is 6.0 version.(my english is bad, i hope you understand..,thank you very much!!)
Crash message:
Thread 1
com.apple.main-thread
0CA::Layer::commit_if_needed(CA::Transaction_,void(),(CA::Layer,unsigned int, unsigned int ,void), void_)

Code:
UIButton *btn = (UIButton *)sender;
NSString *text = @"这是闲暇做的小应用,提供给大家免费使用。QQ:410139419。";
[PopoverView showPopoverAtPoint:btn.center inView:self.view withText:text delegate:nil];

Insert UIScrollView with image in PopoverView?

Hello, i have tried your PopoverView project today, and i think is really great! I have a question about it, there is a way to insert a UIScrollView with UIImageView?...i want insert in it some Image download from the web and loaded runtime when the user swipe left or right in the PopoverView...it's possible?

Proper device orientation not always recognized

Popover views don't always orient themselves as expected. In situations where the application is not using auto rotate to handle orientation changes, popoverview opens in portrait regardless of the device's actual orientation. Apple's built-in UIPopoverController resolves this by basing it's orientation on that of the status bar. Can this be altered to do the same? Or alternatively, maybe an additional optional delegate method could be added that would allow us to override the default orientation if desired?

Thanks, and fantastic job on this. Very nicely done.

interactive with SVProgressView

A popoverview may be added to a hud view when displaying. Cause it is appended to the top window. The problem is in some case a singleton hud view could always be interacted by a popoverview.

topView may be hidden

The topView in showAtPoint:inView:withContentView: may lead to a hidden view.

Maybe this works better ?

NSArray* windowViews = [[[UIApplication sharedApplication] keyWindow] subviews];
for (int i = windowViews.count - 1; i >= 0 ; i--)
{
topView = [windowViews objectAtIndex:i];
if (!topView.isHidden)
break;
}

when I press button a little quick, e.g. double click, then

when I press button a little quick, e.g. double click……
then the popover may overlay and can not dismiss.

after all, I use some flag to avoid this happen.
-(void)structTypeBtnClick:(UIButton*)sender{
_typeBtn = sender;
if (_typeBtn.selected) {
return;
}

[PopoverView showPopoverAtPoint:CGPointMake(530, 960) inView:self.view withContentView:_switchControl delegate:self];
_typeBtn.selected=YES;

}

but, There must be a better way to resolve this issue.

UITableView not responding to first tap

Hi,

I'm having a problem when adding a UITableView to the popoverView. The TableView is showing properly, but the first tap on it is lost (the didDeselectRowAtIndexPath method is not being called).

After the first tap on the table, it works as is intended (the didDeselectRowAtIndexPath method is called normally).

This is the code I'm using:

self.myTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 240, 120)];
self.myTable.delegate = self;
self.myTable.dataSource = self;

self.pv = [PopoverView showPopoverAtPoint:CGPointMake(40, 40)
                                   inView:self.view
                          withContentView:self.myTable
                                 delegate:self];

I tried adding the didDeselectRowAtIndexPath method on the example included and it presents the same behaviour.

I'm also using the component to show a custom calendar view and it works like a charm.

Inserting a TableView from a xib file

I found a bug when we try inserting a UITableView from a nib file. I tried to do this:

[[NSBundle mainBundle] loadNibNamed:@"MyTableViewNib" owner:self options:nil]; //My .xib file with UITableView inside it
UITableView *myTableView = [nibs objectAtIndex:0]; //Assuming the tableview is the unique object from the nib
[PopoverView showPopoverAtPoint:CGPointMake(0, 0) inView:self.view withTitle:nil withContentView:myTableView delegate:nil]

The size of the table doubles for unknown reason. The size of container is right.

Screenshot: http://img.photobucket.com/albums/v502/alessandro_ufms/Popoverbug.png

No Prefix on Class Names

Many projects have this very common name already in their project. Perhaps prefix it R20, e.g. R20PopoverView?

Tap below to dismiss?

Currently the only way to dismiss the popover is to tap above our to the left of the popover. Is there a way to allow for dismissal by tapping below the popover? I tried to changing the UIControlEventTouchUpInside but that didn't work. Any ideas? Thanks!

-showAtPoint:inView:withViewArray: setting y of views to original y, not running height

Line 275 states:

if([view isKindOfClass:[UILabel class]]) {
        //Now make sure all the labels are the full width
        view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y, totalWidth, view.frame.size.height);
}

But I believe that it shouldn't be checked to be a UILabel unless it is intended to only be used with labels (which makes the method name misleading). I've found that replacing all 3 of those lines with the following works as I believe was intended:

view.frame = CGRectMake(view.frame.origin.x, totalHeight, totalWidth, view.frame.size.height);

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

Hello!
PopoverView looks great and we'd really like to use it. However, wherever I add it to our app it crashes with a runtime error during

  • (void)showAtPoint:(CGPoint)point inView:(UIView *)view withContentView:(UIView *)cView

The crash happens at this line:
self.frame = topViewBounds;

-> Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

An NSLog I created above that line retrieves:
Frame: X=nan Y=nan W=0.0 H=0.0 - TopViewBounds: X=0.0 Y=0.0 W=0.0 H=0.0

It seems like there is something wrong with creating the PopoverView's frame.

Running in iOS 5 and iOS6 Simulator.

I appreciate any ideas and help!

Not working in landscape mode

This is related to Issue #4 - unfortunately PopoverView does not support being displayed on an already rotated view.

Is this being planned/worked on? Otherwise I might give it a stab.

Clang Leaks

The Clang analyzer found some leaks in PopoverView.m. It looks like just autoreleasing those three items fixes the problem, but wanted to bring it up before assuming they were actually leaks.

If you run the Xcode analyzer on the files you'll see the leaks. Take a look and let me know what you think.

ios6

The popover view is not responding for the touch events. The "didSelectItemAtIndex" on ios6, it only responds for index 0, all items above index 0 don't work when you click on them

CocoaPods/Specs/PopoverView is out of date

I tried to update CocoaPods myself, but they want the push to come from the original repo.

The PopoverView.podspec file in runway20/PopoverView looks like it has been updated, but it refers to a different repo (cocoa-factory/PopoverView) and a tag ("0.0.2") that only exists on that other repo.

Some instrux here: https://github.com/CocoaPods/CocoaPods/wiki/Contributing-to-the-master-repo#sharing-podspecs

And discussion on my push attempt here: CocoaPods/Specs#3672

Thank you!

Had a problem working with table view in PopOver.

Hi.

Had a problem working with table view in PopOvover. (with latest code)
Resolved by adding changes in this code in your class

//Add a tap gesture recognizer to the large invisible view (self), which will detect taps anywhere on the screen.
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
tap.cancelsTouchesInView = NO;// we need this to add possability to enable working witht able view
[self addGestureRecognizer:tap];
[tap release];

Actually there is only one line was added :
tap.cancelsTouchesInView = NO;// we need this to add possability to enable working witht able view

Really hope this will be useful fro you.

Thanks for you Class!!!

SplitViewController in portrait - popover appears behind mainView on detailView

So I'm not sure if any others have experienced this, but reading through other posts I didn't find anything that was exact.

Currently I have a project that uses a splitViewController. When in landscape I can tap a button in the mainView (leftside view) and the popupView shows up just as expected. However, if I rotate to portrait, swipe right to display the mainView on top of the detailView, then tap the same button the popupView appears behind the mainView on the detailView. If I slide the mainView out of the way the popupView remains there on the detailView.

Any help with this would be great. I'll mess around with things a bit to see if I can fix on my own, just thought I'd mention here.

Thanks!

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.