iphone - Modal view controller won't dismiss itself -


what i'm doing:

in app, i'm presenting modal view controller (containing app settings) using following code:

    optionsviewcontroller.modaltransitionstyle = uimodaltransitionstylepartialcurl;     [self presentmodalviewcontroller:optionsviewcontroller animated:yes]; 

this transition curls bottom part of view expose few settings. (see 'maps' app example.) when tap on top half of page, original view still there grayed out, modal view controller automatically dismissed (handled os, didn't code this).

-

what's not working:

this working fine in ios 4 (my app on app store in fact). in ios 5, looks apple have changed behavior of transition, , view controller no longer dismisses itself. i'm trying replicate behavior handled os before, can't figure out how to.

-

what i've tried:

adding invisible button top of options view doesn't work. page curls full way, don't want.

apart this, i'm stuck. how should replicate how worked (or doing wrong way start!). appreciated!

dude, ran same problem.. , here found using parentviewcontroller:

note of 5.0 no longer return presenting view controller.

this written in header file of uiviewcontroller...

i using sharekit, , modalviewcontroller working in ios4, in ios5, won't dismiss itself! because in code, using:

    [[currentview parentviewcontroller] dismissmodalviewcontrolleranimated:animated]; 

and parentviewcontroller return nil, since modal presented view controller...

by searching solution, found question.. so, decided fix myself :p

i changed previous line this:

    [currentview dismissmodalviewcontrolleranimated:yes]; 

works charm.


edit: depending on how interpret original question, there 2 answers. here's second:

in ios5 seems modal controller dismisses when click curl, not above curl or backgound. in ios5, in order modal view dismiss when tapping background or above curl added following code controller, listen taps on modal view, ignore taps buttons. should mimic behavior in previous version of ios when working modal controller page curl.

- (void)viewdidload {     uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletap:)];     tap.numberoftapsrequired = 1;     tap.numberoftouchesrequired = 1;     tap.delegate = self;               [backgroundview addgesturerecognizer:tap]; }  - (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch{     //change condition         if ([touch.view iskindofclass:[uibutton class]]) {              return no;     }     return yes; }  - (void)handletap:(uitapgesturerecognizer *)sender {     [self dismissmodalviewcontrolleranimated:yes]; } 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -