theos screen recording application
I asked ChatGPT to write the code for me and it spit out this [code] #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <ControlCenterUIKit/ControlCenterUIKit.h>
@interface MyScreenRecorderButton : CCUIControlCenterButtonModule
@property (nonatomic, assign) BOOL isRecording; @property (nonatomic, strong) CCUIControlCenterButton *button;
- (void)toggleRecording;
@end
@implementation MyScreenRecorderButton
-
(id)init { if ((self = [super init])) { self.isRecording = NO;
self.button = [CCUIControlCenterButton buttonWithGlyphImage:[UIImage imageNamed:@"ScreenRecorderGlyph"]]; [self.button addTarget:self action:@selector(toggleRecording) forControlEvents:UIControlEventTouchUpInside]; self.view = self.button;} return self; }
-
(void)toggleRecording { if (self.isRecording) { // Stop the screen recording [objc_getClass("SBControlCenterController") dismissAnimated:YES]; } else { // Start the screen recording [objc_getClass("SBControlCenterController") _performCustomActionWithRequest:1]; } self.isRecording = !self.isRecording; }
@end
%ctor { [NSClassFromString(@"CCUICustomModuleViewController") registerModuleWithClass:[MyScreenRecorderButton class]]; }[/code] but when I try to compile it there is a error that says the control Center ui kit file is missing
Posted Nov 1, 2023, 4:05 PM UTC