Address comments

This commit is contained in:
Michael Schneider
2016-06-03 13:24:24 -07:00
parent ecd7727ceb
commit 691749d098
4 changed files with 24 additions and 14 deletions

View File

@@ -15,6 +15,8 @@
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h> #import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
#import <AsyncDisplayKit/ASLayoutable.h> #import <AsyncDisplayKit/ASLayoutable.h>
#define ASDisplayNodeLoggingEnabled 0
@class ASDisplayNode; @class ASDisplayNode;
/** /**

View File

@@ -48,8 +48,11 @@ NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp = @"AS
@end @end
//#define LOG(...) NSLog(__VA_ARGS__) #if ASDisplayNodeLoggingEnabled
#define LOG(...) #define LOG(...) NSLog(__VA_ARGS__)
#else
#define LOG(...)
#endif
// Conditionally time these scopes to our debug ivars (only exist in debug/profile builds) // Conditionally time these scopes to our debug ivars (only exist in debug/profile builds)
#if TIME_DISPLAYNODE_OPS #if TIME_DISPLAYNODE_OPS
@@ -1094,13 +1097,9 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
// try to measure the node with the largest size as possible // try to measure the node with the largest size as possible
if (self.supernode == nil && !self.supportsRangeManagedInterfaceState && !_flags.isMeasured) { if (self.supernode == nil && !self.supportsRangeManagedInterfaceState && !_flags.isMeasured) {
if (CGRectEqualToRect(bounds, CGRectZero)) { if (CGRectEqualToRect(bounds, CGRectZero)) {
// FIXME: Better log to let developers know that the node was not measured before the layout call and no frame was set LOG(@"Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
NSLog(@"Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
} else { } else {
ASSizeRange measureSizeRange = ASSizeRangeMake(CGSizeZero, bounds.size); [self measureWithSizeRange:ASSizeRangeMake(CGSizeZero, bounds.size)];
if ([self shouldMeasureWithSizeRange:measureSizeRange]) {
[self measureWithSizeRange:measureSizeRange];
}
} }
} }
} }

View File

@@ -8,8 +8,8 @@
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#import <AsyncDisplayKit/AsyncDisplayKit.h>
#import <AsyncDisplayKit/ASVideoNode.h> #include <UIKit/UIKit.h>
@interface ViewController : UIViewController @interface ViewController : UIViewController

View File

@@ -10,8 +10,7 @@
*/ */
#import "ViewController.h" #import "ViewController.h"
#import "ASLayoutSpec.h" #import <AsyncDisplayKit/AsyncDisplayKit.h>
#import "ASStaticLayoutSpec.h"
@interface ViewController()<ASVideoNodeDelegate> @interface ViewController()<ASVideoNodeDelegate>
@property (nonatomic, strong) ASDisplayNode *rootNode; @property (nonatomic, strong) ASDisplayNode *rootNode;
@@ -22,10 +21,20 @@
#pragma mark - UIViewController #pragma mark - UIViewController
- (void)viewWillAppear:(BOOL)animated - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
[super viewWillAppear:animated]; self = [super initWithNibName:nil bundle:nil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Root node for the view controller // Root node for the view controller
_rootNode = [ASDisplayNode new]; _rootNode = [ASDisplayNode new];
_rootNode.frame = self.view.bounds; _rootNode.frame = self.view.bounds;