【发布时间】:2012-09-12 12:44:32
【问题描述】:
注意:我的问题是基于检查this 及其答案。
在一些更大的方法中,有些代码你只想在一段时间内存活。一个例子:
1) 我有一个设置我的 UI 的大方法:UILabel's 大小、颜色、定位、UIView's 手势识别器等。知道了以上内容,这样做是否有意义:
- (void)setUI
{
//setting other UI elements
{
// Add the Swipe Gesture to the swipeUpView
UISwipeGestureRecognizer *swipeGestureUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(animeViewWithSwipeGesture)];
swipeGestureUp.direction = UISwipeGestureRecognizerDirectionUp;
[_swipeUpView addGestureRecognizer:swipeGestureUp];
}
// setting other UI elements
}
- 根据上面的例子,这是降低应用程序内存占用的有效方法吗?
- 和
@autoreleasepool{}有关系吗?
【问题讨论】:
标签: objective-c ios c curly-braces