I have spent quite a lot of time searching for this answer, but I'm estimating that it is my newbie status that is preventing me from seeing the light.
I am subclassing UIScrollView
to make it into an infinite pager. As part of that, I need to see when a new page comes up, as I intend to only have three "pages" in use at a time for memory conservation. That means I need to have my subclass also act as a delegate.
I have followed the directions of: https://stackoverflow.com/a/9986842/773329. But I am running into some strange (to me) problems.
The primary one here is that when I override setDelegate:(id<UIScrollViewDelegate>)
, to insert the user's delegate, I get a loop in assembly that does not exit:
-(void)setDelegate:(id<UIScrollViewDelegate>)delegate {
_selfDelegate->_userDelegate = delegate;
super.delegate = nil;
super.delegate = (id)_selfDelegate;
}
The assembly:
libobjc.A.dylib`objc_release:
0x12be090: pushl %ebp
0x12be091: movl %esp, %ebp
0x12be093: subl $8, %esp
0x12be096: calll 0x12be09b ; objc_release + 11
0x12be09b: popl %ecx
0x12be09c: movl 8(%ebp), %eax
0x12be09f: testl %eax, %eax
0x12be0a1: je 0x12be0d5 ; objc_release + 69
0x12be0a3: movl (%eax), %edx ; <<< This is where the loop is
0x12be0a5: movl 16(%edx), %edx
0x12be0a8: andl $-4, %edx
0x12be0ab: testb $2, 2(%edx)
0x12be0af: je 0x12be0c5 ; objc_release + 53
0x12be0b1: movl 1002149(%ecx), %ecx
0x12be0b7: movl %ecx, 4(%esp)
0x12be0bb: movl %eax, (%esp)
0x12be0be: calll 0x12bd08c ; objc_msgSend
0x12be0c3: jmp 0x12be0d5 ; objc_release + 69
0x12be0c5: movl %eax, (%esp)
0x12be0c8: movl $0, 4(%esp)
0x12be0d0: calll 0x12bf9d0 ; -[NSObject release]
0x12be0d5: addl $8, %esp
0x12be0d8: popl %ebp
0x12be0d9: ret
Is there something that might be causing the problem?