Skip to content

Commit f338318

Browse files
_Finder丶Tiwk_Finder丶Tiwk
authored andcommitted
#Fix: FLBFlutterViewContainter通过xib/storyboard初始化时,显示错乱问题
1 parent 29531c8 commit f338318

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

ios/Classes/Container/FLBFlutterViewContainer.m

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,31 @@ - (NSString *)uniqueIDString
8686
return @(_identifier).stringValue;
8787
}
8888

89+
- (void)_setup
90+
{
91+
static long long sCounter = 0;
92+
_identifier = sCounter++;
93+
[self.class instanceCounterIncrease];
94+
95+
SEL sel = @selector(flutterViewDidShow:);
96+
NSString *notiName = @"flutter_boost_container_showed";
97+
[NSNotificationCenter.defaultCenter addObserver:self
98+
selector:sel
99+
name:notiName
100+
object:nil];
101+
}
102+
89103
- (instancetype)init
90104
{
91105
if(self = [super init]){
92-
static long long sCounter = 0;
93-
_identifier = sCounter++;
94-
[self.class instanceCounterIncrease];
95-
[NSNotificationCenter.defaultCenter addObserver:self
96-
selector:@selector(flutterViewDidShow:) name:@"flutter_boost_container_showed"
97-
object:nil];
106+
[self _setup];
107+
}
108+
return self;
109+
}
110+
111+
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
112+
if (self = [super initWithCoder: aDecoder]) {
113+
[self _setup];
98114
}
99115
return self;
100116
}

0 commit comments

Comments
 (0)