mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 00:49:32 +00:00
Fixed rendering bug on 10.10 and 10.11 for custom fields
This commit is contained in:
@@ -798,7 +798,7 @@
|
||||
<rect key="frame" x="1" y="1" width="259" height="268"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" viewBased="YES" id="193">
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" viewBased="YES" id="193" customClass="MPCustomFieldTableView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="259" height="268"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
|
||||
13
MacPass/MPCustomFieldTableView.h
Normal file
13
MacPass/MPCustomFieldTableView.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// MPCustomFieldTableView.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 11.09.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface MPCustomFieldTableView : NSTableView
|
||||
|
||||
@end
|
||||
24
MacPass/MPCustomFieldTableView.m
Normal file
24
MacPass/MPCustomFieldTableView.m
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// MPCustomFieldTableView.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 11.09.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPCustomFieldTableView.h"
|
||||
|
||||
@implementation MPCustomFieldTableView
|
||||
|
||||
- (NSSize)intrinsicContentSize {
|
||||
if(@available(macOS 10.12, *)) {
|
||||
return [super intrinsicContentSize];
|
||||
}
|
||||
if(self.numberOfRows > 0) {
|
||||
return NSMakeSize(-1, self.numberOfRows * self.rowHeight);
|
||||
}
|
||||
return NSMakeSize(-1, -1);
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -35,6 +35,24 @@ NSInteger MPCustomFieldIndexFromTag(NSInteger tag) {
|
||||
@implementation MPCustomFieldTableViewDelegate
|
||||
|
||||
|
||||
- (void)tableView:(NSTableView *)tableView didRemoveRowView:(NSTableRowView *)rowView forRow:(NSInteger)row {
|
||||
if(@available(macOS 10.12, *)) {
|
||||
// 10.12 and higher are working correctly
|
||||
}
|
||||
else {
|
||||
[tableView invalidateIntrinsicContentSize];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row {
|
||||
if(@available(macOS 10.12, *)) {
|
||||
// 10.12 and higher are working correctly
|
||||
}
|
||||
else {
|
||||
[tableView invalidateIntrinsicContentSize];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
|
||||
static NSTextFieldCell *cell;
|
||||
|
||||
@@ -134,15 +134,10 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
[self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]];
|
||||
|
||||
/* extract custom field table view */
|
||||
self.customFieldsTableView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
NSView *customFieldTableView = self.customFieldsTableView;
|
||||
self.customFieldsTableView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.customFieldsTableView.enclosingScrollView removeFromSuperviewWithoutNeedingDisplay];
|
||||
if (@available(macOS 10.13, *)) {
|
||||
//self.customFieldsTableView.usesAutomaticRowHeights = YES;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
[self.customFieldsTableView removeFromSuperviewWithoutNeedingDisplay];
|
||||
|
||||
[self.generalView addSubview:customFieldTableView];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user