天天看點

[翻譯] CNPPopupController

cnppopupcontroller

[翻譯] CNPPopupController

cnppopupcontroller is a simple and versatile class for presenting a custom popup in a variety of fashions. it includes a many options for controlling how your popup appears and behaves.

please feel free to contribute to this project, open issues, make suggestions and submit pull-requests. if you use this project in your app, let me know. i'd love to see what you do with it.

cnppopupcontroller是一個簡單的用于提示顯示用的view,提供幾種流行的顯示模式。他包含了很多的設定選項供你定制他的樣式。

歡迎你免費使用這個項目,并給我提出需求以及建議,或者自己改進他。如果你的項目中用了這份代碼,如果你能告訴我,我将感激不盡。

[翻譯] CNPPopupController

installation

<code>pod 'cnppopupcontroller'</code>

支援cocoa pods,

pod 'cnppopupcontroller' 即可安裝

usage

(see sample xcode project in <code>/cnppopupcontrollerexample</code>)

在xcode project in <code>/cnppopupcontrollerexample檢視使用樣例</code>

creating a popup

create a popup with custom animations and behaviors. customizations can also be accessed via properties on the <code>cnppopuptheme</code> instance:

建立一個popup,支援自定義的動畫方式。你可以通過主題執行個體中的參數來定制樣式:

<code>popuptitle</code> only accepts an <code>nsatributedstring</code> object.

popuptitle隻支援富文本對象。

<code>contents</code> only accepts an array of <code>nsattributedstring</code> and <code>uiimage</code> objects.

contents隻支援富文本以及圖檔對象。

<code>buttonitems</code> only accepts an array of <code>cnppopupbuttonitem</code> objects.

buttonitems隻支援cnppopupbuttonitem對象數組。

<code>destructivebuttonitem</code> only accepts an <code>cnppopupbuttonitem</code> object.

destructivebuttonitem隻支援cnppopupbuttonitem對象。

note: you may pass <code>nil</code> for any of the initializer properties when creating the popup, but you must assign a <code>theme</code> to the popup before showing it!

a default theme <code>+ [cnppopuptheme defaulttheme]</code> has been created to help you out.

注意:你建立完了popup後,也許會傳遞nil給某些屬性,但是,你必須在顯示這個view之前指定一個主題!

一個預設的主題是 + [cnppopuptheme defaulttheme] ,你可以用這個方法來幫你。

<code>cnppopupbuttonitem</code> allows you to customize the style for each button on a <code>cnppopupcontroller</code>instance. you may customize button height, color, border width, corner radius, and border color;

cnppopupbuttonitem允許你修改按鈕的樣式,你可以修改按鈕的高度,顔色,邊緣厚度,圓角值以及邊緣顔色;

showing a popup

<code>- (void)presentpopupcontrolleranimated:(bool)flag;</code>

dismissing a popup

<code>- (void)dismisspopupcontrolleranimated:(bool)flag;</code>

customization

a <code>cnppopuptheme</code> instance can be created and assigned to the <code>theme</code> property of a<code>cnppopupcontroller</code> instance.

<code>@property (nonatomic, strong) uicolor *backgroundcolor;</code>

<code>@property (nonatomic, assign) cgfloat cornerradius;</code>

<code>@property (nonatomic, assign) cgfloat preferredpopupwidth;</code>

<code>@property (nonatomic, assign) cgfloat minimumpopupheight;</code>

<code>@property (nonatomic, assign) uiedgeinsets popupcontentinsets;</code>

<code>@property (nonatomic, assign) cnppopupstyle popupstyle;</code>

<code>@property (nonatomic, assign) cnppopuppresentationstyle presentationstyle;</code>

<code>@property (nonatomic, assign) cnppopupmasktype masktype;</code>

<code>@property (nonatomic, assign) bool shoulddismissonbackgroundtouch;</code>

<code>@property (nonatomic, assign) cgfloat contentverticalpadding;</code>

<code>@property (nonatomic, assign) uistatusbarstyle fullscreenstatusbarstyle;</code>

notes

deployment

<code>cnppopupcontroller</code> works on ios 7 and ios 8.

cnppopupcontroller支援ios7與ios8

todo

add 'blur' option for background mask 添加背景模糊效果