iphone - MFMailComposeViewController breaks navigationController's behavior -


ok here situation: have main viewcontroller(mainvc) navigation controller(nc) , 2 child viewcontrollers(childvc1-childvc2).

the navigation bar of nc gets hidden when viewwillappear gets called on mainvc:
- (void) viewwillappear:(bool)animated {
[self.navigationcontroller setnavigationbarhidden:true animated:animated]; }

the navigation bar shown before child view pushed on mainvc via nc:
mainvc *childvc1 = [[childvcontroller1 alloc] initwithnibname:@"childvcontroller1" bundle:nil];
[self.navigationcontroller setnavigationbarhidden:false animated:true];
[self.navigationcontroller pushviewcontroller:childvc1 animated:yes];
[childvc1 release];

the navigation bar hidden again via viewwillappear of mainvc, when gets called after child view popped via standard button on navigation bar.

all works smoothly until mfmailcomposeviewcontroller, standard mail viewcontroller called via presentmodalviewcontroller method child viewcontroller:
- (void) sendmail {
mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init];
picker.mailcomposedelegate = self;
[picker setsubject:[nsstring stringwithformat:@"subject"];
nsstring emailbody=[nsstring stringwithformat:@"mail message body"]];
[picker setmessagebody:emailbody ishtml:no];
[picker settorecipients:[nsarray arraywithobject:@"john.appleseed@apple.com"]];
if (picker != nil) {
[self presentmodalviewcontroller:picker animated:yes];
[picker release];
} else {
nslog(@"no email configured");
}
}
- (void)mailcomposecontroller:(mfmailcomposeviewcontroller
)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror*)error {
[self dismissmodalviewcontrolleranimated:yes];
}

now mail viewcontroller dismissed (sent mail), , on child viewcontroller.

at point if tap button on navigation bar in order return mainvc, navigation bar not hidden. because viewwillappear method on mainvc not called.

i have tried implement work around introducing delegate navigation controller within child view, thereby hiding navbar , popping child view after dismmissal of mail view controller (sent mail).

it seemed trick, following above actions (sent mail, hide navbar , pop child view) if push child view (emailer childvc1 or other rather flat childvc2) , pop via button, navigation bar not hidden again! because viewwillappear method on mainvc isn't still getting called. viewwilldisappear on childvcs aren't called either.

i conclude calling mail viewcontroller via presentmodalviewcontroller method child viewcontroller, somehow break navigation mechanism of navigationcontroller.

note mainvc shown inside tabbaritem. , if go tab , return one, behavior of navigationcontroller restored - until sent mail.

there must not doing properly. ideas?

did try putting hide code inside viewdidappear instead of viewwillappear?


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -