ZZCustomAlertViewiOS 模態(tài)彈窗
ZZCustomAlertView 是一個(gè)可以高度自定義的 iOS 模態(tài)彈窗 (modal alert view)。
項(xiàng)目地址:https://github.com/zzdjk6/ZZCustomAlertView
Github 項(xiàng)目里包含一個(gè) Example 的 Demo 示例。
使用 Cocoapod:
pod "ZZCustomAlertView"
這里是 Demo 效果視頻:http://v.youku.com/v_show/id_XMTI3NDQyODk3Mg==.html
簡(jiǎn)明用法
總的來說,你可以將完全自定義的一個(gè) View 作為 ZZCustomAlertView 的 contentView,并可以設(shè)置陰影的顏色、透明度、是否模糊背景、是否允許點(diǎn)擊背景隱藏彈窗等參數(shù)。
如下代碼將創(chuàng)建在 Demo 中看到的默認(rèn)彈窗。
ZZCustomAlertView *alert = [ZZCustomAlertView alertViewWithParentView:self.view andContentView:nil];
[alert show];
如下代碼將創(chuàng)建在 Demo 中看到的自定義彈窗。
UIImage *img = [UIImage imageNamed:@"Perfect Button"];UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, img.size.width, img.size.height);
[btn setImage:img forState:UIControlStateNormal];
[btn addTarget:self action:@selector(customButtonPressed) forControlEvents:UIControlEventTouchUpInside];
ZZCustomAlertView *alert = [ZZCustomAlertView alertViewWithParentView:self.view andContentView:btn];
alert.shouldBlurBackground = YES;
alert.allowTapBackgroundToDismiss = NO;
alert.shadowColor = [UIColor whiteColor];
alert.shadowAlpha = 0.1f;
[alert show];
更多詳情請(qǐng)?jiān)L問 Github 項(xiàng)目地址:https://github.com/zzdjk6/ZZCustomAlertView
評(píng)論
圖片
表情
