Skip to content

Commit

Permalink
Merge pull request facebookarchive#599 from seqoy/development
Browse files Browse the repository at this point in the history
Three20 CSS Extension New Design and TTImageViewDelegate improvements.
  • Loading branch information
jwang committed Jul 20, 2011
2 parents 1014505 + 09c7d12 commit 2507a46
Show file tree
Hide file tree
Showing 42 changed files with 2,744 additions and 528 deletions.
Empty file removed Build/ignoreme
Empty file.
22 changes: 17 additions & 5 deletions samples/Style/TTCSSStyleSheets/Classes/StyleSheetViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "StyleSheetViewController.h"

#import "SampleCSSStyleSheet.h"
#import "extThree20CSSStyle/TTCSSRuleSet.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -50,23 +51,34 @@ - (void)loadView {
}

self.title = @"Three20 CSS extension";
self.view.backgroundColor = TTCSS(@"body", backgroundColor);
self.view.backgroundColor = TTCSS( @"body", background_color );

// Using helper macro
UILabel* headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.text = @"Header text";

// When using TTCSS you specify the Rule Set Name and the CSS property.
headerLabel.font = TTCSS(@"h1", font);
headerLabel.textColor = TTCSS(@"h1", color);
headerLabel.backgroundColor = TTCSS(@"h1", backgroundColor);
headerLabel.shadowColor = TTCSS(@"h1", shadowColor);
headerLabel.shadowOffset = TTCSS(@"h1", shadowOffset);
headerLabel.backgroundColor = TTCSS(@"h1", background_color);

// Some CSS property have sub properties.
headerLabel.shadowColor = TTCSS(@"h1", text_shadow).shadowColor;
headerLabel.shadowOffset = TTCSS(@"h1", text_shadow).shadowOffset;

[headerLabel sizeToFit];
[self.view addSubview:headerLabel];

// Using UILabel addition
UILabel* headerLabel2 = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel2.text = @"Header 2 text";
[headerLabel2 applyCssSelector:@"h2"];

// Use the Helper Function TTApplyCSS and specify the Rule Set Name then the object to apply.
TTApplyCSS( @"h2", headerLabel2 );

// This will work too!
[headerLabel applyCssSelector:@"h2"];

