我有一个ios iphone应用程序。该应用程序有一个主窗口xib,由标签栏和一个查看区域组成。 还有一个称为订阅更新的xib,它由一个按钮组成,用户可以单击该按钮并发送电子邮件。此按钮弹出电子邮件窗口。 在应用程序委托中,已加载订阅更新xib。订阅更新将添加为窗口rootViewController视图的子视图 当用户单击“订阅更新”按钮时,将弹出邮件窗口。发送邮件或取消后,系统返回到应用程序。当返回时,我们发现只有订阅更新按钮是可单击的,主屏幕上的所有其他按钮都是不可单击的。订阅更新按钮将其位置移到左上角。附有屏幕截图。
App screen. Shows the subscribe update button bottom middle
Screen after cancelling and deleting the draft in the email pop up
只有订阅更新按钮可以单击。
(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.sharedOperationQueue = [[NSOperationQueue new]
autorelease];
SubscribeUpdate *subUpdateCont1 = [[SubscribeUpdate alloc]
initWithNibName:@"SubscribeUpdate" bundle:nil];
self.subscribeUpdateController = subUpdateCont1;
//self.subscribeUpdateController.view.hidden = YES;
[subUpdateCont1 release];
SubscribeUpdate *subUpdateCont2 = [[SubscribeUpdate alloc]
initWithNibName:@"SubscribeUpdate" bundle:nil];
self.subscribeUpdateControllerVideo = subUpdateCont2;
[subUpdateCont2 release];
// Add the tab bar controller's current view as a subview of
the
window
window.rootViewController = tabBarController;
[window makeKeyAndVisible];
[window.rootViewController.view
addSubview:subscribeUpdateController.view];
CGRect newFrame = subscribeUpdateController.view.frame;
CGRect newFrameRoot = window.rootViewController.view.frame;
CGRect newFrameTabBar = tabBarController.tabBar.frame;
NSLog(@"root frame x = %d ",(int)newFrameRoot.origin.x);
NSLog(@"root frame y = %d ",(int)newFrameRoot.origin.y);
NSLog(@"root frame width = %d ",
(int)newFrameRoot.size.width);
NSLog(@"root frame height = %d ",
(int)newFrameRoot.size.height);
NSLog(@"frame x = %d ",(int)newFrame.origin.x);
NSLog(@"frame y = %d ",(int)newFrame.origin.y);
NSLog(@"frame width = %d ",(int)newFrame.size.width);
NSLog(@"frame height = %d ",(int)newFrame.size.height);
NSLog(@"tabbar x = %d ",(int)newFrameTabBar.origin.x);
NSLog(@"tabbar y = %d ",(int)newFrameTabBar.origin.y);
NSLog(@"tabbar width = %d ",(int)newFrameTabBar.size.width);
NSLog(@"tabbar height = %d ",
(int)newFrameTabBar.size.height);
newFrame.origin.x = newFrameRoot.size.width/2 -
newFrame.size.width/2;
newFrame.origin.y = newFrameRoot.size.height -
newFrame.size.height-
newFrameTabBar.size.height-10;
//newFrame.size.width = newFrameRoot.size.width;
//newFrame.size.width = 200;
//newFrame.size.height = 200;
[[subscribeUpdateController view] setHidden:NO];
[subscribeUpdateController.view setFrame:newFrame];
//subscribeUpdateController.view.hidden = YES;
//subscribeUpdateController.view.alpha = 1;
[[UIApplication sharedApplication]
setStatusBarStyle:UIStatusBarStyleLightContent];
// Place the imageviews on the navigation bar
// [window addSubview:imageView];
//[window addSubview:titleImage];
if (self.swingFullscreen == nil)
{
UINavigationController *navController =
[self.tabBarController.viewControllers objectAtIndex:3];
self.swingFullscreen = [navController.viewControllers
objectAtIndex:0];
}
return [[FBSDKApplicationDelegate sharedInstance]
application:application
didFinishLaunchingWithOptions:launchOptions];
}
//In subscribeupdate.m
(IBAction)SendUpdateEmail:(id)sender {
[self sendEmail:emailAddress subject:updateEmailSubject
body:updateEmailBody];
}
-(void)sendEmail: (NSString *)to subject
(NSString*)subject
body:(NSString *)body {
MFMailComposeViewController *composer =
[[MFMailComposeViewController alloc] init];
composer.mailComposeDelegate = self;
[composer setToRecipients:[NSArray arrayWithObject: to]];
[composer setSubject:subject];
[composer setMessageBody:body isHTML:NO];
composer.navigationBar.barStyle = UIBarStyleBlack;
GolfCoachAppDelegate *appDelegate = (GolfCoachAppDelegate *)
.
[[UIApplication sharedApplication] delegate];
if ([MFMailComposeViewController canSendMail] == YES) {
[self presentViewController:composer animated:true
completion:nil];
}
[composer release];
}
-(void)mailComposeController:(MFMailComposeViewController
*)controller didFinishWithResult:(MFMailComposeResult)result
error:
(NSError *)error {
switch (result) {
case MFMailComposeResultSent:
//Email sent
break;
case MFMailComposeResultSaved:
//Email saved
break;
case MFMailComposeResultCancelled:
//Handle cancelling of the email
break;
case MFMailComposeResultFailed:
//Handle failure to send.
break;
default:
//A failure occurred while completing the email
break;
}
[self becomeFirstResponder];
[self dismissViewControllerAnimated:true completion:nil];
我尝试重新排序视图,特别是订阅更新视图。 没啥事儿。 我尝试过在邮件弹出后隐藏订阅更新视图,在这种情况下,主屏幕上的按钮开始起作用。