|
@@ -360,23 +360,24 @@ NSPopoverDelegate>
|
|
|
totalWidth+=CGRectGetWidth(self.officeButton.bounds);
|
|
|
totalWidth+=4;
|
|
|
}
|
|
|
+#else
|
|
|
+ self.officeButton.hidden = YES;
|
|
|
+ self.officeImg.hidden = YES;
|
|
|
#endif
|
|
|
- if (type == KMUserScenarioTypeLite_type1 ||
|
|
|
- type == KMUserScenarioTypeLite_type3 ||
|
|
|
- type == KMUserScenarioTypeLite_type7 ||
|
|
|
- type == KMUserScenarioTypeLite_type11) {
|
|
|
- if (KMAdvertisementManager.manager.info.topRightInfoContent != nil) {
|
|
|
- if (KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject != nil) {
|
|
|
- KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject;
|
|
|
- NSString *name = [KMAdvertisementModelTransition transitionLanguageWithLangeuage:info.name];
|
|
|
- self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(name, nil)];
|
|
|
-
|
|
|
- NSURL *url = [NSURL URLWithString: [KMAdvertisementModelTransition transitionImagePathWithImage:info.image highlight: YES]];
|
|
|
- __weak typeof(self)weakSelf = self;
|
|
|
- weakSelf.bgImg.image = [KMAdvertisementImage imageWithURLWithUrl:url completion:^(NSImage *image) {
|
|
|
+
|
|
|
+ if (KMAdvertisementManager.manager.info.topRightInfoContent != nil) {
|
|
|
+ if (KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject != nil) {
|
|
|
+ KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject;
|
|
|
+ NSString *name = [KMAdvertisementModelTransition transitionLanguageWithLangeuage:info.name];
|
|
|
+ self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(name, nil)];
|
|
|
+
|
|
|
+ NSURL *url = [NSURL URLWithString: [KMAdvertisementModelTransition transitionImagePathWithImage:info.image highlight: YES]];
|
|
|
+ __weak typeof(self)weakSelf = self;
|
|
|
+ NSImage * img = [KMAdvertisementImage imageWithURLWithUrl:url completion:^(NSImage *image) {
|
|
|
+ if (image != nil) {
|
|
|
weakSelf.bgImg.image = image;
|
|
|
- }];
|
|
|
- }
|
|
|
+ }
|
|
|
+ }];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -411,6 +412,12 @@ NSPopoverDelegate>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ buttonWidth = CGRectGetMaxX(self.button.frame);
|
|
|
+ NSRect btnRect = [self.button.attributedTitle boundingRectWithSize:CGSizeMake(MAXFLOAT, CGRectGetHeight(self.button.frame)) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading];
|
|
|
+ if (fabs(buttonWidth-btnRect.size.width)>50) {
|
|
|
+ buttonWidth = btnRect.size.width + 10;
|
|
|
+ }
|
|
|
+
|
|
|
self.button.frame = CGRectMake(totalWidth, kbottomGap, buttonWidth, self.view.frame.size.height -2 *kbottomGap);
|
|
|
CGRect rect = self.button.frame;
|
|
|
self.bgImg.frame = rect;
|