punchScrollView does not work in UINavigationController #1

Closed
bitflying opened this Issue Mar 25, 2012 · 6 comments

Comments

Projects
None yet
2 participants

I tried to use punchScrollView in UINavigationController (based on your Example project). When I clicked the Next Page button and got a "EXC BAD_ACCESS" crash.

beak point at " [self loadPages];"

  • (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
    {
    [self loadPages];
    }

Thanks in advance!

Owner

tapwork commented Mar 25, 2012

looks like that you are dragging a page when pushing a new controller, you should remove yourself as delegate and datasource from punchscrollview in dealloc
self.scrollview.punchDataSource = nil;
self.scrollview.punchDelegate = nil;

I do as you told, thing seems better. but only "Page 0 In Section 0" and "Page 1 In Section 0" got be showed. I continued drag 4 times, and got crash at
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

So, Can you give me a example which can work in UINavigation.

Thank in advance!

Owner

tapwork commented Mar 26, 2012

Hi

let's do it the other way.
just send me your snippet and I have look. ;-)
Should be better to find the bug

Cheers
Christian

Christian Menschel
CEO & App Developer

tapwork. mobile design & development

Vogelsanger Strae 286 50825 Kln
fon: 0221.42 302 63 mobil: 0171.68 05 882
mail: christian@tapwork.de

www.tapwork.de

On 26.03.2012, at 09:40, bitflying wrote:

I do as you told, thing seems better. but only "Page 0 In Section 0" and "Page 1 In Section 0" got be showed. I continued drag 4 times, and got crash at
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

So, Can you give me a example which can work in UINavigation.

Thank in advance!


Reply to this email directly or view it on GitHub:
#1 (comment)

  1. I create a Empty project in XCode 4.2
  2. use PunchScrollView.h/PunchScrollView.m, ExamplePageView.h/ExamplePageView.m, PunchUIScrollViewViewController.h/PunchUIScrollViewViewController.m from your exmaple project
  3. In method application didFinishLaunchingWithOptions of AppDelegate.m , add:
    PunchUIScrollViewViewController *rvc = [[PunchUIScrollViewViewController alloc] init];
    UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:rvc];
    [self.window addSubview:[nvc view]];

It work!
I should use
self.window.rootViewController = nvc;
instead of
[self.window addSubview:[nvc view]];
No crash, nat more

Thanks Christian!

bitflying closed this Mar 27, 2012

Owner

tapwork commented Mar 27, 2012

Hi
The crash occured because you did hold retain the navigationcontroller. That is because you are using ARC. And if you build a controller (in your case a navigationcontroller) you need to hold it (retain it)
Because it will be will be released directly.

sent from mobile

Christian Menschel
CEO & App Developer

tapwork. mobile design & development

Vogelsanger Straße 286 · 50825 Köln
fon: 0221.42 302 63 · mobil: 0171.68 05 882
mail: christian@tapwork.de

www.tapwork.de

Am 27.03.2012 um 03:35 schrieb bitflying reply@reply.github.com:

It work!
I should use
self.window.rootViewController = nvc;
instead of
[self.window addSubview:[nvc view]];
No crash, nat more

Thanks Christian!


Reply to this email directly or view it on GitHub:
#1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment