[翻譯] KGModal

KGModalgit

KGModal is an easy drop in control that allows you to display any view in a modal popup. The modal will automatically scale to fit the content view and center it on screen with nice animations!github

KGModal容許你用pop出你的view,要顯示的view會自動的縮放到合適的級別,並在屏幕中間,動畫效果很炫哦!app

You supply your own content view and KGModal does the rest:ide

你須要提供你的內容view,以後就交給KGModal就好了:動畫

[[KGModal sharedInstance] showWithContentView:contentView andAnimated:YES];

There are a couple other options but it's purposely designed to be simple and easy to use:this

固然,還有好多其餘屬性供你設置,使用起來很簡單哦:atom

// Determines if the modal should dismiss if the user taps outside of the modal view
// Defaults to YES @property (nonatomic) BOOL tapOutsideToDismiss; // Determines if the close button or tapping outside the modal should animate the dismissal // Defaults to YES @property (nonatomic) BOOL animateWhenDismissed; // Determins close button type (None/Left/Right) // Defaults to Left @property (nonatomic) KGModalCloseButtonType closeButtonType; // Determines whether close button will display on the left or right // Defaults to left @property (nonatomic) KGModalCloseButtonLocation closeButtonLocation; // The background color of the modal window // Defaults black with 0.5 opacity @property (strong, nonatomic) UIColor *modalBackgroundColor; // The background display style, can be a transparent radial gradient or a transparent black // Defaults to gradient, this looks better but takes a bit more time to display on the retina iPad @property (nonatomic) enum KGModalBackgroundDisplayStyle backgroundDisplayStyle; // The shared instance of the modal + (id)sharedInstance; // Set the content view to display in the modal and display with animations - (void)showWithContentView:(UIView *)contentView; // Set the content view to display in the modal and whether the modal should animate in - (void)showWithContentView:(UIView *)contentView andAnimated:(BOOL)animated; // Hide the modal with animations - (void)hide; // Hide the modal with animations, // run the completion after the modal is hidden - (void)hideWithCompletionBlock:(void(^)())completion; // Hide the modal and whether the modal should animate away - (void)hideAnimated:(BOOL)animated; // Hide the modal and whether the modal should animate away, // run the completion after the modal is hidden - (void)hideAnimated:(BOOL)animated withCompletionBlock:(void(^)())completion;

Check out the ExampleApp to see it in action!spa

你能夠在ExampleApp中查看效果!rest

Installation via Cocoapods 經過Cocoapods來安裝

Add pod 'KGModal', '~> 0.0.1' to your Podfile and run pod to install.code

添加 KGModal ,而後運行pod來安裝。

相關文章
相關標籤/搜索