弹出视图,支持任何定制,整合UIAlertView和UIActionSheet两种风格的弹框,支持iOS7
整合了UIAlertView和UIActionSheet这两种系统风格的弹框,创建弹框再也不用兼容iOS8以前和iOS8以后了。代码也不会因为delegate而分离,直接接受Block回调。如果您觉得我的代码帮到了您,我会非常欣慰。同时如果您想兼容到iOS7以前,或者您觉得有其他地方需要改进的,或者代码有什么Bug,非常欢迎您与我联系,我的qq:1522949535,邮箱:qq邮箱
这里的代码可能不是最新的,如果您想下载最新代码,欢迎您到GitHub下载:https://github.com/XIAMOON/LQPopUpView
创建方式1:
LQPopUpView *popUpView = [[LQPopUpView alloc] initWithTitle:@"提示" message:@"这是用第一种初始化方法创建的弹出视图"];
[popUpView addBtnWithTitle:@"取消" type:LQPopUpBtnStyleCancel handler:^{
// do something...
}];
[popUpView addBtnWithTitle:@"确定" type:LQPopUpBtnStyleDefault handler:^{
// do something...
}];
[popUpView showInView:self.view preferredStyle:_segmentControl.selectedSegmentIndex];
创建方式2:
LQPopUpView *popUpView = [[LQPopUpView alloc] initWithTitle:@"提示" message:@"这是第二种创建方式,也是一种快捷创建方式,没有太多的代码分离,使用起来特别方便,而且你可以单独再次加入任何按钮" cancelButtonTitle:@"取消" otherButtonTitles:@[@"提示一次", @"提示两次", @"确定"] actionWithIndex:^(NSInteger index) {
// do something...
}];
[popUpView showInView:self.view preferredStyle:_segmentControl.selectedSegmentIndex];
创建方式3:
LQPopUpView *popUpView = [[LQPopUpView alloc] initWithTitleConfiguration:^(TitleConfiguration *configuration) {
configuration.text = @"提示";
} messageConfiguration:^(MessageConfiguration *configuration) {
configuration.text = @"这是第三种创建方式,这个创建方式可以对title和message的文本、字号、字体颜色、文本上下边距进行定制,随时适应您的需求";
configuration.fontSize = 15.0;
configuration.textColor = [UIColor purpleColor];
configuration.bottom = 25.0;
}];
[popUpView addBtnWithTitle:@"取消" type:LQPopUpBtnStyleCancel handler:^{
// do something...
}];
[popUpView showInView:self.view preferredStyle:_segmentControl.selectedSegmentIndex];
下载地址:http://www.wenjiangs.com/wp-content/uploads/2021/docimg35/92c455a18b57a31a26ea99173c183f1d.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论