mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
UI: fix rounded / bordered images definitively(?!!)
This commit is contained in:
parent
b504da3a94
commit
4813b753ff
7 changed files with 38 additions and 32 deletions
|
|
@ -63,7 +63,7 @@
|
|||
<connections>
|
||||
<outlet property="view" destination="106" id="166"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="126" y="-34"/>
|
||||
<point key="canvasLocation" x="646" y="-13"/>
|
||||
</tableViewController>
|
||||
<tableViewController id="sif-q0-7oE" userLabel="conferenceCallsTableController" customClass="CallConferenceTableView">
|
||||
<extendedEdge key="edgesForExtendedLayout"/>
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@
|
|||
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="-155.5" y="270.5"/>
|
||||
<point key="canvasLocation" x="25.5" y="275.5"/>
|
||||
</view>
|
||||
<tableViewController id="20" userLabel="tableController" customClass="ContactDetailsTableView">
|
||||
<extendedEdge key="edgesForExtendedLayout"/>
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@
|
|||
</view>
|
||||
<tableView clipsSubviews="YES" tag="6" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="30" sectionHeaderHeight="44" sectionFooterHeight="22" id="2jK-gw-ULv">
|
||||
<rect key="frame" x="0.0" y="168" width="667" height="165"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
|
|
@ -217,7 +217,7 @@
|
|||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" tag="8" contentMode="scaleAspectFit" image="avatar.png" id="d9m-G0-1u3" userLabel="avatarImage" customClass="UIRoundedImageView">
|
||||
<rect key="frame" x="30" y="8" width="86" height="86"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact avatar">
|
||||
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
|
||||
<point key="canvasLocation" x="740.5" y="222.5"/>
|
||||
<point key="canvasLocation" x="348.5" y="-44.5"/>
|
||||
</view>
|
||||
<tableViewController id="baU-d4-eu3" customClass="HistoryDetailsTableView">
|
||||
<connections>
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
[self update];
|
||||
[_tableView loadDataForAddress:(callLog ? linphone_call_log_get_remote_address(callLog) : NULL)];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
|
|
|
|||
|
|
@ -285,7 +285,11 @@
|
|||
- (void)clearCache:(NSArray *)exclude {
|
||||
for (NSString *key in [viewControllerCache allKeys]) {
|
||||
bool remove = true;
|
||||
if (exclude != nil) {
|
||||
|
||||
/*ImagePickerView can be used as popover and we do NOT want to free it*/;
|
||||
if ([key isEqualToString:ImagePickerView.compositeViewDescription.content]) {
|
||||
remove = false;
|
||||
} else if (exclude != nil) {
|
||||
for (UICompositeViewDescription *description in exclude) {
|
||||
if ([key isEqualToString:description.content] || [key isEqualToString:description.statusBar] ||
|
||||
[key isEqualToString:description.tabBar] || [key isEqualToString:description.sideMenu]) {
|
||||
|
|
|
|||
|
|
@ -16,18 +16,17 @@
|
|||
|
||||
INIT_WITH_COMMON {
|
||||
borderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
|
||||
borderView.layer.borderWidth = 10;
|
||||
borderView.layer.borderColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]].CGColor;
|
||||
borderView.hidden = YES;
|
||||
[self addSubview:borderView];
|
||||
|
||||
[self setBordered:NO];
|
||||
[self setRoundRadius];
|
||||
[self setBordered:YES];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(orientationDidChange:)
|
||||
name:@"UIDeviceOrientationDidChangeNotification"
|
||||
object:nil];
|
||||
|
||||
// self.layer.borderWidth = 1;
|
||||
// self.layer.borderColor = [UIColor redColor].CGColor;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +36,7 @@ INIT_WITH_COMMON {
|
|||
|
||||
- (void)orientationDidChange:(NSNotification *)k {
|
||||
[self setRoundRadius];
|
||||
[self layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)setImage:(UIImage *)image {
|
||||
|
|
@ -45,36 +45,36 @@ INIT_WITH_COMMON {
|
|||
|
||||
- (void)setImage:(UIImage *)image bordered:(BOOL)bordered withRoundedRadius:(BOOL)rounded {
|
||||
// We have to scale image to layers limits so that when we round image, we have a proper circle
|
||||
[super setImage:[image scaleToSize:self.frame.size squared:YES]];
|
||||
[super setImage:image];
|
||||
[self setBordered:bordered];
|
||||
[self setRoundRadius];
|
||||
}
|
||||
|
||||
- (void)setBordered:(BOOL)bordered {
|
||||
borderView.hidden = !bordered;
|
||||
if (bordered) {
|
||||
CGRect frame = self.frame;
|
||||
frame.size.height = frame.size.width = MIN(self.layer.frame.size.height, self.layer.frame.size.width);
|
||||
frame.origin.x = (self.frame.size.width - frame.size.width) / 2;
|
||||
frame.origin.y = (self.frame.size.height - frame.size.height) / 2;
|
||||
borderView.frame = frame;
|
||||
self.layer.borderWidth = 10;
|
||||
// [borderView.layer setCornerRadius:frame.size.height / 2];
|
||||
self.layer.borderColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]].CGColor;
|
||||
} else {
|
||||
self.layer.borderWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (CGRect)computeBox {
|
||||
CGFloat min = MIN(self.frame.size.width, self.frame.size.height);
|
||||
CGRect box = CGRectMake((self.frame.size.width - min) / 2, (self.frame.size.height - min) / 2, min, min);
|
||||
return box;
|
||||
}
|
||||
- (void)setRoundRadius {
|
||||
CALayer *imageLayer = self.layer;
|
||||
CGRect box = [self computeBox];
|
||||
|
||||
CGFloat height = imageLayer.frame.size.height;
|
||||
CGFloat width = imageLayer.frame.size.width;
|
||||
CGFloat roundRadius = MIN(width, height) / 2;
|
||||
borderView.frame = box;
|
||||
borderView.layer.cornerRadius = borderView.frame.size.height / 2;
|
||||
|
||||
[imageLayer setCornerRadius:roundRadius];
|
||||
[imageLayer setMasksToBounds:YES];
|
||||
CGPathRef path = CGPathCreateWithEllipseInRect(box, NULL);
|
||||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithCGPath:path];
|
||||
CAShapeLayer *maskLayer = [CAShapeLayer layer];
|
||||
maskLayer.frame = self.bounds;
|
||||
maskLayer.path = maskPath.CGPath;
|
||||
self.layer.mask = maskLayer;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
borderView.frame = [self computeBox];
|
||||
borderView.layer.cornerRadius = borderView.frame.size.height / 2;
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -500,8 +500,9 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
|
|||
size.width = size.height = MAX(size.width, size.height);
|
||||
}
|
||||
|
||||
UIGraphicsBeginImageContext(scaledImage.size);
|
||||
[scaledImage drawInRect:CGRectMake(0, 0, scaledImage.size.width, scaledImage.size.height)];
|
||||
UIGraphicsBeginImageContext(size);
|
||||
|
||||
[scaledImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
||||
scaledImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue