Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property control did tap background view due with dismiss action #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xhzengAIB
Copy link

No description provided.

@kevin-lyn
Copy link
Owner

@xhzengAIB Hi, actually with the latest version, you can get the backgroundView from STPopupController, which means you can add any gesture you want to the background view, includes a tapGesture for dismissing the popup.
So instead of exposing a new property to the user, I may say using the backgroundView for customisation would be better.

@xhzengAIB
Copy link
Author

你好!可以讲中文吗?

@xhzengAIB
Copy link
Author

Hi!@kevin0571
其实不然,如果定制background view的话,那可能就会产生歧义,如果希望某个页面可以支持点击背景进行消失,又或者是某个页面不支持点击背景消失,定制背景View就无法满足了,你觉得是吗?

Jack

@xhzengAIB
Copy link
Author

如果提供一个Property进行针对性的描述某个具体页面需不需要某个功能,这应该是比较合理的吧?

Jack

@kevin-lyn
Copy link
Owner

@xhzengAIB
通过添加属性来实现这个功能会让使用者更方便,也最直接,但是随着需求的增加,如果每个需求都通过添加一个特定的属性来支持的话,接口很快就臃肿了。
所以我的偏好是,尽可能少的提供功能单一的接口,让控件扩展的空间更大。
纯属个人封装组件的偏好,望谅解 : )

至于你说的”希望某个页面支持点击背景消失,某些不支持“,可以在view controller的viewWillAppear和viewWillDisappear里通过 self.popupController.backgroundView 获取 backgroundView 并对其进行tapGesture的注册和反注册则可实现。

@xhzengAIB
Copy link
Author

@kevin0571
我的意思并不是一概而论的哦!不是每个需求都通过类似的方式,从现在的框架来看,先有的UITap手势来View的Editi状态,和现在这个需求是一样的,那Editi是否也可以让完成自定义呢?并不是的,每次Set background view的时候默认加上了,所以通过属性来完成这个业务会比较适合,

至于你说的解决方案,通过获取backgoundView来控制,这样使用者一不小心就漏掉某些代码,而且会让ViewController很臃肿,个人觉得并不是很好的方案

@kodekarim
Copy link

sir i m new to ios developer
i want to know if it is possible to set the frame of pop in ur STPopup. AS the popup displayed in the middle of the screen so if i want to move that screen to some x or y position...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants