-
-
Save VadimYakovliev/34bde25f88aeb33d140b4d1de47ed855 to your computer and use it in GitHub Desktop.
Revisions
-
timonus revised this gist
Jun 8, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ - (UIImage *)dynamicImage UITraitCollection *const baseTraitCollection = /* an existing trait collection */; UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]]; UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; UITraitCollection *const darkTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]]; __block UIImage *lightImage; [lightTraitCollection performAsCurrentTraitCollection:^{ -
timonus revised this gist
Jun 8, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ - (UIImage *)dynamicImage { UITraitCollection *const baseTraitCollection = /* an existing trait collection */; UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]]; UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; UITraitCollection *const darkTraitCollection = UITraitCollection *lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]]; -
timonus revised this gist
Jun 8, 2019 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ - (UIImage *)dynamicImage { UITraitCollection *const baseTraitCollection = /* an existing trait collection */; UITraitCollection *const lightTraitCollection = UITraitCollection *lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]]; UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; UITraitCollection *const darkTraitCollection = UITraitCollection *lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]]; __block UIImage *lightImage; [lightTraitCollection performAsCurrentTraitCollection:^{ @@ -11,7 +13,7 @@ - (UIImage *)dynamicImage [darkTraitCollection performAsCurrentTraitCollection:^{ darkImage = /* draw image */; }]; [lightImage.imageAsset registerImage:darkImage withTraitCollection:purelyDarkTraitCollection]; return lightImage; } -
timonus revised this gist
Jun 8, 2019 . No changes.There are no files selected for viewing
-
timonus created this gist
Jun 8, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ - (UIImage *)dynamicImage { UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]; UITraitCollection *const darkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; __block UIImage *lightImage; [lightTraitCollection performAsCurrentTraitCollection:^{ lightImage = /* draw image */; }]; __block UIImage *darkImage; [darkTraitCollection performAsCurrentTraitCollection:^{ darkImage = /* draw image */; }]; [lightImage.imageAsset registerImage:darkImage withTraitCollection:darkTraitCollection]; return lightImage; }