2

I've got 2 view controllers, let's say A and B. In A, I'm calling B to be shown with transition style UIModalTransitionStylePartialCurl

[b setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:b animated:YES];

It is working fine. However when I press the curled area in the program compiled with iOS 4.3. It does not dismiss at all. It doesn't get back to A view controller...

What the most interesting is that this curl is active and giving response in the app compiled with iOS 5.0.

How can I resolve this problem?
Moreover, why doesn't it dismiss the B view controller and get back to A ?

kkocabiyik
  • 4,246
  • 7
  • 30
  • 40
  • Show your codes. It would help us to have the proper understanding and give the needed answer. – adedoy Dec 22 '11 at 16:19
  • Well actually there is no code at all. All the thing that I'm doing is, the code above from A view controller. I can show you the XIB of B view controller. What I can say is that It is somehow because of there is a subview under the curl so that It is not triggered. But I did not understand the main reason. http://92.44.22.81/~waqas/ss.png – kkocabiyik Dec 22 '11 at 16:45

1 Answers1

1

Here is the link to Apple site for the Modal View Controllers

Basically, you need to setup delegate, etc. And call dismissModalViewControllerAnimated: method from your viewcontroller A. Let me know if you need further help.

Edit per MiiChiel:

In BController.h file, add this:

@protocol BControllerDelegate <NSObject>
-(void)dismissMe;
@end

@interface BController : UIViewController
//...
@property (assign) id <BControllerDelegate> delegate;
//...
@end

In BController.m file, add this:

@implementation BController
@synthesize delegate;
//...
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.delegate dismissMe];
}

In the AController.h file, add this:

#import "BController.h"

@interface AController : UIViewController  <BControllerDelegate>

In the AController.m file, add this:

//add this line before presenting the modal view controller B
bController.delegate = self;  // assuming bController is the name of the modal

-(void)dismissMe
{
    //call back from modal view to dismiss it
    [self dismissModalViewControllerAnimated:YES];
}
user523234
  • 14,323
  • 10
  • 62
  • 102
  • Why do we need it? We are using a default transition. Actually when my view is empty ,which means there is no other control than a view , it gets back to A view controller by clicking the partial page curl. As you stated, I needed to create delegate. However how can i access the partial page curl so that we can understand the click behavior? – kkocabiyik Dec 22 '11 at 18:23
  • The partial page curl is your parent view. The page under the curl is the modal view. So you need to put some type of control on the modal view and setup delegate so it can make a callback. I think you can also dismiss directly from the modal view. But I have always used the delegate method. – user523234 Dec 22 '11 at 21:02
  • user523234, could you explain a little more please? I try to find this work around to click on the curl part to call dismiss the modal view, so I do not have to add an extra 'back' button. But I can't find any code to get a 'touchdown' event from the page curl. Thank you for the response! – MiiChiel Mar 23 '12 at 09:13
  • MiiChiel, check out my updated answer to include the delegate callback for iOS 4.3 – user523234 Apr 21 '12 at 01:23