Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

iOS How to make custom height sheets

$
0
0

I want to make custom with height of 200px in OBJC, In swift we can do that by setting the detents = [.height(200)], but how do we achieve this in OBJC

Code

    UIViewController *io = [[SheetViewController alloc] init];    [io setModalInPresentation:YES];    io.modalPresentationStyle = UIModalPresentationFormSheet;    if (@available(iOS 15.0, *)) {                UISheetPresentationController *sheetPresentationController = io.sheetPresentationController;        sheetPresentationController.detents = @[CGRectGetHeight(200)];        sheetPresentationController.preferredCornerRadius = 30;            }    [self presentViewController:io animated:true completion:^{        NSLog(@"Sheet Called");    }];

Error in line 10:Passing 'int' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')

I tried setting the height just like Swift but it doesnt work, does anyone know why?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>