Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

factor out sizing method from CLCGCell and add deprecation notices on…

… some old classes
  • Loading branch information...
commit 025a5fe8a964744a6e3b1ed96d9e323bdb65eb7f 1 parent 58d3efa
@ettore authored
View
22 CLCGCell.h
@@ -29,6 +29,14 @@
*/
+/*
+ ------------------------------------------------------------------------------
+ This entire class is deprecated.
+ It will be removed in its entirety in the future.
+ ------------------------------------------------------------------------------
+ */
+
+
/*!
@abstract The max cell height used in layout calculations.
@discussion UIKit says that the max height of a cell should not exceed 2009px.
@@ -54,6 +62,8 @@
if it's set as an "emphasized" cell.
The layout of all components is performed accordingly, adding padding
between elements.
+
+ @deprecated
*/
@interface CLCGCell : UITableViewCell <CLCGCell, CLCGCellCommonLayouter>
@@ -108,6 +118,18 @@
-(CGSize)calculateTextLabelSizeForCellWidth:(CGFloat)w_available_for_text;
/*!
+ Calculates the size of the text of detailTextLabel.
+ @param w_available_for_text The actual width that the text label can occupy.
+ */
+-(CGSize)calculateDetailLabelSizeForCellWidth:(CGFloat)w_available_for_text;
+
+/*!
+ Calculates the size of the text of infoTextLabel.
+ @param w_available_for_text The actual width that the text label can occupy.
+ */
+-(CGSize)calculateInfoLabelSizeForCellWidth:(CGFloat)w_available_for_text;
+
+/*!
Uses styling class methods to derive height measurement that belong to
these cells.
*/
View
39 CLCGCell.m
@@ -37,6 +37,12 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#import "CLCGCell.h"
#import "CLCGImageView.h"
+/*
+ ------------------------------------------------------------------------------
+ This entire class is deprecated.
+ It will be removed in its entirety in the future.
+ ------------------------------------------------------------------------------
+*/
static CGFloat sMaxAccessoryWidth = CLCG_DEFAULT_ACCESSORY_TYPE_W;
@@ -180,8 +186,6 @@ -(void)layoutSubviews
_imgW, _imgH);
[_mainImageView setFrame:img_frame];
- // these should not change
- const CGFloat max_cellh = CLCG_MAX_CELL_H;
const CGFloat x = CGRectGetMaxX(img_frame) + [class imageRightPadding];
const CGFloat w = [[self class] textLabelWidthWithCellW:[self w]];
@@ -192,20 +196,14 @@ -(void)layoutSubviews
[[self textLabel] setFrame:CGRectIntegral(r)];
// layout detail label
- sz = CGSizeMake(w, max_cellh);
- sz = [[[self detailTextLabel] text] sizeWithFont:[[self detailTextLabel] font]
- constrainedToSize:sz
- lineBreakMode:NSLineBreakByWordWrapping];
+ sz = [self calculateDetailLabelSizeForCellWidth:w];
sz.height = ceil(sz.height);
r = CGRectMake(x, [[self textLabel] low] + (int)(_innerPadding/2),
sz.width, sz.height);
[[self detailTextLabel] setFrame:CGRectIntegral(r)];
// info text label
- sz = CGSizeMake(w, max_cellh);
- sz = [[_infoTextLabel text] sizeWithFont:[_infoTextLabel font]
- constrainedToSize:sz
- lineBreakMode:NSLineBreakByWordWrapping];
+ sz = [self calculateInfoLabelSizeForCellWidth:w];
sz.height = ceil(sz.height);
r = CGRectMake(x, [[self detailTextLabel] low] + (int)(_innerPadding/2),
w, sz.height);
@@ -223,6 +221,26 @@ -(CGSize)calculateTextLabelSizeForCellWidth:(CGFloat)w_available_for_text
}
+-(CGSize)calculateDetailLabelSizeForCellWidth:(CGFloat)w_available_for_text
+{
+ CGSize sz = CGSizeMake(w_available_for_text, CLCG_MAX_CELL_H);
+ sz = [[[self detailTextLabel] text] sizeWithFont:[[self detailTextLabel] font]
+ constrainedToSize:sz
+ lineBreakMode:NSLineBreakByWordWrapping];
+ return sz;
+}
+
+
+-(CGSize)calculateInfoLabelSizeForCellWidth:(CGFloat)w_available_for_text
+{
+ CGSize sz = CGSizeMake(w_available_for_text, CLCG_MAX_CELL_H);
+ sz = [[[self infoTextLabel] text] sizeWithFont:[[self infoTextLabel] font]
+ constrainedToSize:sz
+ lineBreakMode:NSLineBreakByWordWrapping];
+ return sz;
+}
+
+
+(CGFloat)maxAccessoryWidth
{
return sMaxAccessoryWidth;
@@ -265,6 +283,7 @@ +(CGFloat)cellHeightForText:(NSString*)text
padding:[self viewportPadding]];
}
+
+(CGFloat)cellHeightForText:(NSString*)text
detailText:(NSString*)detailtext
infoText:(NSString*)infotext
View
14 CLCGCellCommonLayouter.h
@@ -26,6 +26,13 @@
// Created by Ettore Pasquini on 5/1/13.
//
+/*
+ ------------------------------------------------------------------------------
+ The classes and protocols on this file are deprecated.
+ They will be removed in the future.
+ ------------------------------------------------------------------------------
+*/
+
/*!
@discussion Since we don't control the disclosure indicator size (and we need
to know the width when we calc the cell height in the TV controller) let's
@@ -65,7 +72,9 @@
//==============================================================================
#pragma mark
-
+/*!
+ @deprecated
+ */
@protocol CLCGCellCommonLayouter
/*! Changes the background color according to the current `emphasized' state. */
@@ -94,8 +103,11 @@
/*!
+ @discussion
Common layout and display logic for our default cells, composed of a image
on the left side, and 3 text fields on the right side.
+
+ @deprecated
*/
@interface CLCGCellCommonLayouter : NSObject <CLCGCellCommonLayouter>
View
7 CLCGCellCommonLayouter.m
@@ -26,6 +26,13 @@
// Created by Ettore Pasquini on 5/1/13.
//
+/*
+ ------------------------------------------------------------------------------
+ The classes and protocols on this file are deprecated.
+ They will be removed in the future.
+ ------------------------------------------------------------------------------
+*/
+
#import <QuartzCore/QuartzCore.h>
#import "CLCGCellCommonLayouter.h"
#import "CLCGCell.h"
View
3  CLCGLayer.h
@@ -30,6 +30,9 @@
#import "CLCGImageLoader.h"
+/*!
+ @deprecated
+ */
@interface CLCGLayer : CALayer
/**
View
3  CLCGLayer.m
@@ -36,6 +36,9 @@
#import "CLCGLayer.h"
+/*!
+ @deprecated
+ */
@interface CLCGLayer ()
// non-retained pointer to an external cache where to store the UIImage
View
7 CLCGMoreCell.h
@@ -28,9 +28,10 @@
/*!
- @class
-
- @description
+ @class CLCGMoreCell
+ @abstract
+ A "More..." cell for table view pagination.
+ @discussion
This cell renders a centered "Load More" text along with a spinner once
loading begins. It is possible to configure the cell to always display the
spinner, for use cases like infinite scrolling.
View
24 Candygirl.xcodeproj/project.pbxproj
@@ -155,6 +155,19 @@
name = Pods;
sourceTree = "<group>";
};
+ E595C5681B5E3AB2007605AB /* legacy / deprecated */ = {
+ isa = PBXGroup;
+ children = (
+ E5D026041AEF3A9B00154583 /* CLCGCell.h */,
+ E5D026051AEF3A9B00154583 /* CLCGCell.m */,
+ E5D026061AEF3A9B00154583 /* CLCGCellCommonLayouter.h */,
+ E5D026071AEF3A9B00154583 /* CLCGCellCommonLayouter.m */,
+ E5D0260E1AEF3A9B00154583 /* CLCGLayer.h */,
+ E5D0260F1AEF3A9B00154583 /* CLCGLayer.m */,
+ );
+ name = "legacy / deprecated";
+ sourceTree = "<group>";
+ };
E5D025A71AEF3A2400154583 = {
isa = PBXGroup;
children = (
@@ -165,6 +178,7 @@
E5D026471AEF3B6400154583 /* models */,
E5D026451AEF3B0100154583 /* controllers */,
E5D026441AEF3AD200154583 /* views & graphics */,
+ E595C5681B5E3AB2007605AB /* legacy / deprecated */,
E5D025BF1AEF3A2400154583 /* CandygirlTests */,
E5D025B11AEF3A2400154583 /* Products */,
23E522CF161F06FE90E67FDE /* Pods */,
@@ -234,12 +248,6 @@
E5D026171AEF3A9B00154583 /* CLCGTogglerView.m */,
E5D026001AEF3A9B00154583 /* CLCGBarButtonItem.h */,
E5D026011AEF3A9B00154583 /* CLCGBarButtonItem.m */,
- E5D026041AEF3A9B00154583 /* CLCGCell.h */,
- E5D026051AEF3A9B00154583 /* CLCGCell.m */,
- E5D0260E1AEF3A9B00154583 /* CLCGLayer.h */,
- E5D0260F1AEF3A9B00154583 /* CLCGLayer.m */,
- E5D026061AEF3A9B00154583 /* CLCGCellCommonLayouter.h */,
- E5D026071AEF3A9B00154583 /* CLCGCellCommonLayouter.m */,
E5D0260A1AEF3A9B00154583 /* CLCGImageLoader.h */,
E5D0260B1AEF3A9B00154583 /* CLCGImageLoader.m */,
E5D0260C1AEF3A9B00154583 /* CLCGImageView.h */,
@@ -251,10 +259,10 @@
E5D026451AEF3B0100154583 /* controllers */ = {
isa = PBXGroup;
children = (
- E5D026141AEF3A9B00154583 /* CLCGTableViewVC.h */,
- E5D026151AEF3A9B00154583 /* CLCGTableViewVC.m */,
E5D026181AEF3A9B00154583 /* CLCGVC.h */,
E5D026191AEF3A9B00154583 /* CLCGVC.m */,
+ E5D026141AEF3A9B00154583 /* CLCGTableViewVC.h */,
+ E5D026151AEF3A9B00154583 /* CLCGTableViewVC.m */,
);
name = controllers;
sourceTree = "<group>";
View
4 Candygirl.xcodeproj/project.xcworkspace/xcshareddata/Candygirl.xccheckout
@@ -7,14 +7,14 @@
<key>IDESourceControlProjectIdentifier</key>
<string>6A23E663-CD2F-4820-BCF4-2C83319C6675</string>
<key>IDESourceControlProjectName</key>
- <string>project</string>
+ <string>Candygirl</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>A7C2FF5F8E6CB0900FD5CA7D97EAAA85DAAA09F2</key>
<string>github.com:ettore/candygirl.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
- <string>Candygirl.xcodeproj/project.xcworkspace</string>
+ <string>Candygirl.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>A7C2FF5F8E6CB0900FD5CA7D97EAAA85DAAA09F2</key>
View
33 categories/UIApplication+CLCG.h
@@ -1,33 +0,0 @@
-// Copyright (c) 2012, Cubelogic
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// - Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-//
-// Created by e p on 3/18/12.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface UIApplication (Candygirl)
-
-
-@end
View
35 categories/UIApplication+CLCG.m
@@ -1,35 +0,0 @@
-// Copyright (c) 2012, Cubelogic
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// - Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-//
-// Created by e p on 3/18/12.
-//
-
-
-#import "UIApplication+CLCG.h"
-
-
-@implementation UIApplication (Candygirl)
-
-
-@end
Please sign in to comment.
Something went wrong with that request. Please try again.