[headerLabel2 sizeToFit];
CGFloat top = headerLabel.frame.size.height;
CGRect frame = headerLabel2.frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
187835D313D5F7C2004600D3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6E3793D711B9B59D0011C497 /* Three20Network.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 662D81EF12630516005851C2;
remoteInfo = "Three20Network-Xcode3.2.5";
};
187835D513D5F7C2004600D3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6E3793D711B9B59D0011C497 /* Three20Network.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 662D81B2126304EB005851C2;
remoteInfo = "Three20NetworkUnitTests-Xcode3.2.5";
};
6E036BCC11B38E520025E8EE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6E036BC711B38E520025E8EE /* extThree20CSSStyle.xcodeproj */;
Expand Down Expand Up @@ -355,7 +369,9 @@
isa = PBXGroup;
children = (
6E3793EF11B9B59D0011C497 /* libThree20Network.a */,
187835D413D5F7C2004600D3 /* libThree20Network-Xcode3.2.5.a */,
6E3793F111B9B59D0011C497 /* NetworkUnitTests.octest */,
187835D613D5F7C2004600D3 /* NetworkUnitTests-Xcode3.2.5.octest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -546,6 +562,20 @@
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
187835D413D5F7C2004600D3 /* libThree20Network-Xcode3.2.5.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libThree20Network-Xcode3.2.5.a";
remoteRef = 187835D313D5F7C2004600D3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
187835D613D5F7C2004600D3 /* NetworkUnitTests-Xcode3.2.5.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "NetworkUnitTests-Xcode3.2.5.octest";
remoteRef = 187835D513D5F7C2004600D3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
6E036BCD11B38E520025E8EE /* libextThree20CSSStyle.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down
30 changes: 30 additions & 0 deletions src/Three20/Three20.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
18C011EC13D5EE01006DFF7A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7389D1184ADB400A35176 /* Three20Network.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 662D81EF12630516005851C2;
remoteInfo = "Three20Network-Xcode3.2.5";
};
18C011EE13D5EE01006DFF7A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7389D1184ADB400A35176 /* Three20Network.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 662D81B2126304EB005851C2;
remoteInfo = "Three20NetworkUnitTests-Xcode3.2.5";
};
66FC2E291265264C00F56B19 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
Expand Down Expand Up @@ -362,7 +376,9 @@
isa = PBXGroup;
children = (
6EE738A31184ADB400A35176 /* libThree20Network.a */,
18C011ED13D5EE01006DFF7A /* libThree20Network-Xcode3.2.5.a */,
6EE738A51184ADB400A35176 /* NetworkUnitTests.octest */,
18C011EF13D5EE01006DFF7A /* NetworkUnitTests-Xcode3.2.5.octest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -487,6 +503,20 @@
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
18C011ED13D5EE01006DFF7A /* libThree20Network-Xcode3.2.5.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libThree20Network-Xcode3.2.5.a";
remoteRef = 18C011EC13D5EE01006DFF7A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
18C011EF13D5EE01006DFF7A /* NetworkUnitTests-Xcode3.2.5.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "NetworkUnitTests-Xcode3.2.5.octest";
remoteRef = 18C011EE13D5EE01006DFF7A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
6E6454A71184D42800F08CB1 /* libThree20Style.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down
58 changes: 0 additions & 58 deletions src/Three20Network/Three20Network.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
664B29C212848AAD0008D569 /* TTErrorCodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 664B29C012848AAD0008D569 /* TTErrorCodes.m */; };
664B29C312848AAD0008D569 /* TTErrorCodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 664B29C012848AAD0008D569 /* TTErrorCodes.m */; };
66C16B1C1263059A00A7825A /* libThree20Network-Xcode3.2.5.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 662D81EF12630516005851C2 /* libThree20Network-Xcode3.2.5.a */; };
66C16B21126305AB00A7825A /* libThree20Core-Xcode3.2.5.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 66C16AC31263027400A7825A /* libThree20Core-Xcode3.2.5.a */; };
66F955B0126662E300BEF6F0 /* NetworkURLCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F955AF126662E300BEF6F0 /* NetworkURLCacheTests.m */; };
66F955B1126662E300BEF6F0 /* NetworkURLCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F955AF126662E300BEF6F0 /* NetworkURLCacheTests.m */; };
66F955BA1266647A00BEF6F0 /* both.png in Resources */ = {isa = PBXBuildFile; fileRef = 66F955B71266647A00BEF6F0 /* both.png */; };
Expand Down Expand Up @@ -87,34 +86,6 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
662D824C12630805005851C2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7366611849C5800A35176 /* Three20Core.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 664961541262EE5000C2C80E;
remoteInfo = "UnitTests-Xcode3.2.5";
};
662D82E012639FCA005851C2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7366611849C5800A35176 /* Three20Core.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 664961541262EE5000C2C80E;
remoteInfo = "UnitTests-Xcode3.2.5";
};
66C16AC21263027400A7825A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7366611849C5800A35176 /* Three20Core.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 6650CAA21262F6E2003FF804;
remoteInfo = "Three20Core-Xcode3.2.5";
};
66C16AC61263027400A7825A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6EE7366611849C5800A35176 /* Three20Core.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 664961641262EE5000C2C80E;
remoteInfo = "UnitTests-Xcode3.2.5";
};
66C16B26126305F500A7825A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
Expand Down Expand Up @@ -214,7 +185,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
66C16B21126305AB00A7825A /* libThree20Core-Xcode3.2.5.a in Frameworks */,
66C16B1C1263059A00A7825A /* libThree20Network-Xcode3.2.5.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -439,9 +409,7 @@
isa = PBXGroup;
children = (
6EE7366C11849C5800A35176 /* libThree20Core.a */,
66C16AC31263027400A7825A /* libThree20Core-Xcode3.2.5.a */,
6EE7366E11849C5800A35176 /* CoreUnitTests.octest */,
66C16AC71263027400A7825A /* CoreUnitTests-Xcode3.2.5.octest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -522,7 +490,6 @@
buildRules = (
);
dependencies = (
662D824D12630805005851C2 /* PBXTargetDependency */,
66C16B27126305F500A7825A /* PBXTargetDependency */,
);
name = "Three20NetworkUnitTests-Xcode3.2.5";
Expand All @@ -542,7 +509,6 @@
buildRules = (
);
dependencies = (
662D82E112639FCA005851C2 /* PBXTargetDependency */,
);
name = "Three20Network-Xcode3.2.5";
productName = Three20;
Expand Down Expand Up @@ -625,20 +591,6 @@
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
66C16AC31263027400A7825A /* libThree20Core-Xcode3.2.5.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libThree20Core-Xcode3.2.5.a";
remoteRef = 66C16AC21263027400A7825A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
66C16AC71263027400A7825A /* CoreUnitTests-Xcode3.2.5.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "CoreUnitTests-Xcode3.2.5.octest";
remoteRef = 66C16AC61263027400A7825A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
6EE7366C11849C5800A35176 /* libThree20Core.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down Expand Up @@ -798,16 +750,6 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
662D824D12630805005851C2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "UnitTests-Xcode3.2.5";
targetProxy = 662D824C12630805005851C2 /* PBXContainerItemProxy */;
};
662D82E112639FCA005851C2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "UnitTests-Xcode3.2.5";
targetProxy = 662D82E012639FCA005851C2 /* PBXContainerItemProxy */;
};
66C16B27126305F500A7825A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 662D81C912630516005851C2 /* Three20Network-Xcode3.2.5 */;
Expand Down
5 changes: 5 additions & 0 deletions src/Three20UI/Headers/TTImageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
*/
@property (nonatomic, assign) id<TTImageViewDelegate> delegate;

