STPopup icon indicating copy to clipboard operation
STPopup copied to clipboard

Add property control did tap background view due with dismiss action

Open xhzengAIB opened this issue 8 years ago • 7 comments

xhzengAIB avatar Oct 15 '15 02:10 xhzengAIB

@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.

kevin-lyn avatar Oct 15 '15 02:10 kevin-lyn

你好!可以讲中文吗?

xhzengAIB avatar Oct 15 '15 05:10 xhzengAIB

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

Jack

xhzengAIB avatar Oct 15 '15 05:10 xhzengAIB

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

Jack

xhzengAIB avatar Oct 15 '15 05:10 xhzengAIB

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

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

kevin-lyn avatar Oct 15 '15 07:10 kevin-lyn

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

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

xhzengAIB avatar Oct 16 '15 02:10 xhzengAIB

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...

kodekarim avatar Oct 27 '15 20:10 kodekarim