Post

Replies

Boosts

Views

Activity

Reply to Handling trait changes (for dark mode)
Hi Scott, Thank you very much for your input, it now works. Did not know this notation: UITraitUserInterfaceStyle.self It seems to be the same as UITraitUserInterfaceStyle.class which is perhaps a more intuitive notation? Anyway, both notations work, super! I'm mainly programming in C and always a bit afraid that memory is freed behind the scenes. But will give ARC a serious try. Thanks for the suggestion.
Jul ’23
Reply to Handling trait changes (for dark mode)
Tried the following in Objective C: UITraitUserInterfaceStyle* style = [[UITraitUserInterfaceStyle alloc] init]; NSArray* traits = [[NSArray alloc] initWithObjects: style, nil]; [self registerForTraitChanges:traits withTarget:self action:@selector(handleStyleChange)]; [traits release]; [style release]; Unfortunately, this crashes in registerForTraitChanges: UIKitCore`-[UIViewController registerForTraitChanges:withTarget:action:]: 0x1acce3f90 <+60>: bl 0x1acf55568 ; +[UITraitCollection _traitTokensIncludingPlaceholdersForTraits:] -> 0x1acce3f94 <+64>: bl 0x1afc953c0
Jul ’23