/**
* The TTURLRequest requester used to load this image.
*/
@property (nonatomic, readonly) TTURLRequest* request;

/**
* Cancel any pending request, remove the image, and redraw the view.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/Three20UI/Headers/TTImageViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@
*/
- (void)imageView:(TTImageView*)imageView didFailLoadWithError:(NSError*)error;

/**
* Called before the image view send a network request.
* At this point we have the opportunity to configure the requester
* with some custom options (to use ETAGs, for example).
*/
- (void)imageView:(TTImageView*)imageView willSendARequest:(TTURLRequest*)requester;

@end
47 changes: 44 additions & 3 deletions src/Three20UI/Headers/TTScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
NSUInteger _touchCount;
CGFloat _overshoot;

// Scroll animation.
// Set the engine to animate the next relayout.
BOOL _nextLayoutAnimated;
NSTimeInterval _centerPageAnimationDuration;

// The first touch in this view.
UITouch* _touch1;

Expand All @@ -91,10 +96,22 @@
}

/**
* The current page index.
* Retrieve or set the current page index.
* If you inform anew value for this page, the Scroll View will
* load this page on the center of the view.
* This operatin is not animated, you should use <tt>setCenterPageIndex:animated:</tt>
* if you want to control the animation.
*/
@property (nonatomic) NSInteger centerPageIndex;

/**
* Set the duration for the animation performed by the <tt>setCenterPageIndex:animated:</tt>
* method.
*
* @default Is the value setted on the <tt>TT_TRANSITION_DURATION</tt> constant.
*/
@property (assign) NSTimeInterval centerPageAnimationDuration;

/**
* Whether or not the current page is zoomed.
*/
Expand All @@ -105,10 +122,19 @@
* out. (read-only)
*
* The value of this property is YES if user is making a zoom gesture, otherwise it is NO
*
*/
@property (nonatomic, readonly) BOOL zooming;

/**
* A Boolean value that indicates whether the user is scrolling the
* view with his finger. If the scroll is scrolling by animation this
* value is NO. (read-only)
*/
@property (readonly) BOOL isDragging;

/**
* The scroller is performing an "hold" action.
*/
@property (nonatomic, readonly) BOOL holding;

/**
Expand All @@ -118,21 +144,29 @@
@property (nonatomic,readonly,getter=isDecelerating) BOOL decelerating;

/**
* A Boolean value that determines whether scrolling is enabled.
*
* @default YES
*/
@property (nonatomic) BOOL scrollEnabled;

/**
/*
* A Boolean value that determines whether zooming is enabled.
*
* @default YES
*/
@property (nonatomic) BOOL zoomEnabled;

/**
* A Boolean value that determines whether rotation is enabled.
*
* @default YES
*/
@property (nonatomic) BOOL rotateEnabled;

/**
* A <tt>CGFloat</tt> value that determines the gap between the pages.
*
* @default 40
*/
@property (nonatomic) CGFloat pageSpacing;
Expand Down Expand Up @@ -214,6 +248,13 @@

- (void)zoomToDistance:(CGFloat)distance;

/**
* Set the current center page and optionally animate the transition.
* <b>Only animate if the distance between the actual page and the informed
* is one. Example: If is one page 1 and you inform page 3, will not animate.</b>
*/
- (void)setCenterPageIndex:(NSInteger)centerPageIndex animated:(BOOL)animated;

/**
* Cancels any active touches and resets everything to an untouched state.
*/
Expand Down
Loading

0 comments on commit 2507a46

Please sign in to comment.