mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Delay set userInteractionEnabled to NO until didLoad
This commit is contained in:
@@ -19,6 +19,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ASControlNode (Subclassing)
|
||||
|
||||
/**
|
||||
@abstract Indicates whether or not at least one target was added to the receiver
|
||||
@discussion YES if the receiver has at least one target; NO otherwise.
|
||||
*/
|
||||
@property (nonatomic, readonly, assign, getter=isTargetAdded) BOOL targetAdded;
|
||||
|
||||
/**
|
||||
@abstract Sends action messages for the given control events.
|
||||
@param controlEvents A bitmask whose set flags specify the control events for which action messages are sent. See "Control Events" in ASControlNode.h for bitmask constants.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#import "ASControlNode.h"
|
||||
#import "ASDisplayNode+Subclasses.h"
|
||||
#import "ASControlNode+Subclasses.h"
|
||||
|
||||
// UIControl allows dragging some distance outside of the control itself during
|
||||
@@ -22,6 +23,7 @@
|
||||
{
|
||||
@private
|
||||
// Control Attributes
|
||||
BOOL _targetAdded;
|
||||
BOOL _enabled;
|
||||
BOOL _highlighted;
|
||||
|
||||
@@ -46,6 +48,7 @@
|
||||
}
|
||||
|
||||
// Read-write overrides.
|
||||
@property (nonatomic, readwrite, assign, getter=isTargetAdded) BOOL targetAdded;
|
||||
@property (nonatomic, readwrite, assign, getter=isTracking) BOOL tracking;
|
||||
@property (nonatomic, readwrite, assign, getter=isTouchInside) BOOL touchInside;
|
||||
|
||||
@@ -77,12 +80,19 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
|
||||
|
||||
_enabled = YES;
|
||||
|
||||
// As we have no targets yet, we start off with user interaction off. When a target is added, it'll get turned back on.
|
||||
self.userInteractionEnabled = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - ASDisplayNode Overrides
|
||||
- (void)didLoad
|
||||
{
|
||||
[super didLoad];
|
||||
|
||||
// As we have no targets yet, we start off with user interaction off. When a target is added, it'll get turned back on.
|
||||
if (!self.targetAdded) {
|
||||
self.userInteractionEnabled = NO;
|
||||
}
|
||||
}
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
// If we're not interested in touches, we have nothing to do.
|
||||
|
||||
Reference in New Issue
Block a user