1

原来这是一个 iOS 5.1 错误。如果搜索措辞正确,则有据可查:-)

我正在将 UIScrollView 与分页子视图一起使用。当我在 Instruments 中测试我的应用程序时,这些都会以某种方式产生泄漏。我已将代码简化为这种简单状态,并且在 2 个子视图之间翻阅时仍然会泄漏。在滚动视图上启用分页。我正在使用 ARC。

CGRect frame;

    frame.origin.x = self.theScrollPart.frame.size.width * 0;                   
    frame.origin.y = 0;
    frame.size = self.theScrollPart.frame.size;

    self->subview = [[UIView alloc] initWithFrame:frame];
    [self.theScrollPart addSubview:subview];

    frame.origin.x = self.theScrollPart.frame.size.width * 1;
    frame.origin.y = 0;
    frame.size = self.theScrollPart.frame.size;

    self->subview2 = [[UIView alloc] initWithFrame:frame];
    [self.theScrollPart addSubview:subview2];

    self.theScrollPart.contentSize = CGSizeMake(self.theScrollPart.frame.size.width * 2, self.theScrollPart.frame.size.height);

.h 文件是:

@property (weak, nonatomic) IBOutlet UIScrollView *theScrollPart;
@property (strong, nonatomic) IBOutlet UIView *subview;
@property (strong, nonatomic) IBOutlet UIView *subview2;

感谢您的帮助,一如既往,如果我忽略了一些明显的事情,我们深表歉意。

4

0 回答 0