我正在使用协议,并且正在泄漏,这是我的代码:
+ (id<GMGridViewLayoutStrategy>)strategyFromType:(GMGridViewLayoutStrategyType)type
{
id<GMGridViewLayoutStrategy> strategy = nil;
switch (type) {
case GMGridViewLayoutVertical:
strategy = [[GMGridViewLayoutVerticalStrategy alloc] init];
break;
case GMGridViewLayoutHorizontal:
strategy = [[GMGridViewLayoutHorizontalStrategy alloc] init];
break;
case GMGridViewLayoutHorizontalPagedLTR:
strategy = [[GMGridViewLayoutHorizontalPagedLTRStrategy alloc] init];
break;
case GMGridViewLayoutHorizontalPagedTTB:
strategy = [[GMGridViewLayoutHorizontalPagedTTBStrategy alloc] init];
break;
}
return strategy;
}
如果我做自动释放,那么它会崩溃。那么我现在该怎么办?请帮助我...谢谢...