From 75d1e1d4e78df57c8bcf8642aefe9f42e54256c3 Mon Sep 17 00:00:00 2001 From: Tpphha Date: Wed, 18 Oct 2017 10:54:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Fixed=20=E5=BD=93=E4=BD=BF=E7=94=A8=20xib?= =?UTF-8?q?=20/=20storyboard=20=E6=97=B6=EF=BC=8Cbutton=20=E5=92=8C=20labe?= =?UTF-8?q?l=20=E7=9A=84=E5=A4=A7=E5=B0=8F=E5=B1=95=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当使用 xib / storyboard 时, 如果使用 button 和 label 只约束 x,y ,那么系统会使用 intrinsicContentSize: 方法返回的大小。而 QMUIButton 以及 QMUILabel 是使用自己的方式计算大小,那么我们也应当复写系统的 intrinsicContentSize:保持计算方式的一致性。 --- QMUIKit/QMUIComponents/QMUIButton.m | 4 ++++ QMUIKit/QMUIComponents/QMUILabel.m | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/QMUIKit/QMUIComponents/QMUIButton.m b/QMUIKit/QMUIComponents/QMUIButton.m index f7ec0c31..ca69bfb4 100644 --- a/QMUIKit/QMUIComponents/QMUIButton.m +++ b/QMUIKit/QMUIComponents/QMUIButton.m @@ -128,6 +128,10 @@ - (CGSize)sizeThatFits:(CGSize)size { return resultSize; } +- (CGSize)intrinsicContentSize { + return [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; +} + - (void)layoutSubviews { [super layoutSubviews]; diff --git a/QMUIKit/QMUIComponents/QMUILabel.m b/QMUIKit/QMUIComponents/QMUILabel.m index 3875568a..82bdc0e7 100644 --- a/QMUIKit/QMUIComponents/QMUILabel.m +++ b/QMUIKit/QMUIComponents/QMUILabel.m @@ -34,6 +34,14 @@ - (CGSize)sizeThatFits:(CGSize)size { return size; } +- (CGSize)intrinsicContentSize { + CGFloat preferredMaxLayoutWidth = self.preferredMaxLayoutWidth; + if (preferredMaxLayoutWidth <= 0) { + preferredMaxLayoutWidth = CGFLOAT_MAX; + } + return [self sizeThatFits:CGSizeMake(preferredMaxLayoutWidth, CGFLOAT_MAX)]; +} + - (void)drawTextInRect:(CGRect)rect { return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.contentEdgeInsets)]; } From d5a2f0f1923e0ab16750cde3cef3d82478a8be38 Mon Sep 17 00:00:00 2001 From: MoLice Date: Sun, 5 Nov 2017 18:10:09 +0800 Subject: [PATCH 2/3] new podspec file --- QMUIKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QMUIKit.podspec b/QMUIKit.podspec index 30cd28c5..b510efed 100644 --- a/QMUIKit.podspec +++ b/QMUIKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "QMUIKit" - s.version = "2.0.0" + s.version = "2.0.1" s.summary = "致力于提高项目 UI 开发效率的解决方案" s.description = <<-DESC QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。 From 6782c715f45375a90bd4acde8c91704fda15a21f Mon Sep 17 00:00:00 2001 From: MoLice Date: Sun, 5 Nov 2017 18:25:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20QMUIKit.podspec=20?= =?UTF-8?q?=E5=86=85=E7=9A=84=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QMUIKit.podspec | 109 ++++++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 51 deletions(-) diff --git a/QMUIKit.podspec b/QMUIKit.podspec index b510efed..08db4fa0 100644 --- a/QMUIKit.podspec +++ b/QMUIKit.podspec @@ -17,21 +17,24 @@ Pod::Spec.new do |s| s.platform = :ios, '8.0' s.frameworks = 'Foundation', 'UIKit', 'CoreGraphics', 'Photos' s.preserve_paths = 'QMUIConfigurationTemplate/*' - s.resource = 'QMUIKit/**/*.bundle' s.source_files = 'QMUIKit/QMUIKit.h' - s.subspec 'QMUICore' do |sss| - sss.source_files = 'QMUIKit/QMUIKit.h', 'QMUIKit/UICore', 'QMUIKit/UIKitExtensions' + s.subspec 'QMUICore' do |ss| + ss.source_files = 'QMUIKit/QMUIKit.h', 'QMUIKit/QMUICore', 'QMUIKit/UIKitExtensions' end - s.subspec 'QMUIMainFrame' do |sss| - sss.source_files = 'QMUIKit/UIMainFrame' - sss.dependency 'QMUIKit/QMUICore' - sss.dependency 'QMUIKit/QMUIComponents/QMUINavigationTitleView' - sss.dependency 'QMUIKit/QMUIComponents/QMUITableView' - sss.dependency 'QMUIKit/QMUIComponents/QMUIEmptyView' - sss.dependency 'QMUIKit/QMUIComponents/QMUILabel' - sss.dependency 'QMUIKit/QMUIComponents/QMUIKeyboardManager' + s.subspec 'QMUIResources' do |ss| + ss.resource = 'QMUIKit/QMUIResources/*.bundle' + end + + s.subspec 'QMUIMainFrame' do |ss| + ss.source_files = 'QMUIKit/QMUIMainFrame' + ss.dependency 'QMUIKit/QMUICore' + ss.dependency 'QMUIKit/QMUIComponents/QMUINavigationTitleView' + ss.dependency 'QMUIKit/QMUIComponents/QMUITableView' + ss.dependency 'QMUIKit/QMUIComponents/QMUIEmptyView' + ss.dependency 'QMUIKit/QMUIComponents/QMUILabel' + ss.dependency 'QMUIKit/QMUIComponents/QMUIKeyboardManager' end s.subspec 'QMUIComponents' do |ss| @@ -39,55 +42,55 @@ Pod::Spec.new do |s| ss.dependency 'QMUIKit/QMUICore' ss.subspec 'QMUINavigationTitleView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUINavigationTitleView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUINavigationTitleView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' end ss.subspec 'QMUIButton' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIButton.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIButton.{h,m}' end ss.subspec 'QMUITableView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITableView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITableView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUITableViewProtocols' end ss.subspec 'QMUITableViewProtocols' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITableViewProtocols.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITableViewProtocols.{h,m}' end ss.subspec 'QMUIEmptyView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIEmptyView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIEmptyView.{h,m}' end ss.subspec 'QMUILabel' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUILabel.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUILabel.{h,m}' end ss.subspec 'QMUIKeyboardManager' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIKeyboardManager.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIKeyboardManager.{h,m}' end # 从这里开始就是非必须的组件 ss.subspec 'QMUIAlertController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIAlertController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIAlertController.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIModalPresentationViewController' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' sss.dependency 'QMUIKit/QMUIComponents/QMUITextField' end ss.subspec 'QMUICellHeightCache' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUICellHeightCache.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUICellHeightCache.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUITableViewProtocols' end ss.subspec 'QMUICollectionViewPagingLayout' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUICollectionViewPagingLayout.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUICollectionViewPagingLayout.{h,m}' end ss.subspec 'QMUIDialogViewController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIDialogViewController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIDialogViewController.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' sss.dependency 'QMUIKit/QMUIComponents/QMUIModalPresentationViewController' sss.dependency 'QMUIKit/QMUIComponents/QMUITableView' @@ -98,129 +101,132 @@ Pod::Spec.new do |s| end ss.subspec 'QMUIEmotionView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIEmotionView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIEmotionView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' + sss.dependency 'QMUIKit/QMUIResources' end ss.subspec 'QMUIFloatLayoutView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIFloatLayoutView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIFloatLayoutView.{h,m}' end ss.subspec 'QMUIGridView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIGridView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIGridView.{h,m}' end ss.subspec 'QMUIImagePreviewView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIImagePreviewView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIImagePreviewView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIZoomImageView' sss.dependency 'QMUIKit/QMUIComponents/QMUICollectionViewPagingLayout' sss.dependency 'QMUIKit/QMUIComponents/QMUIEmptyView' end ss.subspec 'QMUIImagePreviewViewController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIImagePreviewViewController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIImagePreviewViewController.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' sss.dependency 'QMUIKit/QMUIComponents/QMUIImagePreviewView' end ss.subspec 'QMUIMarqueeLabel' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIMarqueeLabel.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIMarqueeLabel.{h,m}' end ss.subspec 'QMUIModalPresentationViewController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIModalPresentationViewController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIModalPresentationViewController.{h,m}' end ss.subspec 'QMUIMoreOperationController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIMoreOperationController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIMoreOperationController.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIModalPresentationViewController' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' end ss.subspec 'QMUIOrderedDictionary' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIOrderedDictionary.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIOrderedDictionary.{h,m}' end ss.subspec 'QMUIPieProgressView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIPieProgressView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIPieProgressView.{h,m}' end ss.subspec 'QMUIPopupContainerView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIPopupContainerView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIPopupContainerView.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' end ss.subspec 'QMUIPopupMenuView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIPopupMenuView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIPopupMenuView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' sss.dependency 'QMUIKit/QMUIComponents/QMUIPopupContainerView' end ss.subspec 'QMUIQQEmotionManager' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIQQEmotionManager.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIQQEmotionManager.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIEmotionView' end ss.subspec 'QMUISearchBar' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUISearchBar.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUISearchBar.{h,m}' end ss.subspec 'QMUISearchController' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUISearchController.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUISearchController.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' sss.dependency 'QMUIKit/QMUIComponents/QMUISearchBar' sss.dependency 'QMUIKit/QMUIComponents/QMUIEmptyView' end ss.subspec 'QMUISegmentedControl' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUISegmentedControl.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUISegmentedControl.{h,m}' end ss.subspec 'QMUISlider' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUISlider.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUISlider.{h,m}' end ss.subspec 'QMUITableViewCell' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITableViewCell.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITableViewCell.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' end ss.subspec 'QMUITestView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITestView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITestView.{h,m}' end ss.subspec 'QMUITextField' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITextField.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITextField.{h,m}' end ss.subspec 'QMUITextView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITextView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITextView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUILabel' end ss.subspec 'QMUITips' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUITips.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUITips.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIToastView' + sss.dependency 'QMUIKit/QMUIResources' end ss.subspec 'QMUIVisualEffectView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIVisualEffectView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIVisualEffectView.{h,m}' end ss.subspec 'QMUIZoomImageView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/QMUIZoomImageView.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/QMUIZoomImageView.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUIEmptyView' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' sss.dependency 'QMUIKit/QMUIComponents/QMUISlider' end ss.subspec 'QMUIAssetLibrary' do |sss| - sss.source_files = 'QMUIKit/UIComponents/AssetLibrary/*.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/AssetLibrary/*.{h,m}' end ss.subspec 'QMUIImagePickerLibrary' do |sss| - sss.source_files = 'QMUIKit/UIComponents/ImagePickerLibrary/*.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/ImagePickerLibrary/*.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' + sss.dependency 'QMUIKit/QMUIResources' sss.dependency 'QMUIKit/QMUIComponents/QMUIImagePreviewViewController' sss.dependency 'QMUIKit/QMUIComponents/QMUITableViewCell' sss.dependency 'QMUIKit/QMUIComponents/QMUIButton' @@ -232,17 +238,18 @@ Pod::Spec.new do |s| end ss.subspec 'NavigationBarTransition' do |sss| - sss.source_files = 'QMUIKit/UIComponents/NavigationBarTransition/*.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/NavigationBarTransition/*.{h,m}' sss.dependency 'QMUIKit/QMUIMainFrame' sss.dependency 'QMUIKit/QMUIComponents/QMUINavigationTitleView' end ss.subspec 'QMUIToastView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/ToastView/*.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/ToastView/*.{h,m}' + sss.dependency 'QMUIKit/QMUIComponents/QMUIKeyboardManager' end ss.subspec 'QMUIStaticTableView' do |sss| - sss.source_files = 'QMUIKit/UIComponents/StaticTableView/*.{h,m}' + sss.source_files = 'QMUIKit/QMUIComponents/StaticTableView/*.{h,m}' sss.dependency 'QMUIKit/QMUIComponents/QMUITableViewCell' end