自定义弹框

效果图:


自定义弹框_第1张图片

自定义弹框简单使用
将Demo中的FTAlertView工具类文件夹添加进工程即可使用,代码调用如下

- (void)showAlertView {
    FTAlertView *alertView = [[FTAlertView alloc] init];
    // 设置提醒框大小
    [alertView setAlertViewSize:CGSizeMake(0.8*CGRectGetWidth([UIScreen mainScreen].bounds), 200)];
    
    // 自定义提醒框内容视图
    UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), 150)];
    customView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [alertView customContentView:customView];
    
    // 设置对话框按钮 若不需要按钮 参数传nil即可
    [alertView setButtonTitles:@[@"Cancel",@"Next",@"OK"]];
    // 设置按钮高度 按钮可以自定义
    alertView.buttonHeight = 50.0;
    
    // 按钮点击事件响应 buttonIndex与数组titles索引一致
    [alertView clickButtonAction:^(NSInteger buttonIndex) {
        NSLog(@"---button %ld", buttonIndex);
    }];
    
    [alertView show];
}

Demo下载

你可能感兴趣的:(自定义弹框)