adad184 / mmpopupview Goto Github PK
View Code? Open in Web Editor NEWPop-up based view(e.g. alert sheet), can be easily customized.
License: MIT License
Pop-up based view(e.g. alert sheet), can be easily customized.
License: MIT License
串哥,原因是detailLabel的top.offSet写死了。
[self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lastAttribute).offset(5);//这里应该加一个判断
make.left.right.equalTo(self).insets(UIEdgeInsetsMake(0, config.innerMargin, 0, config.innerMargin));
}];
UITableView嵌入 MMPopupView中后必须长按UITableViewCell后UITableView中的didSelectRowAtIndexPath 方法才会执行
很好用,不过横屏时方向有问题,期待新版本
解决一下吧~
现在只支持单个TextField,像那种用户名密码就不好做了。
建议加入列表式勾选
在iOS10中好像所有的animation都没有效果了
能否修复一下在iPad上面的兼容性,谢谢
您好,我自定义了一个 PopupView,type是MMPopupTypeCustom,但是动画效果却不是 demo 里面那样的是下滑的,当我在自定义 view 上面添加一个 textField 之后重载 showKeyBoard 方法之后才会有下滑的动画效果
RT
应该有个变量来设置一下。 可以点击其他地方,就 dismiss 掉。不然只能点击 alert 的 button 才 dismiss 掉。
如何让popupWindow的状态栏是白色
touchWildToHide开启以后 actionsheet的按钮的点击事件都失效了,挺严重的一个bug,希望大神有时间的话调整一下、真是一个好用的库
我将 MMAlertView 添加至 [UIApplication sharedApplication].keyWindow, 在点击 Item之后, 界面变为黑色.
我如何能够将 MMAlertView 添加至全屏幕 且 顺利执行?
附代码:
MMPopupItemHandler completeBlock = ^(NSInteger index){
//***
};
NSArray *items =
@[
MMItemMake(@"不了,谢谢", MMItemTypeNormal, nil),
MMItemMake(@"去注册", MMItemTypeHighlight, completeBlock)];
MMAlertView *alertView = [[MMAlertView alloc] initWithTitle:@"创建新用户"
detail:@"该手机号未注册, 是否注册为新用户?"
items:items];
alertView.attachedView = [UIApplication sharedApplication].keyWindow;
[alertView show];
我这里有个需求,Appdelegate中监听某一事件,当触发后弹出提示框。请问在要如何使用?
alert.attachedView = self.window.rootViewController.view
alert.show()
行不通
PinVin输入数字后界面上没有数字显示
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'hide animation must be there'
通过xib创建一个view,xib中有个按钮,拖线后,点击按钮崩溃
//
(instancetype)init
{
self = [super init];
if (self) {
self.type = MMPopupTypeSheet;
self.backgroundColor = [UIColor whiteColor];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo([UIScreen mainScreen].bounds.size.width);
make.height.mas_equalTo(400);
}];
[self loadFormXib];
}
return self;
}
-(void)loadFormXib{
UIView *xib = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil].lastObject;
xib.frame = self.frame;
[self addSubview:xib];
}
(IBAction)backButtonClick:(id)sender {
[self hide];
}
串哥给看看呗
首先,非常感谢你分享的popView框架,用起来非常方便。效果也很好。
其次,有个问题请教一下:当我点击了MMPopView的item之后,然后当前控制器去modal一个控制器,经常会崩溃,但是没有断点。希望有时间查看一下这个问题。我也在查看,有结果会及时通知你,谢谢!
这个也是比较常用的吧,毕竟原生的Alert就有两个输入框。(根本原因还是手懒)
能够控制弹框在view上的位置
这一行
MMPopupCategory.m
- (void)mm_showDimBackground
{
++self.mm_dimReferenceCount;
NSLog(@"dim count: %@",@(self.mm_dimReferenceCount));
if ( self.mm_dimReferenceCount > 1 )
{
return;
}
}
Delpoyment Target: iOS 7.0
Base Target: iOS 9.0
Version: 1.5
[[[MMAlertView alloc] initWithConfirmTitle:@"xxxxxx" detail:nil] show];
Never show up
MMSheetView能不能提供个不要取消按钮的属性?
pod search MMPopupView
[!] Unable to find a pod with name matching `MMPopupView'?
do I write wrong?
这个方法不调用- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
attachedView是KeyWindow,如何设置点击按钮其他位置隐藏弹框?
首先谢谢作者的付出。
情况是这样的:
1.在一个控制器里设置竖屏
2.show出自定义的MMPoppuView
3.旋转屏幕,控制器不受影响,但是状态栏无法控制,仍然随屏幕旋转改变。
这个情况在hide掉之后,仍然存在。
我估计是因为MMPopupWindow的问题,我尝试修改成一个自定义的rootViewController,就可以控制这个情况了。但是效果仍然不太好。
以前可以用的,后来不行了。demo正常,新建项目pod安装,照样不行。
竖屏的ViewController,弹出AlertView ,然后 present一个横屏的ViewController出来以后,再弹出一个AlertView,第二个 AlertView的方向不对。
设置了MMPopupWindow的touchWildToHide属性为yes之后,alert和sheet依然不能点击周围关闭掉,最新的demo运行设置之后也不能点击周围关闭掉~
如何才能解决呢?
自定义view继承MMPopupView,设置按钮点击方法,hide方法失效,有时需要点击几次才能执行
MMAlertView *inputView = [[MMAlertView alloc] initWithInputTitle:@"Title" detail:@"" placeholder:palceHolder handler:^(NSString *text) {
// 想在点击确定的的时候消失。
}];
[inputView show];
串神,我在使用有输入框的 AlertView 时,点击取消时会自动消失,点击确定的时候不消失。想在 block 回调的时候调用消失方法,但是此时实例还没初始化,又不能捕获到自己的实例。
暂时的处理是,直接在源码里面 self.inputHandler() 前调了下 hide ....
不知道有没有什么其他的解决办法?
这个样式真心漂亮, 不知是否考虑出个swift版?
找了好几圈, 一直未找到能这么漂亮的swift版本的替代版本..
custom view 添加到 MMPopupView,custom view 上的所有 touch event 都无效
MMPopupView非常漂亮实用,我现在使用桥接方法可以在swift当中使用,但是请问有swift版本的吗
对于sheet和alert touchWildToHide这个属性失效了
首先感谢分享这么好的popView,最近正好在学习使用swift,发现两个小问题
let block: MMPopupItemHandler = { (index) -> Void in
printLog(index)
}
let items = [MMItemMake("男", MMItemType.Normal, block),
MMItemMake("女", .Normal, block),
MMItemMake("取消", .Normal, block)]
let sheet = MMSheetView(title: "选择性别", items: items)
sheet.show()
如上所示,直接报错error: IR generation failure: program too clever: variable collides with existing symbol OBJC_CLASS_$_MMPopupItem
如果按下面这种写法
weak var weakSelf = self
let man = MMItemMake("男", .Normal) { (index) -> Void in
weakSelf?.gender = "男"
}
let girl = MMItemMake("女", .Normal) { (index) -> Void in
weakSelf?.gender = "女"
}
let sheet = MMSheetView(title: "请选择您的性别:", items: [man,girl])
sheet.show()
就可以正常弹出
你好,我在使用您的MMPopupView时遇到这个情况,自定义的View无法显示,一直找不到原因,以下是我的代码 能否麻烦您帮我看一下是不是哪里错了呢,感谢
`import UIKit
import ChameleonFramework
enum ShareType {
case TOPIC
case STATION
}
class ShareView: MMPopupView {
typealias cancelAc = ()
typealias confirmAc = () -> Void
internal var cancelBlock: cancelAc?
private var confirmBlock: confirmAc?
// 标题
private var titleLabel: UILabel = {
let label = UILabel()
label.textColor = FlatNavyBlue()
label.textAlignment = .Center
label.font = UIFont.systemFontOfSize(15)
label.layer.borderWidth = 0.3
label.layer.borderColor = FlatWhite().CGColor
label.backgroundColor = UIColor.vcMainColor()
label.layer.masksToBounds = true
return label
}()
// 确定 按钮
private var confirmBtn: UIButton = {
let confirmBtn = UIButton()
confirmBtn.titleLabel?.font = UIFont.systemFontOfSize(14)
confirmBtn.setTitleColor(FlatNavyBlueDark(), forState: .Normal)
confirmBtn.backgroundColor = UIColor.vcMainColor()
return confirmBtn
}()
// 图片
private var shareImageView: UIImageView = {
let imageView = UIImageView()
imageView.layer.cornerRadius = 5.0
imageView.layer.masksToBounds = true
return imageView
}()
// 正文标题
private var shareTitle: UILabel = {
let label = UILabel()
label.textColor = FlatBlack()
label.font = UIFont.systemFontOfSize(15)
return label
}()
// 正文
private var shareContentLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFontOfSize(12)
label.textColor = FlatGray()
label.backgroundColor = UIColor.vcMainColor()
label.layer.cornerRadius = 1.0
label.layer.masksToBounds = true
return label
}()
// 标题 Title
internal var mainTitle: String? = "提示"{
didSet{
titleLabel.text = mainTitle
}
}
// ShareView背景色
internal var viewColor: UIColor? = UIColor.whiteColor(){
didSet{
self.backgroundColor = viewColor
}
}
// 确定按钮 Title
internal var confirmTitle: String? = "确定"{
didSet{
confirmBtn.setTitle(confirmTitle, forState: .Normal)
}
}
// 确定按钮 TitleColor
internal var confirmBtnTitleColor: UIColor? = FlatNavyBlueDark(){
didSet{
confirmBtn.setTitleColor(confirmBtnTitleColor, forState: .Normal)
}
}
override init(frame: CGRect) {
super.init(frame: frame)
}
// 取消按钮-事件
func cancel(){
}
// 确定按钮-事件
func confirm(){
self.hide()
confirmBlock!()
}
init(Type:ShareType,frame:CGRect,shareData:ShareData,confirmAction: (() -> Void)?) {
super.init(frame: frame)
print("MMPopup初始化\(frame)")
self.type = MMPopupType.Custom
self.frame = frame
self.backgroundColor = viewColor
self.layer.cornerRadius = 2.0
self.layer.masksToBounds = true
titleLabel.text = mainTitle
confirmBlock = confirmAction
confirmBtn.setTitle(confirmTitle, forState: .Normal)
confirmBtn.addTarget(self, action: #selector(self.confirm), forControlEvents: .TouchUpInside)
self.addSubview(titleLabel)
//self.addSubview(cancelBtn)
self.addSubview(confirmBtn)
titleLabel.sd_layout()
.topSpaceToView(self,0)
.leftSpaceToView(self,0)
.rightSpaceToView(self,0)
.heightIs(30)
confirmBtn.sd_layout()
.leftSpaceToView(self,0)
.rightSpaceToView(self,0)
.bottomSpaceToView(self,0)
.heightIs(35)
switch Type {
case .STATION:
StationShareViewInitlizel(shareData)
break
case .TOPIC:
TopicShareViewInitlizel(shareData)
break
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func StationShareViewInitlizel(data:ShareData){
shareImageView.sd_setImageWithURL(NSURL(string: data.shareImageUrlStr))
self.addSubview(shareImageView)
shareImageView.sd_layout()
.topSpaceToView(titleLabel,5)
.leftSpaceToView(self,5)
.heightIs(self.frame.height - 35 - 30 - 15)
.widthIs(self.frame.height - 35 - 30 - 15)
shareTitle.text = data.shareTitle
self.addSubview(shareTitle)
shareTitle.sd_layout()
.topEqualToView(shareImageView)
.leftSpaceToView(shareImageView,5)
.rightSpaceToView(self,5)
.heightIs(16)
shareContentLabel.text = data.shareContent
self.addSubview(shareContentLabel)
shareContentLabel.sd_layout()
.topSpaceToView(shareTitle,10)
.leftEqualToView(shareTitle)
.rightEqualToView(shareTitle)
.autoHeightRatio(0)
shareContentLabel.setMaxNumberOfLinesToShow(3)
}
private func TopicShareViewInitlizel(data:ShareData){
}`
我用Swift模仿MMDateView写了个PopupView,但是第一次show不出来,只看到虚化的背景,点击自动hide之后,再调用show就出来了..不知道是什么情况..对象是每次都new的,就是每次都执行的相同的代码
btw..感谢你开源的这个项目,我很钟意.
Sheet 弹出框,点击以后拨打电话,挂掉电话,会自动回到之前的页面,但是键盘消失了
MMAlertView *alertView = [[MMAlertView alloc] initWithTitle:kATitle detail:kATip items:items];
alertView.attachedView = [UIApplication sharedApplication].keyWindow;
alertView can show normally, but it turns black screen after click every item.
environment: Xcode7.3
哥,你写的库又上榜了,恭喜啊。
Sheet添加多行会超出屏幕,不支持滚动。
你好,MMPopupView 的 showAnimation 里面的 UIView animation 没有效果呀(直接跳到了animation之后的设置结果)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.