mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 21:26:04 +00:00
Is there a better way for the Custom Logo implementation?
This commit is contained in:
parent
69dc003517
commit
5197eacd2a
1 changed files with 16 additions and 10 deletions
26
uYouPlus.xm
26
uYouPlus.xm
|
|
@ -145,17 +145,23 @@ static void repositionCreateTab(YTIGuideResponse *response) {
|
|||
// uYouPlusExtra Logo - #183
|
||||
%group gDefaultYouTubeLogo
|
||||
%hook YTHeaderLogoController
|
||||
- (id)logoView {
|
||||
id originalLogoView = %orig;
|
||||
if (originalLogoView) {
|
||||
if (self.pageStyle == 0) {
|
||||
[self customLogoWithImageName:@"youtube_logo.png"];
|
||||
} else if (self.pageStyle == 1) {
|
||||
[self customLogoWithImageName:@"youtube_logo_dark.png"];
|
||||
}
|
||||
}
|
||||
return originalLogoView;
|
||||
}
|
||||
%new
|
||||
- (void)customLogo {
|
||||
if (self.pageStyle == 0) {
|
||||
UIImageView *customLogoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 122, 48)];
|
||||
customLogoView.image = [UIImage imageWithContentsOfFile:@"/Library/Application Support/uYouPlus.bundle/youtube_logo.png"];
|
||||
[self.logoView addSubview:customLogoView];
|
||||
} else if (self.pageStyle == 1) {
|
||||
UIImageView *customLogoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 122, 48)];
|
||||
customLogoView.image = [UIImage imageWithContentsOfFile:@"/Library/Application Support/uYouPlus.bundle/youtube_logo_dark.png"];
|
||||
[self.logoView addSubview:customLogoView];
|
||||
}
|
||||
- (void)customLogoWithImageName:(NSString *)imageName {
|
||||
UIImageView *customLogoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 122, 48)];
|
||||
customLogoView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"/Library/Application Support/uYouPlus.bundle/%@", imageName]];
|
||||
UIView *logoView = [self valueForKey:@"logoView"];
|
||||
[logoView addSubview:customLogoView];
|
||||
}
|
||||
%end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue