ActionSheet的用法

- (void)actionSheet {
    UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction *showAllInfoAction = [UIAlertAction actionWithTitle:@"发出的红包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        _type = 2;
        [_headerView reloadTitleByType:_type];
        [self updateData];
    }];
    UIAlertAction *pickAction = [UIAlertAction actionWithTitle:@"收到的红包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        _type = 1;
        [_headerView reloadTitleByType:_type];
        [self updateData];
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [actionSheetController addAction:cancelAction];
    [actionSheetController addAction:showAllInfoAction];
    [actionSheetController addAction:pickAction];
    
    [self presentViewController:actionSheetController animated:YES completion:nil];
}

猜你喜欢

转载自my.oschina.net/u/2519763/blog/1619157