mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 15:38:28 +02:00
Merge MatrixKit develop with commit hash: b85b736313bec0592bd1cabc68035d97f5331137
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
'MXKTableViewHeaderFooterView' class is used to define custom UITableViewHeaderFooterView (Either the header or footer for a section).
|
||||
Each 'MXKTableViewHeaderFooterView-inherited' class has its own 'reuseIdentifier'.
|
||||
*/
|
||||
@interface MXKTableViewHeaderFooterView : UITableViewHeaderFooterView
|
||||
{
|
||||
@protected
|
||||
NSString *mxkReuseIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the `UINib` object initialized for the header/footer view.
|
||||
|
||||
@return The initialized `UINib` object or `nil` if there were errors during
|
||||
initialization or the nib file could not be located.
|
||||
*/
|
||||
+ (UINib *)nib;
|
||||
|
||||
/**
|
||||
The default reuseIdentifier of the 'MXKTableViewHeaderFooterView-inherited' class.
|
||||
*/
|
||||
+ (NSString*)defaultReuseIdentifier;
|
||||
|
||||
/**
|
||||
Customize the rendering of the header/footer view and its subviews (Do nothing by default).
|
||||
This method is called when the view is initialized or prepared for reuse.
|
||||
|
||||
Override this method to customize the view at the application level.
|
||||
*/
|
||||
- (void)customizeTableViewHeaderFooterViewRendering;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import "MXKTableViewHeaderFooterView.h"
|
||||
#import "NSBundle+MatrixKit.h"
|
||||
|
||||
@implementation MXKTableViewHeaderFooterView
|
||||
|
||||
+ (UINib *)nib
|
||||
{
|
||||
// Check whether a nib file is available
|
||||
NSBundle *mainBundle = [NSBundle mxk_bundleForClass:self.class];
|
||||
|
||||
NSString *path = [mainBundle pathForResource:NSStringFromClass([self class]) ofType:@"nib"];
|
||||
if (path)
|
||||
{
|
||||
return [UINib nibWithNibName:NSStringFromClass([self class]) bundle:mainBundle];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSString*)defaultReuseIdentifier
|
||||
{
|
||||
return NSStringFromClass([self class]);
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
[self customizeTableViewHeaderFooterViewRendering];
|
||||
}
|
||||
|
||||
- (void)prepareForReuse
|
||||
{
|
||||
[super prepareForReuse];
|
||||
|
||||
[self customizeTableViewHeaderFooterViewRendering];
|
||||
}
|
||||
|
||||
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
// Check whether a xib is defined
|
||||
if ([[self class] nib])
|
||||
{
|
||||
self = [[[self class] nib] instantiateWithOwner:nil options:nil].firstObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [super initWithReuseIdentifier:reuseIdentifier];
|
||||
[self customizeTableViewHeaderFooterViewRendering];
|
||||
}
|
||||
|
||||
if (reuseIdentifier.length)
|
||||
{
|
||||
// The provided identifier is not always conserved in the new created view.
|
||||
// This depends how the method [initWithStyle:reuseIdentifier:] is trigerred.
|
||||
// Trick: we store a copy of this identifier.
|
||||
mxkReuseIdentifier = reuseIdentifier;
|
||||
}
|
||||
else
|
||||
{
|
||||
mxkReuseIdentifier = [[self class] defaultReuseIdentifier];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*)reuseIdentifier
|
||||
{
|
||||
NSString *identifier = super.reuseIdentifier;
|
||||
|
||||
if (!identifier.length)
|
||||
{
|
||||
identifier = mxkReuseIdentifier;
|
||||
}
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
- (void)customizeTableViewHeaderFooterViewRendering
|
||||
{
|
||||
// Do nothing by default.
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import "MXKTableViewHeaderFooterView.h"
|
||||
|
||||
/**
|
||||
'MXKTableViewHeaderFooterWithLabel' inherits 'MXKTableViewHeaderFooterView' class.
|
||||
It constains a 'UILabel' vertically centered in which the dymanic fonts is enabled.
|
||||
The height of this header is dynamically adapted to its content.
|
||||
*/
|
||||
@interface MXKTableViewHeaderFooterWithLabel : MXKTableViewHeaderFooterView
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UIView *mxkContentView;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *mxkLabel;
|
||||
|
||||
/**
|
||||
The following constraints are defined between the label and the content view (no relative to margin)
|
||||
*/
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkLabelLeadingConstraint;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkLabelTrailingConstraint;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkLabelTopConstraint;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mxkLabelBottomConstraint;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import "MXKTableViewHeaderFooterWithLabel.h"
|
||||
|
||||
@implementation MXKTableViewHeaderFooterWithLabel
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="rhl-fS-u8R" customClass="MXKTableViewHeaderFooterWithLabel">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="35"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="j90-ws-D6K">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="35"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7rK-Dm-IG7">
|
||||
<rect key="frame" x="20" y="5" width="43.5" height="25"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="7rK-Dm-IG7" secondAttribute="bottom" constant="5" id="Ctq-V4-4zl"/>
|
||||
<constraint firstItem="7rK-Dm-IG7" firstAttribute="leading" secondItem="j90-ws-D6K" secondAttribute="leading" constant="20" id="ca1-y3-mIH"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="7rK-Dm-IG7" secondAttribute="trailing" constant="20" id="rCq-5g-qb7"/>
|
||||
<constraint firstItem="7rK-Dm-IG7" firstAttribute="top" secondItem="j90-ws-D6K" secondAttribute="top" constant="5" id="whi-qQ-5Ip"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="j90-ws-D6K" firstAttribute="leading" secondItem="rhl-fS-u8R" secondAttribute="leading" id="4nU-II-QuY"/>
|
||||
<constraint firstAttribute="trailing" secondItem="j90-ws-D6K" secondAttribute="trailing" id="7X5-zE-KV1"/>
|
||||
<constraint firstItem="j90-ws-D6K" firstAttribute="top" secondItem="rhl-fS-u8R" secondAttribute="top" id="KUH-sL-8rz"/>
|
||||
<constraint firstAttribute="bottom" secondItem="j90-ws-D6K" secondAttribute="bottom" id="kAv-oI-Jqg"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<connections>
|
||||
<outlet property="mxkContentView" destination="j90-ws-D6K" id="kf6-b6-hyN"/>
|
||||
<outlet property="mxkLabel" destination="7rK-Dm-IG7" id="qhW-tx-LDx"/>
|
||||
<outlet property="mxkLabelBottomConstraint" destination="Ctq-V4-4zl" id="g3z-6r-3cf"/>
|
||||
<outlet property="mxkLabelLeadingConstraint" destination="ca1-y3-mIH" id="bPn-cL-yI4"/>
|
||||
<outlet property="mxkLabelTopConstraint" destination="whi-qQ-5Ip" id="Qqw-7f-02n"/>
|
||||
<outlet property="mxkLabelTrailingConstraint" destination="rCq-5g-qb7" id="gza-94-zui"/>
|
||||
</connections>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user